summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-03-03 19:32:19 +0100
committerAndreas Kling <kling@serenityos.org>2023-03-04 00:29:38 +0100
commitb71c7a6e44981c35ae93c91944e6cff70006285d (patch)
tree0b7fc5d68ed0559ecf6ce4db9a7f18f3334e3ee8 /Userland/Services/WindowServer
parent93c9344e3558fee71deb5067e68146582891b319 (diff)
downloadserenity-b71c7a6e44981c35ae93c91944e6cff70006285d.zip
Userland: Use Font::pixel_size_rounded_up() instead of glyph_height()
The only remaining clients of this API are specific to bitmap fonts and editing thereof.
Diffstat (limited to 'Userland/Services/WindowServer')
-rw-r--r--Userland/Services/WindowServer/Overlays.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Services/WindowServer/Overlays.cpp b/Userland/Services/WindowServer/Overlays.cpp
index ca805bb986..34106bd890 100644
--- a/Userland/Services/WindowServer/Overlays.cpp
+++ b/Userland/Services/WindowServer/Overlays.cpp
@@ -176,7 +176,7 @@ void ScreenNumberOverlay::pick_font()
font_database.for_each_font([&](Gfx::Font const& font) {
// TODO: instead of picking *any* font we should probably compare font.name()
// with default_font.name(). But the default font currently does not provide larger sizes
- auto size = font.glyph_height();
+ auto size = font.pixel_size_rounded_up();
if (size * 2 <= screen_number_content_rect_size.height() && size > best_font_size) {
for (unsigned ch = '0'; ch <= '9'; ch++) {
if (!font.contains_glyph(ch)) {
@@ -243,7 +243,7 @@ void WindowGeometryOverlay::update_rect()
} else {
m_label = window->rect().to_deprecated_string();
}
- m_label_rect = Gfx::IntRect { 0, 0, static_cast<int>(ceilf(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().pixel_size_rounded_up() + 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());
@@ -291,7 +291,7 @@ void DndOverlay::update_rect()
int bitmap_height = m_bitmap ? m_bitmap->height() : 0;
auto& font = this->font();
int width = font.width(m_text) + bitmap_width;
- int height = max((int)font.glyph_height(), bitmap_height);
+ int height = max(font.pixel_size_rounded_up(), bitmap_height);
auto location = ScreenInput::the().cursor_location().translated(8, 8);
set_rect(Gfx::IntRect(location, { width, height }).inflated(16, 8));
}