diff --git a/Tests/LibWeb/Ref/reference/space-glyph-width-ref.html b/Tests/LibWeb/Ref/reference/space-glyph-width-ref.html new file mode 100644 index 0000000000..f7e51aeb99 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/space-glyph-width-ref.html @@ -0,0 +1,13 @@ + + + + + + +
A B
+ + diff --git a/Tests/LibWeb/Ref/space-glyph-width.html b/Tests/LibWeb/Ref/space-glyph-width.html new file mode 100644 index 0000000000..8584235727 --- /dev/null +++ b/Tests/LibWeb/Ref/space-glyph-width.html @@ -0,0 +1,21 @@ + + + + + + + +
A B
+ + diff --git a/Userland/Libraries/LibGfx/TextLayout.h b/Userland/Libraries/LibGfx/TextLayout.h index b002ddcd35..5a4243840a 100644 --- a/Userland/Libraries/LibGfx/TextLayout.h +++ b/Userland/Libraries/LibGfx/TextLayout.h @@ -105,7 +105,8 @@ Variant prepare_draw_glyph_or_emoji(FloatPoint point, Utf8 template void for_each_glyph_position(FloatPoint baseline_start, Utf8View string, FontCascadeList const& font_list, Callback callback, IncludeLeftBearing include_left_bearing = IncludeLeftBearing::No, Optional width = {}) { - float space_width = font_list.first().glyph_width(' ') + font_list.first().glyph_spacing(); + auto const& space_glyph_font = font_list.font_for_code_point(' '); + float space_width = space_glyph_font.glyph_width(' ') + space_glyph_font.glyph_spacing(); u32 last_code_point = 0;