diff --git a/include/osgText/Font b/include/osgText/Font index 39b96410a..90af2cb36 100644 --- a/include/osgText/Font +++ b/include/osgText/Font @@ -104,7 +104,11 @@ public: /** Return true if this font provides vertical alignments and spacing or glyphs.*/ virtual bool hasVertical() const; - /** Set the margin around each glyph, + /** Get the ascender and descender sizes of the font where supported by the FontImplementation, + * return true on success, return false when not supported.*/ + virtual bool getVerticalSize(float& ascender, float& descender) const { return _implementation ? _implementation->getVerticalSize(ascender, descender) : false; } + + /** Set the margin around each glyph, * to ensure that texture filtering doesn't bleed adjacent glyph's into each other. * Default margin is 1 texels.*/ void setGlyphImageMargin(unsigned int margin); @@ -236,6 +240,8 @@ public: } Font* _facade; + + virtual bool getVerticalSize(float & ascender, float & descender) const { return false; } }; diff --git a/src/osgPlugins/freetype/FreeTypeFont.cpp b/src/osgPlugins/freetype/FreeTypeFont.cpp index 23b3c7d8f..a4fb749af 100644 --- a/src/osgPlugins/freetype/FreeTypeFont.cpp +++ b/src/osgPlugins/freetype/FreeTypeFont.cpp @@ -299,7 +299,7 @@ osgText::Glyph* FreeTypeFont::getGlyph(const osgText::FontResolution& fontRes, u setFontResolution(fontRes); - float coord_scale = 1.0f/(float(_currentRes.second)*64.0f); + float coord_scale = getCoordScale(); // // GT: fix for symbol fonts (i.e. the Webdings font) as the wrong character are being @@ -394,13 +394,15 @@ osgText::Glyph* FreeTypeFont::getGlyph(const osgText::FontResolution& fontRes, u glyph->setVerticalAdvance((float)metrics->vertAdvance * coord_scale); #if 0 - OSG_NOTICE<<"getGlyph("<units_per_EM = "<<_face->units_per_EM<<", scale="<<1.0f/float(_face->units_per_EM)<