Added a _fontFallback to TextBase to cache any fallback font (usually DefaultFont) that is used when the Textbase::_font is null.
This commit is contained in:
parent
92abaca210
commit
149c04b0df
@ -4,7 +4,7 @@
|
||||
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
||||
SET(OPENSCENEGRAPH_MINOR_VERSION 6)
|
||||
SET(OPENSCENEGRAPH_PATCH_VERSION 5)
|
||||
SET(OPENSCENEGRAPH_SOVERSION 160)
|
||||
SET(OPENSCENEGRAPH_SOVERSION 161)
|
||||
|
||||
|
||||
# set to 0 when not a release candidate, non zero means that any generated
|
||||
|
@ -265,7 +265,6 @@ protected:
|
||||
virtual osg::StateSet* createStateSet();
|
||||
|
||||
Font* getActiveFont();
|
||||
const Font* getActiveFont() const;
|
||||
|
||||
String::iterator computeLastCharacterOnLine(osg::Vec2& cursor, String::iterator first,String::iterator last);
|
||||
|
||||
|
@ -312,6 +312,7 @@ protected:
|
||||
// members which have public access.
|
||||
osg::Vec4 _color;
|
||||
osg::ref_ptr<Font> _font;
|
||||
osg::ref_ptr<Font> _fontFallback;
|
||||
osg::ref_ptr<Style> _style;
|
||||
FontResolution _fontSize;
|
||||
float _characterHeight;
|
||||
|
@ -249,12 +249,11 @@ osg::StateSet* Text::createStateSet()
|
||||
|
||||
Font* Text::getActiveFont()
|
||||
{
|
||||
return _font.valid() ? _font.get() : Font::getDefaultFont().get();
|
||||
}
|
||||
if (_font.valid()) return _font.get();
|
||||
|
||||
const Font* Text::getActiveFont() const
|
||||
{
|
||||
return _font.valid() ? _font.get() : Font::getDefaultFont().get();
|
||||
if (!_fontFallback) _fontFallback = Font::getDefaultFont();
|
||||
|
||||
return _fontFallback.get();
|
||||
}
|
||||
|
||||
String::iterator Text::computeLastCharacterOnLine(osg::Vec2& cursor, String::iterator first,String::iterator last)
|
||||
|
Loading…
Reference in New Issue
Block a user