1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09: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
Notes: sideshowbarker 2024-07-17 11:33:34 +09:00
21 changed files with 34 additions and 19 deletions

View file

@ -43,7 +43,7 @@ void GroupBox::paint_event(PaintEvent& event)
Gfx::StylePainter::paint_frame(painter, frame_rect, palette(), Gfx::FrameShape::Box, Gfx::FrameShadow::Sunken, 2);
if (!m_title.is_empty()) {
Gfx::IntRect text_rect { 6, 1, static_cast<int>(ceilf(font().width(m_title) + 6)), font().pixel_size_rounded_up() };
Gfx::IntRect text_rect { 6, 1, font().width_rounded_up(m_title) + 6, font().pixel_size_rounded_up() };
painter.fill_rect(text_rect, palette().button());
painter.draw_text(text_rect, m_title, Gfx::TextAlignment::CenterLeft, palette().button_text());
}