Changed the margin computation to properly account of the Signed Distance Function data

This commit is contained in:
Robert Osfield
2017-09-12 16:03:35 +01:00
parent 722ed6fc5e
commit 7a50bdafe3

View File

@@ -64,7 +64,10 @@ int GlyphTexture::compare(const osg::StateAttribute& rhs) const
bool GlyphTexture::getSpaceForGlyph(Glyph* glyph, int& posX, int& posY)
{
int maxAxis = osg::maximum(glyph->s(), glyph->t());
int margin = _margin + (int)((float)maxAxis * _marginRatio);
int margin_from_ratio = (int)((float)maxAxis * _marginRatio);
int search_distance = glyph->getFontResolution().second/8;
int margin = _margin + osg::maximum(margin_from_ratio, search_distance);
int width = glyph->s()+2*margin;
int height = glyph->t()+2*margin;