Fixed handling of Font implementations that don't handle multiple font resolutions.

This commit is contained in:
Robert Osfield
2011-05-13 19:08:04 +00:00
parent 460f433ca7
commit fe1c75aa8a
10 changed files with 59 additions and 32 deletions

View File

@@ -350,9 +350,14 @@ osg::Texture::FilterMode Font::getMagFilterHint() const
Glyph* Font::getGlyph(const FontResolution& fontRes, unsigned int charcode)
{
if (!_implementation) return 0;
FontResolution fontResUsed(0,0);
if (_implementation->supportsMultipleFontResolutions()) fontResUsed = fontRes;
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex);
FontSizeGlyphMap::iterator itr = _sizeGlyphMap.find(fontRes);
FontSizeGlyphMap::iterator itr = _sizeGlyphMap.find(fontResUsed);
if (itr!=_sizeGlyphMap.end())
{
GlyphMap& glyphmap = itr->second;
@@ -361,10 +366,10 @@ Glyph* Font::getGlyph(const FontResolution& fontRes, unsigned int charcode)
}
}
Glyph* glyph = _implementation.valid() ? _implementation->getGlyph(fontRes, charcode) : 0;
Glyph* glyph = _implementation->getGlyph(fontResUsed, charcode);
if (glyph)
{
addGlyph(fontRes, charcode, glyph);
addGlyph(fontResUsed, charcode, glyph);
return glyph;
}
else return 0;