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

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.
This commit is contained in:
Andreas Kling 2023-03-03 19:32:19 +01:00
parent 93c9344e35
commit b71c7a6e44
32 changed files with 63 additions and 65 deletions

View file

@ -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;

View file

@ -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) });

View file

@ -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());
}
}