mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +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
|
@ -51,7 +51,7 @@ void RadioButton::paint_event(PaintEvent& event)
|
|||
|
||||
Gfx::StylePainter::paint_radio_button(painter, circle_rect, palette(), is_checked(), is_being_pressed());
|
||||
|
||||
Gfx::IntRect text_rect { circle_rect.right() + 5 + horizontal_padding(), 0, static_cast<int>(ceilf(font().width(text()))), font().pixel_size_rounded_up() };
|
||||
Gfx::IntRect text_rect { circle_rect.right() + 5 + horizontal_padding(), 0, font().width_rounded_up(text()), font().pixel_size_rounded_up() };
|
||||
text_rect.center_vertically_within(rect());
|
||||
paint_text(painter, text_rect, font(), Gfx::TextAlignment::TopLeft);
|
||||
|
||||
|
@ -69,7 +69,7 @@ void RadioButton::click(unsigned)
|
|||
Optional<UISize> RadioButton::calculated_min_size() const
|
||||
{
|
||||
auto const& font = this->font();
|
||||
int width = horizontal_padding() * 2 + circle_size().width() + static_cast<int>(ceilf(font.width(text())));
|
||||
int width = horizontal_padding() * 2 + circle_size().width() + font.width_rounded_up(text());
|
||||
int height = max(22, max(font.pixel_size_rounded_up() + 8, circle_size().height()));
|
||||
return UISize(width, height);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue