mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +00:00
LibHTML: Forgot to account for -1 glyph spacing in text layout
Font::width(string) will subtract one Font::glyph_spacing() from the result, since we don't put any spacing after the last glyph. This was messing up text layout here, since we assumed each glyph width also included the glyph spacing.
This commit is contained in:
parent
4a88caf8e7
commit
84ec286060
1 changed files with 1 additions and 2 deletions
|
@ -198,7 +198,6 @@ void LayoutText::split_into_lines(LayoutBlock& container)
|
|||
|
||||
for_each_word([&](const Utf8View& view, int start, int length) {
|
||||
words.append({ Utf8View(view), start, length });
|
||||
|
||||
});
|
||||
|
||||
for (int i = 0; i < words.size(); ++i) {
|
||||
|
@ -210,7 +209,7 @@ void LayoutText::split_into_lines(LayoutBlock& container)
|
|||
if (is_whitespace)
|
||||
word_width = space_width;
|
||||
else
|
||||
word_width = m_font->width(word.view);
|
||||
word_width = m_font->width(word.view) + m_font->glyph_spacing();
|
||||
|
||||
if (word_width > available_width) {
|
||||
line_boxes.append(LineBox());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue