Moved set/getFont from Text/Text3D into TextBase

This commit is contained in:
Robert Osfield
2010-09-29 11:34:55 +00:00
parent e942cc770a
commit b40acacf53
12 changed files with 78 additions and 149 deletions

View File

@@ -18,6 +18,7 @@
#include <osgText/String>
#include <osgText/KerningType>
#include <osgText/Font>
namespace osgText {
@@ -35,7 +36,21 @@ public:
virtual const char* className() const { return "TextBase"; }
virtual const char* libraryName() const { return "osgText"; }
/** Set the Font to use to render the text.
* setFont(0) sets the use of the default font.*/
inline void setFont(Font* font=0) { setFont(osg::ref_ptr<Font>(font)); };
/** Set the Font to use to render the text.*/
void setFont(osg::ref_ptr<Font> font);
/** Set the font, loaded from the specified front file, to use to render the text,
* setFont("") sets the use of the default font.
* See the osgText::readFontFile function for how the font file will be located. */
void setFont(const std::string& fontfile);
/** Get the font. Return 0 if default is being used.*/
const Font* getFont() const { return _font.get(); }
/** Set the Font reference width and height resolution in texels.
* Note, the size may not be supported by current font,
* the closest supported font size will be selected.*/
@@ -248,6 +263,7 @@ protected:
// members which have public access.
osg::ref_ptr<Font> _font;
FontResolution _fontSize;
float _characterHeight;
float _characterAspectRatio;