mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +00:00
Userland: Use Font::pixel_size_rounded_up() in more places
This commit is contained in:
parent
2e2c717e89
commit
508fb7e1e9
7 changed files with 10 additions and 10 deletions
|
@ -280,7 +280,7 @@ Optional<UISize> Button::calculated_min_size() const
|
|||
if (!text().is_empty()) {
|
||||
auto& font = this->font();
|
||||
horizontal = static_cast<int>(ceilf(font.width(text()))) + 2;
|
||||
vertical = static_cast<int>(ceilf(font.pixel_size())) + 4; // FIXME: Use actual maximum total height
|
||||
vertical = font.pixel_size_rounded_up() + 4; // FIXME: Use actual maximum total height
|
||||
}
|
||||
|
||||
if (m_icon) {
|
||||
|
|
|
@ -66,8 +66,8 @@ void CheckBox::paint_event(PaintEvent& event)
|
|||
if (m_checkbox_position == CheckBoxPosition::Left)
|
||||
text_rect.set_left(box_rect.right() + 1 + gap_between_box_and_rect());
|
||||
text_rect.set_width(static_cast<int>(ceilf(font().width(text()))));
|
||||
text_rect.set_top(height() / 2 - static_cast<int>(ceilf(font().pixel_size()) / 2));
|
||||
text_rect.set_height(static_cast<int>(ceilf(font().pixel_size())));
|
||||
text_rect.set_top(height() / 2 - font().pixel_size_rounded_up() / 2);
|
||||
text_rect.set_height(font().pixel_size_rounded_up());
|
||||
|
||||
if (fill_with_background_color())
|
||||
painter.fill_rect(rect(), palette().window());
|
||||
|
|
|
@ -70,7 +70,7 @@ 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 height = max(22, max(static_cast<int>(ceilf(font.pixel_size())) + 8, circle_size().height()));
|
||||
int height = max(22, max(font.pixel_size_rounded_up() + 8, circle_size().height()));
|
||||
return UISize(width, height);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ Tray::Tray()
|
|||
|
||||
Gfx::IntRect Tray::Item::rect(Tray const& tray) const
|
||||
{
|
||||
int item_height = static_cast<int>(ceilf(tray.font().pixel_size())) + 12;
|
||||
int item_height = tray.font().pixel_size_rounded_up() + 12;
|
||||
return Gfx::IntRect {
|
||||
tray.frame_thickness(),
|
||||
tray.frame_thickness() + static_cast<int>(index) * item_height,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue