summaryrefslogtreecommitdiffstats
path: root/libs/minikin/GraphemeBreak.cpp
diff options
context:
space:
mode:
authorSeigo Nonaka <nona@google.com>2016-04-19 17:14:27 +0900
committerRaph Levien <raph@google.com>2016-04-19 14:09:38 +0000
commit77f488345316fba46c271fc04bea470819ae1712 (patch)
treeb6ddec308ee5b78a70ce99b77af907d9f983e92a /libs/minikin/GraphemeBreak.cpp
parent994aa84f7b18466806fe552ea57da1852b909f24 (diff)
downloadandroid_frameworks_minikin-77f488345316fba46c271fc04bea470819ae1712.tar.gz
android_frameworks_minikin-77f488345316fba46c271fc04bea470819ae1712.tar.bz2
android_frameworks_minikin-77f488345316fba46c271fc04bea470819ae1712.zip
Do not break before and after ZWJ.
The emoji list is generated from external/unicode/emoji-data.txt Bug: 28248662 Change-Id: Ie49b3782505665d62c24371ca23d317ae5e9c5f7
Diffstat (limited to 'libs/minikin/GraphemeBreak.cpp')
-rw-r--r--libs/minikin/GraphemeBreak.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/libs/minikin/GraphemeBreak.cpp b/libs/minikin/GraphemeBreak.cpp
index 1f361ba..45dd0ff 100644
--- a/libs/minikin/GraphemeBreak.cpp
+++ b/libs/minikin/GraphemeBreak.cpp
@@ -66,19 +66,6 @@ bool isPureKiller(uint32_t c) {
|| c == 0xA953 || c == 0xABED || c == 0x11134 || c == 0x112EA || c == 0x1172B);
}
-// Returns true if the character appears before or after zwj in a zwj emoji sequence. See
-// http://www.unicode.org/emoji/charts/emoji-zwj-sequences.html
-bool isZwjEmoji(uint32_t c) {
- return (c == 0x2764 // HEAVY BLACK HEART
- || c == 0x1F468 // MAN
- || c == 0x1F469 // WOMAN
- || c == 0x1F48B // KISS MARK
- || c == 0x1F466 // BOY
- || c == 0x1F467 // GIRL
- || c == 0x1F441 // EYE
- || c == 0x1F5E8); // LEFT SPEECH BUBBLE
-}
-
bool GraphemeBreak::isGraphemeBreak(const uint16_t* buf, size_t start, size_t count,
size_t offset) {
// This implementation closely follows Unicode Standard Annex #29 on
@@ -163,7 +150,7 @@ bool GraphemeBreak::isGraphemeBreak(const uint16_t* buf, size_t start, size_t co
return false;
}
// Tailoring: make emoji sequences with ZWJ a single grapheme cluster
- if (c1 == 0x200D && isZwjEmoji(c2) && offset_back > start) {
+ if (c1 == 0x200D && isEmoji(c2) && offset_back > start) {
// look at character before ZWJ to see that both can participate in an emoji zwj sequence
uint32_t c0 = 0;
U16_PREV(buf, start, offset_back, c0);
@@ -171,7 +158,7 @@ bool GraphemeBreak::isGraphemeBreak(const uint16_t* buf, size_t start, size_t co
// skip over emoji variation selector
U16_PREV(buf, start, offset_back, c0);
}
- if (isZwjEmoji(c0)) {
+ if (isEmoji(c0)) {
return false;
}
}