summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2015-10-29 11:39:58 -0700
committerRaph Levien <raph@google.com>2015-10-29 12:30:57 -0700
commitadaf42f0d3444de2b0bb977ccc94801458497f46 (patch)
treef6e86da698faff7fd336bf7bac58f20139b32dea
parente8264e065f0edd58a9fa04bbdd777f2af2794789 (diff)
downloadandroid_frameworks_minikin-adaf42f0d3444de2b0bb977ccc94801458497f46.tar.gz
android_frameworks_minikin-adaf42f0d3444de2b0bb977ccc94801458497f46.tar.bz2
android_frameworks_minikin-adaf42f0d3444de2b0bb977ccc94801458497f46.zip
Accept variation selector in emoji sequences - DO NOT MERGE
This patch basically ignores variation selectors for the purpose of itemization into font runs. This allows GSUB to be applied when input sequences contain variation selectors. Bug: 25368653 Change-Id: I9c1d325ae0cd322c21b7e850d0ec4d73551b2372
-rw-r--r--libs/minikin/FontCollection.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/minikin/FontCollection.cpp b/libs/minikin/FontCollection.cpp
index b4bfe31..2bcbc03 100644
--- a/libs/minikin/FontCollection.cpp
+++ b/libs/minikin/FontCollection.cpp
@@ -167,6 +167,10 @@ static bool isStickyWhitelisted(uint32_t c) {
return false;
}
+static bool isVariationSelector(uint32_t c) {
+ return (0xFE00 <= c && c <= 0xFE0F) || (0xE0100 <= c && c <= 0xE01EF);
+}
+
void FontCollection::itemize(const uint16_t *string, size_t string_size, FontStyle style,
vector<Run>* result) const {
FontLanguage lang = style.getLanguage();
@@ -184,9 +188,11 @@ void FontCollection::itemize(const uint16_t *string, size_t string_size, FontSty
nShorts = 2;
}
}
- // Continue using existing font as long as it has coverage and is whitelisted
+ // Continue using existing font as long as it has coverage and is whitelisted;
+ // also variation sequences continue existing run.
if (lastFamily == NULL
- || !(isStickyWhitelisted(ch) && lastFamily->getCoverage()->get(ch))) {
+ || !((isStickyWhitelisted(ch) && lastFamily->getCoverage()->get(ch))
+ || isVariationSelector(ch))) {
FontFamily* family = getFamilyForChar(ch, lang, variant);
if (i == 0 || family != lastFamily) {
size_t start = i;