From 0bdc93bca8df5d55b2805c4deb443640441f7574 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Tue, 18 Jul 2023 21:59:33 +0200 Subject: [PATCH] LibGfx: Fix double x_scale multiply when glyph kerning is cached This resolves a problem where the kerning value multiplied by the scale is stored in the cache, even though the code retrieving the value from the cache does not anticipate it to be scaled. As a result, it leads to a buggy double multiplication by the scale. --- 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 45cb2fccb5..6b47f85997 100644 --- a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp +++ b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp @@ -701,9 +701,9 @@ float Font::glyphs_horizontal_kerning(u32 left_glyph_id, u32 right_glyph_id, flo } if (m_kern.has_value()) { - auto kerning = m_kern->get_glyph_kerning(left_glyph_id, right_glyph_id) * x_scale; + auto kerning = m_kern->get_glyph_kerning(left_glyph_id, right_glyph_id); m_kerning_cache.set(cache_key, kerning); - return kerning; + return kerning * x_scale; } m_kerning_cache.set(cache_key, 0);