1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2026-01-17 22:51:00 +00:00
serenity/Userland/Libraries/LibPDF/Fonts
Nico Weber 384c6cf0f9 LibPDF: Tweak vertical position of truetype fonts again
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.
2024-02-01 10:05:40 +01:00
..
CFF.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
CFF.h LibPDF: Support offset size 3 in CFF index reading 2023-10-23 09:31:11 -04:00
PDFFont.cpp LibPDF: Add some scaffolding for type 3 fonts 2023-11-17 19:47:53 +00:00
PDFFont.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
PS1FontProgram.cpp Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
PS1FontProgram.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
SimpleFont.cpp LibPDF: Apply text matrix to each glyph's position 2024-01-18 14:01:30 +01:00
SimpleFont.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
TrueTypeFont.cpp LibPDF: Tweak vertical position of truetype fonts again 2024-02-01 10:05:40 +01:00
TrueTypeFont.h LibPDF: Pass Renderer to SimpleFont::draw_glyph() 2023-11-17 19:47:53 +00:00
Type0Font.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Type0Font.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Type1Font.cpp LibPDF: Tweak vertical position of truetype fonts again 2024-02-01 10:05:40 +01:00
Type1Font.h LibPDF: Pass Renderer to SimpleFont::draw_glyph() 2023-11-17 19:47:53 +00:00
Type1FontProgram.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Type1FontProgram.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Type3Font.cpp LibPDF: Add an initial implementation of type 3 glyph rendering 2023-11-17 19:47:53 +00:00
Type3Font.h LibPDF: Pass Renderer to SimpleFont::draw_glyph() 2023-11-17 19:47:53 +00:00