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

LibGfx: Return kerning values as a float instead of int

This allows for a more precise rounding of glyph positions.
This commit is contained in:
Jelle Raaijmakers 2022-04-01 12:46:36 +02:00 committed by Andreas Kling
parent ee9a2e0715
commit 7334636933
5 changed files with 12 additions and 12 deletions

View file

@ -1387,8 +1387,8 @@ void draw_text_line(IntRect const& a_rect, Utf8View const& text, Font const& fon
continue;
}
int kerning = font.glyphs_horizontal_kerning(last_code_point, code_point);
if (kerning != 0)
int kerning = static_cast<int>(lroundf(font.glyphs_horizontal_kerning(last_code_point, code_point)));
if (kerning != 0.f)
point.translate_by(direction == TextDirection::LTR ? kerning : -kerning, 0);
IntSize glyph_size(font.glyph_or_emoji_width(code_point) + font.glyph_spacing(), font.pixel_size());