浏览代码

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.
Andreas Kling 2 年之前
父节点
当前提交
b71c7a6e44
共有 32 个文件被更改,包括 63 次插入65 次删除
  1. 1 1
      Userland/Applications/Browser/ElementSizePreviewWidget.cpp
  2. 1 1
      Userland/Applications/DisplaySettings/MonitorWidget.cpp
  3. 1 1
      Userland/Applications/HexEditor/HexEditor.h
  4. 1 1
      Userland/Applications/KeyboardMapper/KeyButton.cpp
  5. 1 1
      Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp
  6. 1 1
      Userland/Applications/SystemMonitor/GraphWidget.cpp
  7. 1 1
      Userland/DevTools/HackStudio/Git/DiffViewer.cpp
  8. 1 1
      Userland/Games/2048/BoardView.cpp
  9. 2 3
      Userland/Games/BrickGame/BrickGame.cpp
  10. 2 3
      Userland/Games/ColorLines/ColorLines.cpp
  11. 5 5
      Userland/Games/Hearts/ScoreCard.cpp
  12. 1 1
      Userland/Games/MasterWord/WordGame.cpp
  13. 1 1
      Userland/Libraries/LibCards/CardPainter.cpp
  14. 2 2
      Userland/Libraries/LibGUI/AbstractTableView.h
  15. 2 2
      Userland/Libraries/LibGUI/Application.cpp
  16. 1 1
      Userland/Libraries/LibGUI/Button.cpp
  17. 1 1
      Userland/Libraries/LibGUI/Calendar.cpp
  18. 11 11
      Userland/Libraries/LibGUI/GlyphMapWidget.cpp
  19. 4 4
      Userland/Libraries/LibGUI/GroupBox.cpp
  20. 7 7
      Userland/Libraries/LibGUI/IconView.cpp
  21. 1 1
      Userland/Libraries/LibGUI/MessageBox.cpp
  22. 1 1
      Userland/Libraries/LibGUI/RadioButton.cpp
  23. 1 1
      Userland/Libraries/LibGUI/TabWidget.cpp
  24. 1 1
      Userland/Libraries/LibGUI/TextEditor.cpp
  25. 2 2
      Userland/Libraries/LibGUI/Wizards/WizardPage.cpp
  26. 1 1
      Userland/Libraries/LibGfx/ClassicWindowTheme.cpp
  27. 1 1
      Userland/Libraries/LibWeb/CSS/Length.cpp
  28. 2 2
      Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
  29. 1 1
      Userland/Libraries/LibWeb/Layout/ButtonBox.cpp
  30. 1 1
      Userland/Services/NotificationServer/NotificationWindow.cpp
  31. 1 1
      Userland/Services/Taskbar/TaskbarButton.cpp
  32. 3 3
      Userland/Services/WindowServer/Overlays.cpp

+ 1 - 1
Userland/Applications/Browser/ElementSizePreviewWidget.cpp

@@ -24,7 +24,7 @@ void ElementSizePreviewWidget::paint_event(GUI::PaintEvent& event)
     auto content_size_text = DeprecatedString::formatted("{}x{}", m_node_content_width, m_node_content_height);
 
     int inner_content_width = max(100, font().width(content_size_text) + 2 * content_width_padding);
-    int inner_content_height = max(15, font().glyph_height() + 2 * content_height_padding);
+    int inner_content_height = max(15, font().pixel_size_rounded_up() + 2 * content_height_padding);
 
     auto format_size_text = [&](Web::CSSPixels size) {
         return DeprecatedString::formatted("{:.4f}", size);

+ 1 - 1
Userland/Applications/DisplaySettings/MonitorWidget.cpp

@@ -155,7 +155,7 @@ void MonitorWidget::paint_event(GUI::PaintEvent& event)
         // Render text label scaled with scale factor to hint at its effect.
         // FIXME: Once bitmaps have intrinsic scale factors, we could create a bitmap with an intrinsic scale factor of m_desktop_scale_factor
         // and that should give us the same effect with less code.
-        auto text_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize { painter.font().width(displayed_resolution_string) + 1, painter.font().glyph_height() + 1 });
+        auto text_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize { painter.font().width(displayed_resolution_string) + 1, painter.font().pixel_size_rounded_up() + 1 });
         GUI::Painter text_painter(*text_bitmap);
         text_painter.set_font(painter.font());
 

+ 1 - 1
Userland/Applications/HexEditor/HexEditor.h

@@ -97,7 +97,7 @@ private:
     void scroll_position_into_view(size_t position);
 
     size_t total_rows() const { return ceil_div(m_content_length, m_bytes_per_row); }
-    size_t line_height() const { return font().glyph_height() + m_line_spacing; }
+    size_t line_height() const { return font().pixel_size_rounded_up() + m_line_spacing; }
     size_t character_width() const { return font().glyph_width('W'); }
     size_t cell_width() const { return character_width() * 3; }
     size_t offset_margin_width() const { return 80; }

+ 1 - 1
Userland/Applications/KeyboardMapper/KeyButton.cpp

@@ -41,7 +41,7 @@ void KeyButton::paint_event(GUI::PaintEvent& event)
     if (text().is_empty() || text().bytes_as_string_view().starts_with('\0'))
         return;
 
-    Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.glyph_height() };
+    Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.pixel_size_rounded_up() };
     text_rect.align_within(key_cap_face_rect, Gfx::TextAlignment::Center);
 
     painter.draw_text(text_rect, text(), font, Gfx::TextAlignment::Center, Color::Black, Gfx::TextElision::Right);

+ 1 - 1
Userland/Applications/MouseSettings/DoubleClickArrowWidget.cpp

@@ -47,7 +47,7 @@ void DoubleClickArrowWidget::paint_event(GUI::PaintEvent& event)
 
     auto text_rect = rect();
     text_rect.set_y(bottom_arrow_rect.bottom());
-    text_rect.set_height(font().glyph_height());
+    text_rect.set_height(font().pixel_size_rounded_up());
 }
 
 void DoubleClickArrowWidget::mousedown_event(GUI::MouseEvent&)

+ 1 - 1
Userland/Applications/SystemMonitor/GraphWidget.cpp

@@ -150,7 +150,7 @@ void GraphWidget::paint_event(GUI::PaintEvent& event)
                 continue;
             auto constrain_rect = inner_rect.shrunken(8, 8);
             auto text_rect = constrain_rect.translated(0, y).intersected(constrain_rect);
-            text_rect.set_height(font().glyph_height());
+            text_rect.set_height(font().pixel_size_rounded_up());
             auto text = format.text_formatter(current_values[i]);
             if (format.text_shadow_color != Color::Transparent)
                 painter.draw_text(text_rect.translated(1, 1), text, Gfx::TextAlignment::CenterRight, format.text_shadow_color);

+ 1 - 1
Userland/DevTools/HackStudio/Git/DiffViewer.cpp

@@ -120,7 +120,7 @@ void DiffViewer::draw_line(GUI::Painter& painter, DeprecatedString const& line,
 
 size_t DiffViewer::line_height() const
 {
-    return font().glyph_height() + 4;
+    return font().pixel_size_rounded_up() + 4;
 }
 
 Gfx::IntRect DiffViewer::separator_rect() const

+ 1 - 1
Userland/Games/2048/BoardView.cpp

@@ -51,7 +51,7 @@ void BoardView::pick_font()
     font_database.for_each_font([&](Gfx::Font const& font) {
         if (font.family() != "Liza" || font.weight() != 700)
             return;
-        auto size = font.glyph_height();
+        auto size = font.pixel_size_rounded_up();
         if (size * 2 <= m_cell_size && size > best_font_size) {
             best_font_name = font.qualified_name();
             best_font_size = size;

+ 2 - 3
Userland/Games/BrickGame/BrickGame.cpp

@@ -502,10 +502,9 @@ void BrickGame::paint_text(GUI::Painter& painter, int row, DeprecatedString cons
     auto const text_width = static_cast<int>(ceilf(font().width(text)));
     auto const entire_area_rect { frame_inner_rect() };
     auto const margin = 4;
-    auto const glyph_height = font().glyph_height();
     auto const rect { Gfx::IntRect { entire_area_rect.x() + entire_area_rect.width() - 116,
-        2 * margin + entire_area_rect.y() + (glyph_height + margin) * row,
-        text_width, glyph_height } };
+        2 * margin + entire_area_rect.y() + (font().pixel_size_rounded_up() + margin) * row,
+        text_width, font().pixel_size_rounded_up() } };
     painter.draw_text(rect, text, Gfx::TextAlignment::TopLeft, Color::Black);
 }
 

+ 2 - 3
Userland/Games/ColorLines/ColorLines.cpp

@@ -212,10 +212,9 @@ void ColorLines::paint_event(GUI::PaintEvent& event)
     // Draw score
     auto const score_text = MUST(String::formatted("{:05}"sv, m_score));
     auto text_width = static_cast<int>(ceilf(m_score_font->width(score_text)));
-    auto const glyph_height = m_score_font->glyph_height();
     auto const score_text_rect = Gfx::IntRect {
         frame_inner_rect().top_left().translated(text_margin),
-        Gfx::IntSize { text_width, glyph_height }
+        Gfx::IntSize { text_width, font().pixel_size_rounded_up() }
     };
     painter.draw_text(score_text_rect, score_text, Gfx::TextAlignment::CenterLeft, text_color);
 
@@ -224,7 +223,7 @@ void ColorLines::paint_event(GUI::PaintEvent& event)
     text_width = m_score_font->width(high_score_text);
     auto const high_score_text_rect = Gfx::IntRect {
         frame_inner_rect().top_right().translated(-(text_margin + text_width), text_margin),
-        Gfx::IntSize { text_width, glyph_height }
+        Gfx::IntSize { text_width, font().pixel_size_rounded_up() }
     };
     painter.draw_text(high_score_text_rect, high_score_text, Gfx::TextAlignment::CenterLeft, text_color);
 

+ 5 - 5
Userland/Games/Hearts/ScoreCard.cpp

@@ -26,7 +26,7 @@ Gfx::IntSize ScoreCard::recommended_size()
 
     return Gfx::IntSize {
         4 * column_width + 3 * cell_padding,
-        16 * card_font.glyph_height() + 15 * cell_padding
+        16 * card_font.pixel_size_rounded_up() + 15 * cell_padding
     };
 }
 void ScoreCard::paint_event(GUI::PaintEvent& event)
@@ -42,9 +42,9 @@ void ScoreCard::paint_event(GUI::PaintEvent& event)
     auto cell_rect = [this, &font](int x, int y) {
         return Gfx::IntRect {
             frame_inner_rect().left() + x * column_width + x * cell_padding,
-            frame_inner_rect().top() + y * font.glyph_height() + y * cell_padding,
+            frame_inner_rect().top() + y * font.pixel_size_rounded_up() + y * cell_padding,
             column_width,
-            font.glyph_height(),
+            font.pixel_size_rounded_up(),
         };
     };
 
@@ -74,8 +74,8 @@ void ScoreCard::paint_event(GUI::PaintEvent& event)
             auto score_text_width = static_cast<int>(ceilf(font.width(score_text)));
             if (score_index != (int)player.scores.size() - 1) {
                 painter.draw_line(
-                    { text_rect.left() + text_rect.width() / 2 - score_text_width / 2 - 3, text_rect.top() + font.glyph_height() / 2 },
-                    { text_rect.right() - text_rect.width() / 2 + score_text_width / 2 + 3, text_rect.top() + font.glyph_height() / 2 },
+                    { text_rect.left() + text_rect.width() / 2 - score_text_width / 2 - 3, text_rect.top() + font.pixel_size_rounded_up() / 2 },
+                    { text_rect.right() - text_rect.width() / 2 + score_text_width / 2 + 3, text_rect.top() + font.pixel_size_rounded_up() / 2 },
                     text_color);
             }
             painter.draw_text(text_rect,

+ 1 - 1
Userland/Games/MasterWord/WordGame.cpp

@@ -60,7 +60,7 @@ void WordGame::pick_font()
     font_database.for_each_font([&](Gfx::Font const& font) {
         if (font.family() != "Liza" || font.weight() != 700)
             return;
-        auto size = font.glyph_height();
+        auto size = font.pixel_size_rounded_up();
         if (size * 2 <= m_letter_height && size > best_font_size) {
             best_font_name = font.qualified_name();
             best_font_size = size;

+ 1 - 1
Userland/Libraries/LibCards/CardPainter.cpp

@@ -201,7 +201,7 @@ void CardPainter::paint_card_front(Gfx::Bitmap& bitmap, Cards::Suit suit, Cards:
     paint_rect.set_height(paint_rect.height() / 2);
     paint_rect.shrink(10, 6);
 
-    auto text_rect = Gfx::IntRect { 4, 6, static_cast<int>(ceilf(font.width("10"sv))), font.glyph_height() };
+    auto text_rect = Gfx::IntRect { 4, 6, static_cast<int>(ceilf(font.width("10"sv))), font.pixel_size_rounded_up() };
     painter.draw_text(text_rect, card_rank_label(rank), font, Gfx::TextAlignment::Center, suit_color);
 
     painter.draw_bitmap(

+ 2 - 2
Userland/Libraries/LibGUI/AbstractTableView.h

@@ -24,7 +24,7 @@ public:
 
 class AbstractTableView : public AbstractView {
 public:
-    int row_height() const { return font().glyph_height() + vertical_padding(); }
+    int row_height() const { return font().pixel_size_rounded_up() + vertical_padding(); }
 
     virtual int horizontal_padding() const { return m_horizontal_padding; }
     void set_horizontal_padding(int padding) { m_horizontal_padding = padding; }
@@ -122,7 +122,7 @@ private:
     bool m_highlight_selected_rows { true };
 
     int m_vertical_padding { 8 };
-    int m_horizontal_padding { font().glyph_height() / 2 };
+    int m_horizontal_padding { font().pixel_size_rounded_up() / 2 };
     int m_tab_moves { 0 };
 };
 

+ 2 - 2
Userland/Libraries/LibGUI/Application.cpp

@@ -30,8 +30,8 @@ public:
         m_label->set_text(Gfx::parse_ampersand_string(tooltip));
         int tooltip_width = m_label->effective_min_size().width().as_int() + 10;
         int line_count = m_label->text().count("\n"sv);
-        int glyph_height = m_label->font().glyph_height();
-        int tooltip_height = glyph_height * (1 + line_count) + ((glyph_height + 1) / 2) * line_count + 8;
+        int font_size = m_label->font().pixel_size_rounded_up();
+        int tooltip_height = font_size * (1 + line_count) + ((font_size + 1) / 2) * line_count + 8;
 
         Gfx::IntRect desktop_rect = Desktop::the().rect();
         if (tooltip_width > desktop_rect.width())

+ 1 - 1
Userland/Libraries/LibGUI/Button.cpp

@@ -105,7 +105,7 @@ void Button::paint_event(PaintEvent& event)
         content_rect.set_width(content_rect.width() - m_icon->width() - icon_spacing());
     }
 
-    Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.glyph_height() };
+    Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.pixel_size_rounded_up() };
     if (text_rect.width() > content_rect.width())
         text_rect.set_width(content_rect.width());
     text_rect.align_within(content_rect, text_alignment());

+ 1 - 1
Userland/Libraries/LibGUI/Calendar.cpp

@@ -484,7 +484,7 @@ void Calendar::paint_event(GUI::PaintEvent& event)
                     x_offset,
                     y_offset + 4,
                     m_tiles[0][i].width - 4,
-                    font().glyph_height() + 4);
+                    font().pixel_size_rounded_up() + 4);
 
                 if (width > 150 && height > 150) {
                     set_font(extra_large_font);

+ 11 - 11
Userland/Libraries/LibGUI/GlyphMapWidget.cpp

@@ -102,9 +102,9 @@ Gfx::IntRect GlyphMapWidget::get_outer_rect(int glyph) const
     int column = glyph % columns();
     return Gfx::IntRect {
         column * (font().max_glyph_width() + m_horizontal_spacing),
-        row * (font().glyph_height() + m_vertical_spacing),
+        row * (font().pixel_size_rounded_up() + m_vertical_spacing),
         font().max_glyph_width() + m_horizontal_spacing,
-        font().glyph_height() + m_vertical_spacing
+        font().pixel_size_rounded_up() + m_vertical_spacing
     }
         .translated(frame_thickness() - horizontal_scrollbar().value(), frame_thickness() - vertical_scrollbar().value());
 }
@@ -136,7 +136,7 @@ void GlyphMapWidget::paint_event(PaintEvent& event)
             outer_rect.x() + m_horizontal_spacing / 2,
             outer_rect.y() + m_vertical_spacing / 2,
             font().max_glyph_width(),
-            font().glyph_height());
+            font().pixel_size_rounded_up());
         if (m_selection.contains(glyph)) {
             painter.fill_rect(outer_rect, is_focused() ? palette().selection() : palette().inactive_selection());
             if (font().contains_glyph(glyph))
@@ -184,7 +184,7 @@ Optional<int> GlyphMapWidget::glyph_at_position(Gfx::IntPoint position) const
     Gfx::IntPoint map_offset { frame_thickness() - horizontal_scrollbar().value(), frame_thickness() - vertical_scrollbar().value() };
     auto map_position = position - map_offset;
     auto col = (map_position.x() - 1) / ((font().max_glyph_width() + m_horizontal_spacing));
-    auto row = (map_position.y() - 1) / ((font().glyph_height() + m_vertical_spacing));
+    auto row = (map_position.y() - 1) / ((font().pixel_size_rounded_up() + m_vertical_spacing));
     auto glyph = row * columns() + col + m_active_range.first;
     if (row >= 0 && row < rows() && col >= 0 && col < columns() && glyph < m_glyph_count + m_active_range.first)
         return glyph;
@@ -197,7 +197,7 @@ int GlyphMapWidget::glyph_at_position_clamped(Gfx::IntPoint position) const
     Gfx::IntPoint map_offset { frame_thickness() - horizontal_scrollbar().value(), frame_thickness() - vertical_scrollbar().value() };
     auto map_position = position - map_offset;
     auto col = clamp((map_position.x() - 1) / ((font().max_glyph_width() + m_horizontal_spacing)), 0, columns() - 1);
-    auto row = clamp((map_position.y() - 1) / ((font().glyph_height() + m_vertical_spacing)), 0, rows() - 1);
+    auto row = clamp((map_position.y() - 1) / ((font().pixel_size_rounded_up() + m_vertical_spacing)), 0, rows() - 1);
     auto glyph = row * columns() + col + m_active_range.first;
     if (row == rows() - 1)
         glyph = min(glyph, m_glyph_count + m_active_range.first - 1);
@@ -448,7 +448,7 @@ void GlyphMapWidget::keydown_event(KeyEvent& event)
 void GlyphMapWidget::did_change_font()
 {
     recalculate_content_size();
-    vertical_scrollbar().set_step(font().glyph_height() + m_vertical_spacing);
+    vertical_scrollbar().set_step(font().pixel_size_rounded_up() + m_vertical_spacing);
 }
 
 void GlyphMapWidget::scroll_to_glyph(int glyph)
@@ -458,9 +458,9 @@ void GlyphMapWidget::scroll_to_glyph(int glyph)
     int column = glyph % columns();
     auto scroll_rect = Gfx::IntRect {
         column * (font().max_glyph_width() + m_horizontal_spacing),
-        row * (font().glyph_height() + m_vertical_spacing),
+        row * (font().pixel_size_rounded_up() + m_vertical_spacing),
         font().max_glyph_width() + m_horizontal_spacing,
-        font().glyph_height() + m_vertical_spacing
+        font().pixel_size_rounded_up() + m_vertical_spacing
     };
     scroll_into_view(scroll_rect, true, true);
 }
@@ -515,12 +515,12 @@ void GlyphMapWidget::recalculate_content_size()
     m_rows = ceil_div(m_glyph_count, m_columns);
 
     constexpr auto overdraw_margins = 2;
-    auto max_visible_rows = event_height / (font().glyph_height() + m_vertical_spacing);
+    auto max_visible_rows = event_height / (font().pixel_size_rounded_up() + m_vertical_spacing);
     m_visible_rows = min(max_visible_rows, m_rows);
     m_visible_glyphs = (m_visible_rows + overdraw_margins) * m_columns;
 
     int content_width = columns() * (font().max_glyph_width() + m_horizontal_spacing);
-    int content_height = rows() * (font().glyph_height() + m_vertical_spacing);
+    int content_height = rows() * (font().pixel_size_rounded_up() + m_vertical_spacing);
     set_content_size({ content_width, content_height });
 
     scroll_to_glyph(m_active_glyph);
@@ -590,7 +590,7 @@ void GlyphMapWidget::leave_event(Core::Event&)
 Optional<UISize> GlyphMapWidget::calculated_min_size() const
 {
     auto scrollbar = vertical_scrollbar().effective_min_size().height().as_int();
-    auto min_height = max(font().glyph_height() + m_vertical_spacing, scrollbar);
+    auto min_height = max(font().pixel_size_rounded_up() + m_vertical_spacing, scrollbar);
     auto min_width = font().max_glyph_width() + m_horizontal_spacing + width_occupied_by_vertical_scrollbar();
     return { { min_width + frame_thickness() * 2, min_height + frame_thickness() * 2 } };
 }

+ 4 - 4
Userland/Libraries/LibGUI/GroupBox.cpp

@@ -24,7 +24,7 @@ GroupBox::GroupBox(StringView title)
 Margins GroupBox::content_margins() const
 {
     return {
-        (!m_title.is_empty() ? static_cast<int>(ceilf(font().glyph_height())) + 1 /*room for the focus rect*/ : 2),
+        (!m_title.is_empty() ? font().pixel_size_rounded_up() + 1 /*room for the focus rect*/ : 2),
         2,
         2,
         2
@@ -37,13 +37,13 @@ void GroupBox::paint_event(PaintEvent& event)
     painter.add_clip_rect(event.rect());
 
     Gfx::IntRect frame_rect {
-        0, (!m_title.is_empty() ? font().glyph_height() / 2 : 0),
-        width(), height() - (!m_title.is_empty() ? static_cast<int>(ceilf(font().glyph_height())) / 2 : 0)
+        0, (!m_title.is_empty() ? font().pixel_size_rounded_up() / 2 : 0),
+        width(), height() - (!m_title.is_empty() ? font().pixel_size_rounded_up() / 2 : 0)
     };
     Gfx::StylePainter::paint_frame(painter, frame_rect, palette(), Gfx::FrameShape::Box, Gfx::FrameShadow::Sunken, 2);
 
     if (!m_title.is_empty()) {
-        Gfx::IntRect text_rect { 6, 1, static_cast<int>(ceilf(font().width(m_title) + 6)), font().glyph_height() };
+        Gfx::IntRect text_rect { 6, 1, static_cast<int>(ceilf(font().width(m_title) + 6)), font().pixel_size_rounded_up() };
         painter.fill_rect(text_rect, palette().button());
         painter.draw_text(text_rect, m_title, Gfx::TextAlignment::CenterLeft, palette().button_text());
     }

+ 7 - 7
Userland/Libraries/LibGUI/IconView.cpp

@@ -379,7 +379,7 @@ Gfx::IntRect IconView::editing_rect(ModelIndex const& index) const
         return {};
     auto& item_data = get_item_data(index.row());
     auto editing_rect = item_data.text_rect;
-    editing_rect.set_height(font_for_index(index)->glyph_height() + 8);
+    editing_rect.set_height(font_for_index(index)->pixel_size_rounded_up() + 8);
     editing_rect.set_y(item_data.text_rect.y() - 2);
     return editing_rect;
 }
@@ -425,13 +425,13 @@ void IconView::get_item_rects(int item_index, ItemData& item_data, Gfx::Font con
 {
     auto item_rect = this->item_rect(item_index);
     item_data.icon_rect = Gfx::IntRect(0, 0, 32, 32).centered_within(item_rect);
-    item_data.icon_offset_y = -font.glyph_height() - 6;
+    item_data.icon_offset_y = -font.pixel_size_rounded_up() - 6;
     item_data.icon_rect.translate_by(0, item_data.icon_offset_y);
 
     int unwrapped_text_width = static_cast<int>(ceilf(font.width(item_data.text)));
     int available_width = item_rect.width() - 6;
 
-    item_data.text_rect = { 0, item_data.icon_rect.bottom() + 6 + 1, 0, font.glyph_height() };
+    item_data.text_rect = { 0, item_data.icon_rect.bottom() + 6 + 1, 0, font.pixel_size_rounded_up() };
     item_data.wrapped_text_lines.clear();
 
     if ((unwrapped_text_width > available_width) && (item_data.selected || m_hovered_index == item_data.index || cursor_index() == item_data.index || m_always_wrap_item_labels)) {
@@ -458,7 +458,7 @@ void IconView::get_item_rects(int item_index, ItemData& item_data, Gfx::Font con
         item_data.text_rect.set_width(widest_line_width);
         item_data.text_rect.center_horizontally_within(item_rect);
         item_data.text_rect.intersect(item_rect);
-        item_data.text_rect.set_height(font.glyph_height() * item_data.wrapped_text_lines.size());
+        item_data.text_rect.set_height(font.pixel_size_rounded_up() * item_data.wrapped_text_lines.size());
         item_data.text_rect.inflate(6, 6);
         item_data.text_rect_wrapped = item_data.text_rect;
     } else {
@@ -551,14 +551,14 @@ void IconView::paint_event(PaintEvent& event)
             // Item text would not fit in the item text rect, let's break it up into lines..
 
             const auto& lines = item_data.wrapped_text_lines;
-            size_t number_of_text_lines = min((size_t)text_rect.height() / font->glyph_height(), lines.size());
+            size_t number_of_text_lines = min((size_t)text_rect.height() / font->pixel_size_rounded_up(), lines.size());
             size_t previous_line_lengths = 0;
             for (size_t line_index = 0; line_index < number_of_text_lines; ++line_index) {
                 Gfx::IntRect line_rect;
                 line_rect.set_width(text_rect.width());
-                line_rect.set_height(font->glyph_height());
+                line_rect.set_height(font->pixel_size_rounded_up());
                 line_rect.center_horizontally_within(item_data.text_rect);
-                line_rect.set_y(3 + item_data.text_rect.y() + line_index * font->glyph_height());
+                line_rect.set_y(3 + item_data.text_rect.y() + line_index * font->pixel_size_rounded_up());
                 line_rect.inflate(6, 0);
 
                 // Shrink the line_rect on the last line to apply elision if there are more lines.

+ 1 - 1
Userland/Libraries/LibGUI/MessageBox.cpp

@@ -117,7 +117,7 @@ void MessageBox::build()
 
     int text_width = widget->font().width(m_text);
     auto number_of_lines = m_text.split('\n').size();
-    int padded_text_height = widget->font().glyph_height() * 1.6;
+    int padded_text_height = widget->font().pixel_size_rounded_up() * 1.6;
     int total_text_height = number_of_lines * padded_text_height;
     int icon_width = 0;
 

+ 1 - 1
Userland/Libraries/LibGUI/RadioButton.cpp

@@ -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().glyph_height() };
+    Gfx::IntRect text_rect { circle_rect.right() + 5 + horizontal_padding(), 0, static_cast<int>(ceilf(font().width(text()))), font().pixel_size_rounded_up() };
     text_rect.center_vertically_within(rect());
     paint_text(painter, text_rect, font(), Gfx::TextAlignment::TopLeft);
 

+ 1 - 1
Userland/Libraries/LibGUI/TabWidget.cpp

@@ -321,7 +321,7 @@ void TabWidget::paint_event(PaintEvent& event)
         painter.draw_text(tab_button_content_rect, m_tabs[i].title, m_text_alignment, palette().button_text(), Gfx::TextElision::Right);
 
         if (is_focused()) {
-            Gfx::IntRect focus_rect { 0, 0, min(tab_button_content_rect.width(), font().width(m_tabs[i].title)), font().glyph_height() };
+            Gfx::IntRect focus_rect { 0, 0, min(tab_button_content_rect.width(), font().width(m_tabs[i].title)), font().pixel_size_rounded_up() };
             focus_rect.align_within(tab_button_content_rect, m_text_alignment);
             focus_rect.inflate(6, 4);
 

+ 1 - 1
Userland/Libraries/LibGUI/TextEditor.cpp

@@ -1437,7 +1437,7 @@ Gfx::IntRect TextEditor::line_content_rect(size_t line_index) const
 {
     auto& line = this->line(line_index);
     if (is_single_line()) {
-        Gfx::IntRect line_rect = { content_x_for_position({ line_index, 0 }), 0, text_width_for_font(line.view(), font()), font().glyph_height() + 4 };
+        Gfx::IntRect line_rect = { content_x_for_position({ line_index, 0 }), 0, text_width_for_font(line.view(), font()), font().pixel_size_rounded_up() + 4 };
         line_rect.center_vertically_within({ {}, frame_inner_rect().size() });
         return line_rect;
     }

+ 2 - 2
Userland/Libraries/LibGUI/Wizards/WizardPage.cpp

@@ -27,11 +27,11 @@ WizardPage::WizardPage(DeprecatedString const& title_text, DeprecatedString cons
     header_widget.set_layout<VerticalBoxLayout>(GUI::Margins { 15, 30, 0 });
     m_title_label = header_widget.add<Label>(title_text);
     m_title_label->set_font(Gfx::FontDatabase::default_font().bold_variant());
-    m_title_label->set_fixed_height(m_title_label->font().glyph_height() + 2);
+    m_title_label->set_fixed_height(m_title_label->font().pixel_size_rounded_up() + 2);
     m_title_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
     m_subtitle_label = header_widget.add<Label>(subtitle_text);
     m_subtitle_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
-    m_subtitle_label->set_fixed_height(m_subtitle_label->font().glyph_height());
+    m_subtitle_label->set_fixed_height(m_subtitle_label->font().pixel_size_rounded_up());
     header_widget.add_spacer().release_value_but_fixme_should_propagate_errors();
 
     auto& separator = add<SeparatorWidget>(Gfx::Orientation::Horizontal);

+ 1 - 1
Userland/Libraries/LibGfx/ClassicWindowTheme.cpp

@@ -131,7 +131,7 @@ IntRect ClassicWindowTheme::titlebar_rect(WindowType window_type, WindowMode win
     auto& title_font = FontDatabase::window_title_font();
     auto window_titlebar_height = titlebar_height(window_type, window_mode, palette);
     // FIXME: The top of the titlebar doesn't get redrawn properly if this padding is different
-    int total_vertical_padding = title_font.glyph_height() - 1;
+    int total_vertical_padding = title_font.pixel_size_rounded_up() - 1;
 
     if (window_type == WindowType::Notification)
         return { window_rect.width() + 3, total_vertical_padding / 2 - 1, window_titlebar_height, window_rect.height() };

+ 1 - 1
Userland/Libraries/LibWeb/CSS/Length.cpp

@@ -78,7 +78,7 @@ CSSPixels Length::relative_length_to_px(CSSPixelRect const& viewport_rect, Gfx::
     case Type::Em:
         return m_value * font_size;
     case Type::Ch:
-        // FIXME: Use layout_node.font().glyph_height() when writing-mode is not horizontal-tb (it has to be implemented first)
+        // FIXME: Use layout_node.font().pixel_size() when writing-mode is not horizontal-tb (it has to be implemented first)
         return m_value * (font_metrics.advance_of_ascii_zero + font_metrics.glyph_spacing);
     case Type::Rem:
         return m_value * root_font_size;

+ 2 - 2
Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp

@@ -866,7 +866,7 @@ void BlockFormattingContext::layout_list_item_marker(ListItemBox const& list_ite
         image_height = list_style_image->natural_height().value_or(0);
     }
 
-    CSSPixels default_marker_width = max(4, marker.font().glyph_height() - 4);
+    CSSPixels default_marker_width = max(4, marker.font().pixel_size_rounded_up() - 4);
 
     if (marker.text().is_empty()) {
         marker_state.set_content_width((image_width + default_marker_width).value());
@@ -875,7 +875,7 @@ void BlockFormattingContext::layout_list_item_marker(ListItemBox const& list_ite
         marker_state.set_content_width((image_width + text_width).value());
     }
 
-    marker_state.set_content_height(max(image_height, marker.font().glyph_height() + 1).value());
+    marker_state.set_content_height(max(image_height, marker.font().pixel_size_rounded_up() + 1).value());
 
     marker_state.set_content_offset({ -(marker_state.content_width() + default_marker_width),
         max(CSSPixels(0.f), (CSSPixels(marker.line_height()) - marker_state.content_height()) / 2.f) });

+ 1 - 1
Userland/Libraries/LibWeb/Layout/ButtonBox.cpp

@@ -26,7 +26,7 @@ void ButtonBox::prepare_for_replaced_layout()
     // its contents normally.
     if (is<HTML::HTMLInputElement>(dom_node())) {
         set_intrinsic_width(font().width(static_cast<HTML::HTMLInputElement&>(dom_node()).value()));
-        set_intrinsic_height(font().glyph_height());
+        set_intrinsic_height(font().pixel_size_rounded_up());
     }
 }
 

+ 1 - 1
Userland/Services/NotificationServer/NotificationWindow.cpp

@@ -106,7 +106,7 @@ RefPtr<NotificationWindow> NotificationWindow::get_window_by_id(i32 id)
 
 void NotificationWindow::resize_to_fit_text()
 {
-    auto line_height = m_text_label->font().glyph_height();
+    auto line_height = m_text_label->font().pixel_size_rounded_up();
     auto total_height = m_text_label->text_calculated_preferred_height();
 
     m_text_label->set_fixed_height(total_height);

+ 1 - 1
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, static_cast<int>(ceilf(font.width(text()))), font.glyph_height() };
+    Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.pixel_size_rounded_up() };
     if (text_rect.width() > content_rect.width())
         text_rect.set_width(content_rect.width());
     text_rect.align_within(content_rect, text_alignment());

+ 3 - 3
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));
 }