LibWeb/Layout: Use GlyphRun font to measure trimmed whitespace

This commit is contained in:
Sam Atkins 2024-12-05 17:57:30 +00:00 committed by Alexander Kalenik
parent e457252c97
commit 3782975718
Notes: github-actions[bot] 2024-12-06 01:58:33 +00:00

View file

@ -92,8 +92,8 @@ void LineBox::trim_trailing_whitespace()
if (!is_ascii_space(last_character))
break;
// FIXME: Use fragment's glyph run to determine the width of the last character.
int last_character_width = last_fragment->layout_node().first_available_font().glyph_width(last_character);
auto const& font = last_fragment->glyph_run() ? last_fragment->glyph_run()->font() : last_fragment->layout_node().first_available_font();
int last_character_width = font.glyph_width(last_character);
last_fragment->m_length -= 1;
last_fragment->set_inline_length(last_fragment->inline_length() - last_character_width);
m_inline_length -= last_character_width;