From e439198c96c34f23bb38d07493b572776f118e01 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 12 Nov 2021 13:56:28 -0500 Subject: 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); -- cgit v1.2.1