I've attached a screenshot of some text rendered in a very standard way
using osgText:

        text->setFont(std::string("fonts/monospace.ttf"));
        text->setCharacterSize(size);
        text->setFontResolution(size, size);
        text->setText(label);
        text->setColor(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));

In the screenshot, a the very bottom, you'll see a bit of text called
"label 6 (copy)". Take a close look at the following characters:

        a, e, 6, (

...and you'll notice that the glyphs are 1 (perhaps 2) pixels "chopped"
off at the left.

I've been hunting this down forever--in fact, I've made a lot of similar
posts in the past--but I simply cannot prevent this occurrence in a
predictable way. If I play with the font sizes I can sometimes achieve
nearly perfect font quality, but it's all guess-work.

So I've decided to go back to square one and ask the mailing lists: can
anyone with any heavy osgText experience give me any hints as to what is
going on? I've tried all of the KERNING options (though this is a
monospace font), I've tried hacking Text/TextBase.cpp so that each Glyph
absolutely is "pixel aligned", I've tried all manner of different
fonts--but nothing seems to give predictable rendering results. My
suspicion is that the GlyphQuads object's _texcoords values are getting
calculated slightly wrong in some cases, but I'm not sure.

Having precise font quality in osgWidget will be really important, so
I'm willing to make any code changes necessary to facilitate this...

<<attachment: orig.png>>

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to