1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +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

@ -201,7 +201,7 @@ void CardPainter::paint_card_front(Gfx::Bitmap& bitmap, Cards::Suit suit, Cards:
paint_rect.set_height(paint_rect.height() / 2);
paint_rect.shrink(10, 6);
auto text_rect = Gfx::IntRect { 4, 6, static_cast<int>(ceilf(font.width("10"sv))), font.pixel_size_rounded_up() };
auto text_rect = Gfx::IntRect { 4, 6, font.width_rounded_up("10"sv), font.pixel_size_rounded_up() };
painter.draw_text(text_rect, card_rank_label(rank), font, Gfx::TextAlignment::Center, suit_color);
painter.draw_bitmap(