diff options
author | Andreas Kling <kling@serenityos.org> | 2023-01-03 14:43:07 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-01-03 15:25:02 +0100 |
commit | 3407ab0fd1c287391cad8cb89e4a36fa3a07c453 (patch) | |
tree | 77c03fa1636b89088423831aadc4fe0005e898a3 /Userland/Services | |
parent | b9d2b8f7b2ef05d62949b8f1c17016428f7c661c (diff) | |
download | serenity-3407ab0fd1c287391cad8cb89e4a36fa3a07c453.zip |
LibGfx: Make Font::width() return a float
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/Taskbar/TaskbarButton.cpp | 2 | ||||
-rw-r--r-- | Userland/Services/WindowServer/Overlays.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Services/Taskbar/TaskbarButton.cpp b/Userland/Services/Taskbar/TaskbarButton.cpp index 7693da51d8..5b8d748438 100644 --- a/Userland/Services/Taskbar/TaskbarButton.cpp +++ b/Userland/Services/Taskbar/TaskbarButton.cpp @@ -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()); diff --git a/Userland/Services/WindowServer/Overlays.cpp b/Userland/Services/WindowServer/Overlays.cpp index 1a7066c746..0fa782341a 100644 --- a/Userland/Services/WindowServer/Overlays.cpp +++ b/Userland/Services/WindowServer/Overlays.cpp @@ -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()); |