1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

LibGUI: Round up font sizes in various widget size calculations

This commit is contained in:
Andreas Kling 2023-02-28 18:17:43 +01:00
parent c44bc58aaa
commit f1e0eb8a25
5 changed files with 10 additions and 10 deletions

View file

@ -42,9 +42,9 @@ void CheckBox::paint_event(PaintEvent& event)
auto text_rect = rect();
if (m_checkbox_position == CheckBoxPosition::Left)
text_rect.set_left(s_box_width + s_horizontal_padding);
text_rect.set_width(font().width(text()));
text_rect.set_top(height() / 2 - font().glyph_height() / 2);
text_rect.set_height(font().glyph_height());
text_rect.set_width(static_cast<int>(ceilf(font().width(text()))));
text_rect.set_top(height() / 2 - static_cast<int>(ceilf(font().glyph_height()) / 2));
text_rect.set_height(static_cast<int>(ceilf(font().glyph_height())));
if (fill_with_background_color())
painter.fill_rect(rect(), palette().window());
@ -85,7 +85,7 @@ void CheckBox::set_autosize(bool autosize)
void CheckBox::size_to_fit()
{
set_fixed_width(s_box_width + font().width(text()) + s_horizontal_padding * 2);
set_fixed_width(s_box_width + static_cast<int>(ceilf(font().width(text()))) + s_horizontal_padding * 2);
}
}