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

LibGfx: Use round_to<int> in Painter::draw_text_line

This commit is contained in:
Hendiadyoin1 2022-04-15 19:50:17 +02:00 committed by Linus Groh
parent d866637074
commit 9aa4958234

View file

@ -1387,7 +1387,7 @@ void draw_text_line(IntRect const& a_rect, Utf8View const& text, Font const& fon
continue;
}
int kerning = static_cast<int>(lroundf(font.glyphs_horizontal_kerning(last_code_point, code_point)));
int kerning = round_to<int>(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<int>(lroundf(x)), y }, code_point_iterator, font, color);
draw_glyph_or_emoji({ round_to<int>(x), y }, code_point_iterator, font, color);
x += font.glyph_or_emoji_width(code_point) + font.glyph_spacing();
last_code_point = code_point;
}