mirror of
https://github.com/RGBCube/serenity
synced 2026-01-17 22:51:00 +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. |
||
|---|---|---|
| .. | ||
| CFF.cpp | ||
| CFF.h | ||
| PDFFont.cpp | ||
| PDFFont.h | ||
| PS1FontProgram.cpp | ||
| PS1FontProgram.h | ||
| SimpleFont.cpp | ||
| SimpleFont.h | ||
| TrueTypeFont.cpp | ||
| TrueTypeFont.h | ||
| Type0Font.cpp | ||
| Type0Font.h | ||
| Type1Font.cpp | ||
| Type1Font.h | ||
| Type1FontProgram.cpp | ||
| Type1FontProgram.h | ||
| Type3Font.cpp | ||
| Type3Font.h | ||