From 17b22250b6afa30366903b314a62b78a8a94fb79 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 15 Feb 2024 19:48:53 -0500 Subject: [PATCH] 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. --- Userland/Libraries/LibGfx/Font/OpenType/Font.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp index 9ee9ae49af..14115ab3a4 100644 --- a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp +++ b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp @@ -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(data.bitmap_size.ppem_x); - float y_scale = (point_height * 1.3333333f) / static_cast(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(data.bitmap_size.hori.ascender) * y_scale,