summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-09-17 19:17:27 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-09-17 19:26:40 -0400
commitb1718281f02fa811bcff7ef7a73ee361c452747b (patch)
tree4c8e1ef79db7911de784518e806c825b78b5436c
parent8095dd3217dfbcec4b009a87d534732730ae45bb (diff)
downloadpango-b1718281f02fa811bcff7ef7a73ee361c452747b.tar.gz
Fix handling of keycap sequences
The last character of Emoji keycap sequences, 0x20E3, has a vertical orientation of U, according to Unicode. This unfortunately makes the width iter frequently break such sequences into multiple items, preventing them from being rendered as expected. Fix this by ignoring width changes inside Emoji sequences. Fixes: #502
-rw-r--r--pango/pango-context.c16
1 files changed, 11 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);