osgText::Text::AlignmentType::LEFT_TOP should align the text to the tallest possible glyph, but in practice it's aligning to the tallest glyph currently present in the input text. This is a problem when the text changes dynamically, because it will jump around as glyphs of different sizes appear. Here's a small repro case with text appearing letter by letter to illustrate the bug. Sorry for the hardcoded Linux font.
I suppose a possible workaround, to achieve top alignment while this isn't fixed, would be to align to the baseline and then correct the position by using the ascender property from osgText::Font::getVerticalSize. But I haven't tried it yet.
Note that a proper fix for this would be a breaking change, since there might be code out there relying on its current behavior. Maybe fixing it properly would require introducing new enum values, such as LEFT_TOP_STABLE?
osgText::Text::AlignmentType::LEFT_TOP
should align the text to the tallest possible glyph, but in practice it's aligning to the tallest glyph currently present in the input text. This is a problem when the text changes dynamically, because it will jump around as glyphs of different sizes appear. Here's a small repro case with text appearing letter by letter to illustrate the bug. Sorry for the hardcoded Linux font.I suppose a possible workaround, to achieve top alignment while this isn't fixed, would be to align to the baseline and then correct the position by using the
ascender
property fromosgText::Font::getVerticalSize
. But I haven't tried it yet.Note that a proper fix for this would be a breaking change, since there might be code out there relying on its current behavior. Maybe fixing it properly would require introducing new enum values, such as
LEFT_TOP_STABLE
?