From 96fa633577dddbdd2b56d4a72382a8a90980d036 Mon Sep 17 00:00:00 2001 From: Roozbeh Pournader Date: Thu, 11 Aug 2016 21:03:00 +0000 Subject: [PATCH] Revert "Lookup glyph from color emoji font before and after ZWJ." This reverts commit 56bda7e82a59b3fcaa828960deeb2a766f8afdfe. Bug: 30815709 Change-Id: I057d9bcd05246e58894abb4e9633bd10f6fab211 --- .../flutter/libs/minikin/FontCollection.cpp | 18 +++++++----------- .../tests/FontCollectionItemizeTest.cpp | 12 +++--------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/engine/src/flutter/libs/minikin/FontCollection.cpp b/engine/src/flutter/libs/minikin/FontCollection.cpp index e665615d93..33418ab1b5 100644 --- a/engine/src/flutter/libs/minikin/FontCollection.cpp +++ b/engine/src/flutter/libs/minikin/FontCollection.cpp @@ -335,15 +335,18 @@ FontFamily* FontCollection::getFamilyForChar(uint32_t ch, uint32_t vs, } const uint32_t NBSP = 0xa0; -const uint32_t ZWJ = 0x200d; -const uint32_t ZWNJ = 0x200c; +const uint32_t ZWJ = 0x200c; +const uint32_t ZWNJ = 0x200d; const uint32_t HYPHEN = 0x2010; const uint32_t NB_HYPHEN = 0x2011; +const uint32_t FEMALE_SIGN = 0x2640; +const uint32_t MALE_SIGN = 0x2642; +const uint32_t STAFF_OF_AESCULAPIUS = 0x2695; // Characters where we want to continue using existing font run instead of // recomputing the best match in the fallback list. static const uint32_t stickyWhitelist[] = { '!', ',', '-', '.', ':', ';', '?', NBSP, ZWJ, ZWNJ, - HYPHEN, NB_HYPHEN }; + HYPHEN, NB_HYPHEN, FEMALE_SIGN, MALE_SIGN, STAFF_OF_AESCULAPIUS }; static bool isStickyWhitelisted(uint32_t c) { for (size_t i = 0; i < sizeof(stickyWhitelist) / sizeof(stickyWhitelist[0]); i++) { @@ -429,15 +432,8 @@ void FontCollection::itemize(const uint16_t *string, size_t string_size, FontSty } if (!shouldContinueRun) { - FontFamily* family; - if ((prevCh == ZWJ || nextCh == ZWJ) && isEmoji(ch)) { - // Treat emoji before and after ZWJ as emoji presentation. - family = getFamilyForChar(ch, EMOJI_STYLE_VS, langListId, variant); - } else { - family = getFamilyForChar(ch, isVariationSelector(nextCh) ? nextCh : 0, + FontFamily* family = getFamilyForChar(ch, isVariationSelector(nextCh) ? nextCh : 0, langListId, variant); - } - if (utf16Pos == 0 || family != lastFamily) { size_t start = utf16Pos; // Workaround for combining marks and emoji modifiers until we implement diff --git a/engine/src/flutter/tests/FontCollectionItemizeTest.cpp b/engine/src/flutter/tests/FontCollectionItemizeTest.cpp index 85d223ceaf..468b4a28fa 100644 --- a/engine/src/flutter/tests/FontCollectionItemizeTest.cpp +++ b/engine/src/flutter/tests/FontCollectionItemizeTest.cpp @@ -1223,7 +1223,7 @@ TEST_F(FontCollectionItemizeTest, itemize_emojiSelection_withFE0E) { EXPECT_EQ(2, runs[0].end); EXPECT_EQ(kNoGlyphFont, getFontPath(runs[0])); - // U+26FA U+FE0E is specified but ColorTextMixedEmojiFont has a variation sequence U+26FA U+FE0F + // U+26FA U+FE0E is specified but ColorTextMixedEmojiFont has a variation sequence U+26F9 U+FE0F // in its cmap, so ColorTextMixedEmojiFont should be selected instaed of ColorEmojiFont. itemize(collection.get(), "U+26FA U+FE0E", kDefaultFontStyle, &runs); ASSERT_EQ(1U, runs.size()); @@ -1305,9 +1305,9 @@ TEST_F(FontCollectionItemizeTest, itemize_emojiSelection_withFE0F) { EXPECT_EQ(2, runs[0].end); EXPECT_EQ(kNoGlyphFont, getFontPath(runs[0])); - // U+26F8 U+FE0F is specified but ColorTextMixedEmojiFont has a variation sequence U+26F8 U+FE0F + // U+26F9 U+FE0F is specified but ColorTextMixedEmojiFont has a variation sequence U+26F9 U+FE0F // in its cmap, so ColorTextMixedEmojiFont should be selected instaed of ColorEmojiFont. - itemize(collection.get(), "U+26F8 U+FE0F", kDefaultFontStyle, &runs); + itemize(collection.get(), "U+26F9 U+FE0F", kDefaultFontStyle, &runs); ASSERT_EQ(1U, runs.size()); EXPECT_EQ(0, runs[0].start); EXPECT_EQ(2, runs[0].end); @@ -1396,10 +1396,4 @@ TEST_F(FontCollectionItemizeTest, itemize_genderBalancedEmoji) { EXPECT_EQ(0, runs[0].start); EXPECT_EQ(4, runs[0].end); EXPECT_EQ(kColorEmojiFont, getFontPath(runs[0])); - - itemize(collection.get(), "U+26F9 U+200D U+2695", kDefaultFontStyle, &runs); - ASSERT_EQ(1U, runs.size()); - EXPECT_EQ(0, runs[0].start); - EXPECT_EQ(3, runs[0].end); - EXPECT_EQ(kColorEmojiFont, getFontPath(runs[0])); }