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

LibGfx+Userland: Add width_rounded_up() helper

This commit is contained in:
thankyouverycool 2023-04-14 08:52:47 -04:00 committed by Andreas Kling
parent c9404c3a63
commit 55423b4ed0
21 changed files with 34 additions and 19 deletions

View file

@ -585,7 +585,7 @@ void BrickGame::paint_cell(GUI::Painter& painter, Gfx::IntRect rect, BrickGame::
void BrickGame::paint_sidebar_text(GUI::Painter& painter, int row, StringView text)
{
auto const text_width = static_cast<int>(ceilf(font().width(text)));
auto const text_width = font().width_rounded_up(text);
auto const entire_area_rect { frame_inner_rect() };
auto const margin = 4;
auto const rect { Gfx::IntRect { entire_area_rect.x() + entire_area_rect.width() - 116,
@ -597,7 +597,7 @@ void BrickGame::paint_sidebar_text(GUI::Painter& painter, int row, StringView te
void BrickGame::paint_paused_text(GUI::Painter& painter)
{
auto const paused_text = "Paused"sv;
auto const paused_text_width = static_cast<int>(ceilf(font().width(paused_text)));
auto const paused_text_width = font().width_rounded_up(paused_text);
auto const more_or_less_font_height = static_cast<int>(font().pixel_size_rounded_up());
auto const entire_area_rect { frame_inner_rect() };
auto const margin = more_or_less_font_height * 2;