diff --git a/examples/osgfont/osgfont.cpp b/examples/osgfont/osgfont.cpp index 6b8ca7c80..5da7e495c 100644 --- a/examples/osgfont/osgfont.cpp +++ b/examples/osgfont/osgfont.cpp @@ -64,6 +64,8 @@ struct TextSettings { TextSettings(): fontFilename("fonts/arial.ttf"), + glyphImageMargin(1), + glyphImageMarginRatio(0.02), textColor(1.0f, 1.0f, 1.0f, 1.0f), backdropType(osgText::Text::NONE), backdropOffset(0.04f, 0.04f), @@ -90,6 +92,11 @@ struct TextSettings if (arguments.read("--font",fontFilename)) {} + + if (arguments.read("--margin", glyphImageMargin)) {} + if (arguments.read("--margin-ratio", glyphImageMarginRatio)) {} + + if (arguments.read("--outline")) backdropType = osgText::Text::OUTLINE; if (arguments.read("--shadow")) backdropType = osgText::Text::DROP_SHADOW_BOTTOM_RIGHT; @@ -113,6 +120,9 @@ struct TextSettings } std::string fontFilename; + unsigned int glyphImageMargin; + float glyphImageMarginRatio; + osg::Vec4 textColor; osgText::Text::BackdropType backdropType; osg::Vec2 backdropOffset; @@ -128,6 +138,9 @@ osgText::Text* createLabel(const std::string& l, TextSettings& settings, unsigne osgText::Text* label = new osgText::Text(); osg::ref_ptr font = osgText::readRefFontFile(settings.fontFilename); + font->setGlyphImageMargin(settings.glyphImageMargin); + font->setGlyphImageMarginRatio(settings.glyphImageMarginRatio); + settings.setText(*label); label->setCharacterSize(size);