From 7a50bdafe38b3c538ae3ce085b4c270652a49f5e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 12 Sep 2017 16:03:35 +0100 Subject: [PATCH] Changed the margin computation to properly account of the Signed Distance Function data --- src/osgText/Glyph.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/osgText/Glyph.cpp b/src/osgText/Glyph.cpp index fd6d61f9c..efdf1cfb0 100644 --- a/src/osgText/Glyph.cpp +++ b/src/osgText/Glyph.cpp @@ -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;