summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-11-12 13:56:28 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-11-12 18:41:15 -0500
commite439198c96c34f23bb38d07493b572776f118e01 (patch)
treeb8c2fa16ea9c54b52acdff9a3acc2cb20a42dacd
parenta4fb00b9d290cec81b51ba38bd3bbc7f5ae62b93 (diff)
downloadpango-e439198c96c34f23bb38d07493b572776f118e01.tar.gz
Correctly reinstate remaining_width
When unsplitting an item, we were sometimes calculating the remaining_width incorrectly.
-rw-r--r--pango/pango-layout.c4
1 files changed, 3 insertions, 1 deletions
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);