summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-09-18 18:10:36 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-09-18 18:10:36 +0000
commitd9b69cbaafe08ec7a165eef944cfe6110b3d6d2b (patch)
tree56e06f8edaa2b572239907e2d19f0c4498dff765
parent8095dd3217dfbcec4b009a87d534732730ae45bb (diff)
parent6253c71b09a389b37d2a482f3ff1988dd30f80ce (diff)
downloadpango-d9b69cbaafe08ec7a165eef944cfe6110b3d6d2b.tar.gz
Merge branch 'fix-keycap-sequences' into 'master'
Fix handling of keycap sequences Closes #502 See merge request GNOME/pango!241
-rw-r--r--pango/pango-context.c16
-rw-r--r--tests/layouts/valid-6.expected25
-rw-r--r--tests/layouts/valid-6.markup2
3 files changed, 38 insertions, 5 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c
index bebe804a..1fcdf366 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -1065,6 +1065,9 @@ itemize_state_init (ItemizeState *state,
width_iter_init (&state->width_iter, text + start_index, length);
_pango_emoji_iter_init (&state->emoji_iter, text + start_index, length);
+ if (state->emoji_iter.is_emoji)
+ state->width_iter.end = MAX (state->width_iter.end, state->emoji_iter.end);
+
update_end (state);
if (pango_font_description_get_set_fields (state->font_desc) & PANGO_FONT_MASK_GRAVITY)
@@ -1111,15 +1114,18 @@ itemize_state_next (ItemizeState *state)
&state->script_end, &state->script);
state->changed |= SCRIPT_CHANGED;
}
- if (state->run_end == state->width_iter.end)
- {
- width_iter_next (&state->width_iter);
- state->changed |= WIDTH_CHANGED;
- }
if (state->run_end == state->emoji_iter.end)
{
_pango_emoji_iter_next (&state->emoji_iter);
state->changed |= EMOJI_CHANGED;
+
+ if (state->emoji_iter.is_emoji)
+ state->width_iter.end = MAX (state->width_iter.end, state->emoji_iter.end);
+ }
+ if (state->run_end == state->width_iter.end)
+ {
+ width_iter_next (&state->width_iter);
+ state->changed |= WIDTH_CHANGED;
}
update_end (state);
diff --git a/tests/layouts/valid-6.expected b/tests/layouts/valid-6.expected
new file mode 100644
index 00000000..b8f90c34
--- /dev/null
+++ b/tests/layouts/valid-6.expected
@@ -0,0 +1,25 @@
+ 0️⃣ Keycap Digit Zero
+
+--- parameters
+
+wrapped: 0
+ellipsized: 0
+lines: 2
+
+--- attributes
+
+range 0 2147483647
+
+--- lines
+
+i=1, index=0, paragraph-start=1, dir=ltr ' 0️⃣ Keycap Digit Zero
+'
+i=2, index=27, paragraph-start=1, dir=ltr ''
+
+--- runs
+
+i=1, index=0, chars=1, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' '
+i=2, index=1, chars=3, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '0️⃣'
+i=3, index=8, chars=18, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' Keycap Digit Zero'
+i=4, index=26, no run, line end
+i=5, index=27, no run, line end
diff --git a/tests/layouts/valid-6.markup b/tests/layouts/valid-6.markup
new file mode 100644
index 00000000..92c53e28
--- /dev/null
+++ b/tests/layouts/valid-6.markup
@@ -0,0 +1,2 @@
+
+ 0️⃣ Keycap Digit Zero