Add some gender balanced components in to the sticky whitelist.
am: 2fd057eb70
Change-Id: Ieda8b25bba40f22c9d8c33aba590e96e3396f6c4
This commit is contained in:
@@ -336,11 +336,14 @@ 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++) {
|
||||
|
||||
@@ -1372,3 +1372,28 @@ TEST_F(FontCollectionItemizeTest, itemize_PrivateUseArea) {
|
||||
EXPECT_EQ(4, runs[0].end);
|
||||
EXPECT_EQ(kNoGlyphFont, getFontPath(runs[0]));
|
||||
}
|
||||
|
||||
TEST_F(FontCollectionItemizeTest, itemize_genderBalancedEmoji) {
|
||||
MinikinAutoUnref<FontCollection> collection(getFontCollection(kTestFontDir, kEmojiXmlFile));
|
||||
std::vector<FontCollection::Run> runs;
|
||||
|
||||
const FontStyle kDefaultFontStyle;
|
||||
|
||||
itemize(collection.get(), "U+1F469 U+200D U+1F373", kDefaultFontStyle, &runs);
|
||||
ASSERT_EQ(1U, runs.size());
|
||||
EXPECT_EQ(0, runs[0].start);
|
||||
EXPECT_EQ(5, runs[0].end);
|
||||
EXPECT_EQ(kColorEmojiFont, getFontPath(runs[0]));
|
||||
|
||||
itemize(collection.get(), "U+1F469 U+200D U+2695 U+FE0F", kDefaultFontStyle, &runs);
|
||||
ASSERT_EQ(1U, runs.size());
|
||||
EXPECT_EQ(0, runs[0].start);
|
||||
EXPECT_EQ(5, runs[0].end);
|
||||
EXPECT_EQ(kColorEmojiFont, getFontPath(runs[0]));
|
||||
|
||||
itemize(collection.get(), "U+1F469 U+200D U+2695", kDefaultFontStyle, &runs);
|
||||
ASSERT_EQ(1U, runs.size());
|
||||
EXPECT_EQ(0, runs[0].start);
|
||||
EXPECT_EQ(4, runs[0].end);
|
||||
EXPECT_EQ(kColorEmojiFont, getFontPath(runs[0]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user