1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:07:35 +00:00

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.
This commit is contained in:
Aliaksandr Kalenik 2023-07-18 21:59:33 +02:00 committed by Andreas Kling
parent 2ecafddd1c
commit 0bdc93bca8

View file

@ -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);