[pango/ltr-line-breaking-fixes: 7/11] Correctly reinstate remaining_width




commit e439198c96c34f23bb38d07493b572776f118e01
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Nov 12 13:56:28 2021 -0500

    Correctly reinstate remaining_width
    
    When unsplitting an item, we were sometimes
    calculating the remaining_width incorrectly.

 pango/pango-layout.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index ebc9ce67..821f767c 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3941,6 +3941,8 @@ process_item (PangoLayout     *layout,
 
       if (force_fit || break_width + break_extra_width <= state->remaining_width)       /* Successfully 
broke the item */
         {
+          int remaining = state->remaining_width;
+
           if (state->remaining_width >= 0)
             {
               state->remaining_width -= break_width;
@@ -3971,7 +3973,7 @@ process_item (PangoLayout     *layout,
                 new_item->analysis.flags |= PANGO_ANALYSIS_FLAG_NEED_HYPHEN;
 
               /* Add the width back, to the line, reshape, subtract the new width */
-              state->remaining_width += break_width;
+              state->remaining_width = remaining;
               insert_run (line, state, new_item, FALSE);
 
               break_width = pango_glyph_string_get_width (((PangoGlyphItem *)(line->runs->data))->glyphs);


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