mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibGfx/OpenType: Load x-height metrics from OS/2 table if available
Before this change we always returned the font's point size as the x-height which was basically never correct. We now get it from the OS/2 table (if one with version >= 2 is available in the file). Otherwise we fall back to using the ascent of the 'x' glyph. Most fonts appear to have a sufficiently modern OS/2 table.
This commit is contained in:
parent
8090adf268
commit
69c33bd4ca
Notes:
sideshowbarker
2024-07-17 08:34:29 +09:00
Author: https://github.com/awesomekling
Commit: 69c33bd4ca
Pull-request: https://github.com/SerenityOS/serenity/pull/19344
6 changed files with 50 additions and 1 deletions
|
@ -27,7 +27,7 @@ ScaledFont::ScaledFont(NonnullRefPtr<VectorFont> font, float point_width, float
|
|||
|
||||
m_pixel_metrics = Gfx::FontPixelMetrics {
|
||||
.size = (float)pixel_size(),
|
||||
.x_height = (float)x_height(),
|
||||
.x_height = metrics.x_height,
|
||||
.advance_of_ascii_zero = (float)glyph_width('0'),
|
||||
.glyph_spacing = (float)glyph_spacing(),
|
||||
.ascent = metrics.ascender,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue