mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-26 02:16:38 +00:00
See #22821 for a previous attempt. This attempt should settle things once and for all. The opentype render path adjusts by `-font_ascender * -y_scale` in Glyf::Glyph::append_simple_path(), so that's what we need to undo to draw at the font's baseline. (OpenType::Font::metrics() returns ascender scaled by y_scale already, so no need to have the scale here where we undo the shift.) Previously, we called `baseline()` which just returns the font's font size, which is pretty meaningless: https://tonsky.me/blog/font-size/ https://simoncozens.github.io/fonts-and-layout/opentype.html#vertical-metrics-hhea-and-os2 Also, conceptually it makes sense to translate up by the ascender to get from the upper edge of the glyph to the baseline.