summaryrefslogtreecommitdiffstats
path: root/include/minikin/FontFamily.h
diff options
context:
space:
mode:
authorSeigo Nonaka <nona@google.com>2016-02-02 15:42:37 +0900
committerSeigo Nonaka <nona@google.com>2016-02-17 16:01:20 +0900
commit6b1c227da6492a435f0341d7fe95d9992669920e (patch)
tree81094b267d539ac17218ae9b9b2cb9472f5114af /include/minikin/FontFamily.h
parent070633ad657e20344fa9d9e7ab79ebb311365aa9 (diff)
downloadandroid_frameworks_minikin-6b1c227da6492a435f0341d7fe95d9992669920e.tar.gz
android_frameworks_minikin-6b1c227da6492a435f0341d7fe95d9992669920e.tar.bz2
android_frameworks_minikin-6b1c227da6492a435f0341d7fe95d9992669920e.zip
Improve Paint.measureText and Paint.hasGlyph for variation sequences.
Before this patch, the font fallback chain iterated all installed font families if a variation selector was specified. This CL narrows down the range of iteration. To decide the font family for the variation sequence, we need to search for both the variation sequence and its base code point. The new range of the iteration is a union of them. With this change, the running time of Paint.hasGlyph for the variation sequence improves 50% and the running time of Paint.measureText for the variation sequence improves 40% for the large text case on Nexus 6 userdebug. Bug: 26784699 Bug: 11750374 Change-Id: Iced1349e3ca750821d8882c551551f65bb569794
Diffstat (limited to 'include/minikin/FontFamily.h')
-rw-r--r--include/minikin/FontFamily.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/minikin/FontFamily.h b/include/minikin/FontFamily.h
index 2b59160..149dc7b 100644
--- a/include/minikin/FontFamily.h
+++ b/include/minikin/FontFamily.h
@@ -104,7 +104,11 @@ public:
FontFamily(int variant);
- FontFamily(uint32_t langId, int variant) : mLangId(langId), mVariant(variant) {
+ FontFamily(uint32_t langId, int variant)
+ : mLangId(langId),
+ mVariant(variant),
+ mHasVSTable(false),
+ mCoverageValid(false) {
}
~FontFamily();
@@ -131,6 +135,9 @@ public:
// Caller should acquire a lock before calling the method.
bool hasVariationSelector(uint32_t codepoint, uint32_t variationSelector);
+ // Returns true if this font family has a variaion sequence table (cmap format 14 subtable).
+ bool hasVSTable() const;
+
private:
void addFontLocked(MinikinFont* typeface, FontStyle style);
@@ -146,6 +153,7 @@ private:
std::vector<Font> mFonts;
SparseBitSet mCoverage;
+ bool mHasVSTable;
bool mCoverageValid;
};