1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibGfx/OpenType: Replace a magic number with a calculation

Makes this code look like the corresponding code in the ScaledFont ctor.

Similar to the last commit on #20084.

No behavior change.
This commit is contained in:
Nico Weber 2024-02-15 19:48:53 -05:00 committed by Tim Flynn
parent 073e2bffcb
commit 17b22250b6

View file

@ -358,8 +358,8 @@ Gfx::ScaledGlyphMetrics Font::glyph_metrics(u32 glyph_id, float x_scale, float y
// the pixels-per-em values and the font point size. It appears that bitmaps are not in the same
// coordinate space as the head table's "units per em" value.
// There's definitely some cleaner way to do this.
float x_scale = (point_width * 1.3333333f) / static_cast<float>(data.bitmap_size.ppem_x);
float y_scale = (point_height * 1.3333333f) / static_cast<float>(data.bitmap_size.ppem_y);
float x_scale = (point_width * DEFAULT_DPI) / (POINTS_PER_INCH * data.bitmap_size.ppem_x);
float y_scale = (point_height * DEFAULT_DPI) / (POINTS_PER_INCH * data.bitmap_size.ppem_y);
return Gfx::ScaledGlyphMetrics {
.ascender = static_cast<float>(data.bitmap_size.hori.ascender) * y_scale,