summaryrefslogtreecommitdiff
path: root/pango/pango-emoji.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2017-07-31 23:03:30 +0100
committerBehdad Esfahbod <behdad@behdad.org>2017-07-31 23:04:36 +0100
commitfe0669798d617406b52a638fb2525b1f7527a2d6 (patch)
treefb07b695692ba66b11c8e79864f4ce5c97f386b0 /pango/pango-emoji.c
parentf39ad9bab1f327062958b2750bf1f5609a9ee991 (diff)
downloadpango-fe0669798d617406b52a638fb2525b1f7527a2d6.tar.gz
Choose emoji font for color emoji
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=785566
Diffstat (limited to 'pango/pango-emoji.c')
-rw-r--r--pango/pango-emoji.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/pango/pango-emoji.c b/pango/pango-emoji.c
index 630a0e7f..0e332dff 100644
--- a/pango/pango-emoji.c
+++ b/pango/pango-emoji.c
@@ -160,7 +160,7 @@ _pango_emoji_iter_init (PangoEmojiIter *iter,
iter->start = text;
iter->end = text;
- iter->is_emoji = FALSE;
+ iter->is_emoji = (gboolean) 2; /* HACK */
_pango_emoji_iter_next (iter);
@@ -194,7 +194,7 @@ _pango_emoji_iter_next (PangoEmojiIter *iter)
* presentation for emoji that are part of a ZWJ sequence, example
* U+1F441 U+200D U+1F5E8, eye (text presentation) + ZWJ + left speech
* bubble, see below. */
- if ((!(ch == kZeroWidthJoinerCharacter && iter->is_emoji) &&
+ if ((!(ch == kZeroWidthJoinerCharacter && !iter->is_emoji) &&
ch != kVariationSelector15Character &&
ch != kVariationSelector16Character &&
ch != kCombiningEnclosingCircleBackslashCharacter &&
@@ -204,14 +204,14 @@ _pango_emoji_iter_next (PangoEmojiIter *iter)
ch == kMaleSignCharacter ||
ch == kFemaleSignCharacter ||
ch == kStaffOfAesculapiusCharacter) &&
- iter->is_emoji)) ||
+ !iter->is_emoji)) ||
current_emoji_type == PANGO_EMOJI_TYPE_INVALID) {
current_emoji_type = _pango_get_emoji_type (ch);
}
- if (iter->end < iter->text_end)
+ if (g_utf8_next_char (iter->end) < iter->text_end) /* Optimize. */
{
- gunichar peek_char = g_utf8_get_char (iter->end);
+ gunichar peek_char = g_utf8_get_char (g_utf8_next_char (iter->end));
/* Variation Selectors */
if (current_emoji_type ==
@@ -248,9 +248,11 @@ _pango_emoji_iter_next (PangoEmojiIter *iter)
}
}
- if (iter->is_emoji != PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type) && iter->start != iter->text_start)
+ if (iter->is_emoji == (gboolean) 2)
+ iter->is_emoji = !PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type);
+ if (iter->is_emoji == PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type))
{
- iter->is_emoji = PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type);
+ iter->is_emoji = !PANGO_EMOJI_TYPE_IS_EMOJI (current_emoji_type);
return TRUE;
}
}