LibGfx: Make Gfx::FontMetrics include the advance of '0' instead of 'M'

CSS actually wants the advance of the ASCII '0' character for its "ch"
units, so let's include that instead of the arbitrarily chosen 'M'.
This commit is contained in:
Andreas Kling 2022-03-28 12:01:10 +02:00
commit 0f6dd8c62b
Notes: sideshowbarker 2024-07-17 16:32:34 +09:00
3 changed files with 3 additions and 3 deletions

View file

@ -377,7 +377,7 @@ FontMetrics Font::metrics() const
return FontMetrics {
.size = (float)presentation_size(),
.x_height = (float)x_height(),
.glyph_width = (float)glyph_width('M'),
.advance_of_ascii_zero = (float)glyph_width('0'),
.glyph_spacing = (float)glyph_spacing(),
};
}

View file

@ -89,7 +89,7 @@ private:
struct FontMetrics {
float size { 0 };
float x_height { 0 };
float glyph_width { 0 };
float advance_of_ascii_zero { 0 };
float glyph_spacing { 0 };
};