mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
LibGfx+Userland: Add width_rounded_up() helper
This commit is contained in:
parent
c9404c3a63
commit
55423b4ed0
21 changed files with 34 additions and 19 deletions
|
@ -41,7 +41,7 @@ void KeyButton::paint_event(GUI::PaintEvent& event)
|
|||
if (text().is_empty() || text().bytes_as_string_view().starts_with('\0'))
|
||||
return;
|
||||
|
||||
Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.pixel_size_rounded_up() };
|
||||
Gfx::IntRect text_rect { 0, 0, font.width_rounded_up(text()), font.pixel_size_rounded_up() };
|
||||
text_rect.align_within(key_cap_face_rect, Gfx::TextAlignment::Center);
|
||||
|
||||
painter.draw_text(text_rect, text(), font, Gfx::TextAlignment::Center, Color::Black, Gfx::TextElision::Right);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue