[pango/line-breaking-fixes: 12/12] Ignore trailing whitespace after reshaping




commit c41450c184bf60da4ba46869564e5cb2b6311813
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Nov 12 14:50:29 2021 -0500

    Ignore trailing whitespace after reshaping

 pango/pango-layout.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 1f44cba6..b605ded5 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3986,6 +3986,11 @@ process_item (PangoLayout     *layout,
               insert_run (line, state, new_item, FALSE);
 
               break_width = pango_glyph_string_get_width (((PangoGlyphItem *)(line->runs->data))->glyphs);
+
+              if (state->start_offset + break_num_chars > 0 &&
+                  layout->log_attrs[state->start_offset + break_num_chars - 1].is_white)
+                break_width -= state->log_widths[state->log_widths_offset + break_num_chars - 1];
+
               if (break_width > state->remaining_width &&
                   !break_disabled[break_num_chars] &&
                   break_num_chars > 1)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]