[pango/line-breaking-fixes: 10/12] Correctly reinstate remaining_width




commit 7463f1fadfae6d5e72814bacef719aefa0bfc701
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 3059d08f..65bc8596 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3949,6 +3949,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;
@@ -3979,7 +3981,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]