diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 76ed693fd0..806cae33cc 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -240,7 +240,7 @@ void CanvasRenderingContext2D::fill_text(const String& text, float x, float y, O return; // FIXME: painter only supports integer rects for text right now, so this effectively chops off any fractional position - auto text_rect = Gfx::IntRect(x, y, max_width.has_value() ? max_width.value() : painter->font().width(text), painter->font().glyph_height()); + auto text_rect = Gfx::IntRect(x, y, max_width.has_value() ? max_width.value() : painter->font().width(text), painter->font().pixel_size()); auto transformed_rect = m_drawing_state.transform.map(text_rect); painter->draw_text(transformed_rect, text, Gfx::TextAlignment::TopLeft, m_drawing_state.fill_style); did_draw(transformed_rect.to_type()); @@ -586,7 +586,7 @@ CanvasRenderingContext2D::PreparedText CanvasRenderingContext2D::prepare_text(St // FIXME: Once we have CanvasTextDrawingStyles, add the CSS attributes. auto& font = Gfx::FontDatabase::default_font(); size_t width = 0; - size_t height = font.glyph_height(); + size_t height = font.pixel_size(); for (auto c : Utf8View { replaced_text }) { width += font.glyph_or_emoji_width(c); } diff --git a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp index 111f13d2a6..ebf27336a7 100644 --- a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp @@ -61,7 +61,7 @@ void ImageBox::prepare_for_replaced_layout() if (alt.is_empty()) alt = image_element.src(); set_intrinsic_width(font.width(alt) + 16); - set_intrinsic_height(font.glyph_height() + 16); + set_intrinsic_height(font.pixel_size() + 16); } if (!has_intrinsic_width() && !has_intrinsic_height()) { diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 5d13f85c57..1f533ed309 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -147,7 +147,7 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const size_text_rect.set_y(border_rect.y() + border_rect.height()); size_text_rect.set_top(size_text_rect.top()); size_text_rect.set_width((float)context.painter().font().width(size_text) + 4); - size_text_rect.set_height(context.painter().font().glyph_height() + 4); + size_text_rect.set_height(context.painter().font().pixel_size() + 4); context.painter().fill_rect(enclosing_int_rect(size_text_rect), context.palette().color(Gfx::ColorRole::Tooltip)); context.painter().draw_rect(enclosing_int_rect(size_text_rect), context.palette().threed_shadow1()); context.painter().draw_text(enclosing_int_rect(size_text_rect), size_text, Gfx::TextAlignment::Center, context.palette().color(Gfx::ColorRole::TooltipText)); @@ -285,7 +285,7 @@ static void paint_text_decoration(Gfx::Painter& painter, Layout::Node const& tex auto& font = fragment.layout_node().font(); auto fragment_box = enclosing_int_rect(fragment.absolute_rect()); - auto glyph_height = font.glyph_height(); + auto glyph_height = font.pixel_size(); auto baseline = fragment_box.height() / 2 - (glyph_height + 4) / 2 + glyph_height; switch (text_node.computed_values().text_decoration_line()) { @@ -377,7 +377,7 @@ static void paint_text_fragment(PaintContext& context, Layout::TextNode const& t // FIXME: This is a hack to prevent text clipping when painting a bitmap font into a too-small box. auto draw_rect = enclosing_int_rect(fragment_absolute_rect); - draw_rect.set_height(max(draw_rect.height(), text_node.font().glyph_height())); + draw_rect.set_height(max(draw_rect.height(), text_node.font().pixel_size())); painter.draw_text(draw_rect, text.substring_view(fragment.start(), fragment.length()), Gfx::TextAlignment::CenterLeft, text_node.computed_values().color()); auto selection_rect = fragment.selection_rect(text_node.font());