From Mathias Froehlich, "The attached change to the default font makes the baseline correctly working

and makes the glyphs aspect ratio match their 12x8 bitmaps.
I am not exactly sure about osgTexts current internals but it matches the
changes that happened lately to the txf font.
"
This commit is contained in:
Robert Osfield
2012-02-06 13:35:45 +00:00
parent ec08c4dfea
commit af01a9e984

View File

@@ -223,10 +223,15 @@ void DefaultFont::constructGlyphs()
(*data++)=((*ptr)&1)?value_on:value_off;
}
glyph->setHorizontalBearing(osg::Vec2(0.0f,0.0f)); // bottom left.
glyph->setHorizontalAdvance(1.0f);
float coord_scale = 1.0f/float(sourceHeight);
glyph->setWidth(sourceWidth*coord_scale);
glyph->setHeight(sourceHeight*coord_scale);
glyph->setHorizontalBearing(osg::Vec2(0.0f,-2*coord_scale)); // bottom left.
glyph->setHorizontalAdvance(sourceWidth*coord_scale);
glyph->setVerticalBearing(osg::Vec2(0.5f,1.0f)); // top middle.
glyph->setVerticalAdvance(1.0f);
glyph->setVerticalAdvance(sourceHeight*coord_scale);
addGlyph(fontRes,i,glyph.get());
}