Open rubenlg opened 9 months ago
I'm afraid I can't recall stuff from 12 years ago. The change must have been made to address an issue experience some some user at some point, perhaps archive of osg-users mailing list.
Understandable. I worked around this by using Freetype directly.
Fixing this properly would be a breaking change, as users might be relying on the current implementation. Giving OSG's state, I'm guessing it's not worth it. Should I leave this open as documentation that it's a known bug?
FreeTypeFont::getVerticalSize
relies onFreeTypeFont::getCoordScale
instead ofunitsPerEm
to compute the ascender and descender.FreeTypeFont::getCoordScale
uses_currentRes.second * 64
where _currentRes.second is initialized to 32 and then changes arbitrarily whenever a glyph is computed. So if a font happens to have 2048unitsPerEm
, and nothing ever calledgetGlyph
yet, the font will return the correct ascender and descender. Otherwise you get an arbitrary number that can't be used.I wanted to use that to compute a stable height for my text that won't jump up and down as the text contents change dynamically (see #1269).
I see that there was initially code scaling the ascender and descender correctly with
unitsPerEm
but that is currently disabled with#if 0
. Any idea why that is? It seems to come from here, but that's a very old commit with very little context.