Added new setFont(ref_ptr<>) variants to Text and Text3D

This commit is contained in:
Robert Osfield
2007-12-12 17:48:20 +00:00
parent 256391c3b4
commit 213a370c25
6 changed files with 108 additions and 11 deletions

View File

@@ -67,12 +67,12 @@ Text::~Text()
{
}
void Text::setFont(Font* font)
void Text::setFont(osg::ref_ptr<Font> font)
{
if (_font==font) return;
osg::StateSet* previousFontStateSet = _font.valid() ? _font->getStateSet() : DefaultFont::instance()->getStateSet();
osg::StateSet* newFontStateSet = font ? font->getStateSet() : DefaultFont::instance()->getStateSet();
osg::StateSet* newFontStateSet = font.valid() ? font->getStateSet() : DefaultFont::instance()->getStateSet();
if (getStateSet() == previousFontStateSet)
{
@@ -86,7 +86,7 @@ void Text::setFont(Font* font)
void Text::setFont(const std::string& fontfile)
{
setFont(readRefFontFile(fontfile).get());
setFont(readRefFontFile(fontfile));
}