1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-31 18:27:34 +00:00

LibGfx: Make Font::width() return a float

This commit is contained in:
Andreas Kling 2023-01-03 14:43:07 +01:00
parent b9d2b8f7b2
commit 3407ab0fd1
25 changed files with 40 additions and 40 deletions

View file

@ -106,7 +106,7 @@ void TaskbarButton::paint_event(GUI::PaintEvent& event)
content_rect.set_width(content_rect.width() - icon.width() - 4);
}
Gfx::IntRect text_rect { 0, 0, font.width(text()), font.glyph_height() };
Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.glyph_height() };
if (text_rect.width() > content_rect.width())
text_rect.set_width(content_rect.width());
text_rect.align_within(content_rect, text_alignment());

View file

@ -243,7 +243,7 @@ void WindowGeometryOverlay::update_rect()
} else {
m_label = window->rect().to_deprecated_string();
}
m_label_rect = Gfx::IntRect { 0, 0, wm.font().width(m_label) + 16, wm.font().glyph_height() + 10 };
m_label_rect = Gfx::IntRect { 0, 0, static_cast<int>(ceilf(wm.font().width(m_label))) + 16, wm.font().glyph_height() + 10 };
auto rect = calculate_frame_rect(m_label_rect).centered_within(window->frame().rect());
auto desktop_rect = wm.desktop_rect(ScreenInput::the().cursor_location_screen());