diff options
Diffstat (limited to 'libs/minikin/FontCollection.cpp')
-rw-r--r-- | libs/minikin/FontCollection.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libs/minikin/FontCollection.cpp b/libs/minikin/FontCollection.cpp index 33418ab..e665615 100644 --- a/libs/minikin/FontCollection.cpp +++ b/libs/minikin/FontCollection.cpp @@ -335,18 +335,15 @@ FontFamily* FontCollection::getFamilyForChar(uint32_t ch, uint32_t vs, } const uint32_t NBSP = 0xa0; -const uint32_t ZWJ = 0x200c; -const uint32_t ZWNJ = 0x200d; +const uint32_t ZWJ = 0x200d; +const uint32_t ZWNJ = 0x200c; 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, FEMALE_SIGN, MALE_SIGN, STAFF_OF_AESCULAPIUS }; + HYPHEN, NB_HYPHEN }; static bool isStickyWhitelisted(uint32_t c) { for (size_t i = 0; i < sizeof(stickyWhitelist) / sizeof(stickyWhitelist[0]); i++) { @@ -432,8 +429,15 @@ void FontCollection::itemize(const uint16_t *string, size_t string_size, FontSty } if (!shouldContinueRun) { - FontFamily* family = getFamilyForChar(ch, isVariationSelector(nextCh) ? nextCh : 0, + 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, langListId, variant); + } + if (utf16Pos == 0 || family != lastFamily) { size_t start = utf16Pos; // Workaround for combining marks and emoji modifiers until we implement |