[pango/fix-keycap-sequences: 19/20] Fix handling of keycap sequences
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/fix-keycap-sequences: 19/20] Fix handling of keycap sequences
- Date: Thu, 17 Sep 2020 23:26:58 +0000 (UTC)
commit b1718281f02fa811bcff7ef7a73ee361c452747b
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Sep 17 19:17:27 2020 -0400
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
pango/pango-context.c | 16 +++++++++++-----
1 file 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]