From 9aa4958234f7ebe011b4c07df0d737332c51e438 Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Fri, 15 Apr 2022 19:50:17 +0200 Subject: [PATCH] LibGfx: Use round_to in Painter::draw_text_line --- Userland/Libraries/LibGfx/Painter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index 3d3730bc2c..782387f065 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -1387,7 +1387,7 @@ void draw_text_line(IntRect const& a_rect, Utf8View const& text, Font const& fon continue; } - int kerning = static_cast(lroundf(font.glyphs_horizontal_kerning(last_code_point, code_point))); + int kerning = round_to(font.glyphs_horizontal_kerning(last_code_point, code_point)); if (kerning != 0.f) point.translate_by(direction == TextDirection::LTR ? kerning : -kerning, 0); @@ -2334,7 +2334,7 @@ void Painter::draw_text_run(FloatPoint const& baseline_start, Utf8View const& st // FIXME: this is probably not the real space taken for complex emojis x += font.glyphs_horizontal_kerning(last_code_point, code_point); - draw_glyph_or_emoji({ static_cast(lroundf(x)), y }, code_point_iterator, font, color); + draw_glyph_or_emoji({ round_to(x), y }, code_point_iterator, font, color); x += font.glyph_or_emoji_width(code_point) + font.glyph_spacing(); last_code_point = code_point; }