summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-07-17 14:29:02 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-07-17 14:29:02 -0400
commitd6bc8daa6935b53c15d254e70051ba6b134c759c (patch)
tree4f2e1d988924c7db22ef6465aa62d803cc4a78fd /pango/pango-layout.c
parent4ac5659d9a8efd67decfc2974db823450d785139 (diff)
downloadpango-d6bc8daa6935b53c15d254e70051ba6b134c759c.tar.gz
layout: Fix reshaping with hyphen runs
When we are uninserting a hyphen run, we need to undo the modifications of the item we split it off from.
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r--pango/pango-layout.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 9300a76a..7e450f5e 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -2991,7 +2991,8 @@ free_run (PangoLayoutRun *run, gpointer data)
static PangoItem *
uninsert_run (PangoLayoutLine *line)
{
- PangoLayoutRun *run;
+ PangoLayout *layout = line->layout;
+ PangoLayoutRun *run, *prev;
PangoItem *item;
GSList *tmp_node = line->runs;
@@ -3002,6 +3003,18 @@ uninsert_run (PangoLayoutLine *line)
line->runs = tmp_node->next;
line->length -= item->length;
+ if (item->length == 2 &&
+ strncmp (layout->text + run->item->offset, "\302\255", 2) == 0)
+ {
+ /* this is a hyphen run, add the SHY back
+ * to the previous item
+ */
+ prev = line->runs->data;
+ item = prev->item;
+ item->length += 2;
+ item->num_chars += 1;
+ }
+
g_slist_free_1 (tmp_node);
free_run (run, (gpointer)FALSE);
@@ -3929,7 +3942,7 @@ process_line (PangoLayout *layout,
case BREAK_NONE_FIT:
/* Back up over unused runs to run where there is a break */
while (line->runs && line->runs != break_link)
- state->items = g_list_prepend (state->items, uninsert_run (line);
+ state->items = g_list_prepend (state->items, uninsert_run (line));
state->start_offset = break_start_offset;
state->remaining_width = break_remaining_width;