summaryrefslogtreecommitdiffstats
path: root/include
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
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')
-rw-r--r--include/minikin/CmapCoverage.h3
-rw-r--r--include/minikin/FontCollection.h3
-rw-r--r--include/minikin/FontFamily.h10
3 files changed, 14 insertions, 2 deletions
diff --git a/include/minikin/CmapCoverage.h b/include/minikin/CmapCoverage.h
index 7054e31..56abac7 100644
--- a/include/minikin/CmapCoverage.h
+++ b/include/minikin/CmapCoverage.h
@@ -23,7 +23,8 @@ namespace android {
class CmapCoverage {
public:
- static bool getCoverage(SparseBitSet &coverage, const uint8_t* cmap_data, size_t cmap_size);
+ static bool getCoverage(SparseBitSet &coverage, const uint8_t* cmap_data, size_t cmap_size,
+ bool* has_cmap_format14_subtable);
};
} // namespace android
diff --git a/include/minikin/FontCollection.h b/include/minikin/FontCollection.h
index 3a63c07..5b9424c 100644
--- a/include/minikin/FontCollection.h
+++ b/include/minikin/FontCollection.h
@@ -89,6 +89,9 @@ private:
// This vector contains pointers into mInstances
std::vector<FontFamily*> mFamilyVec;
+ // This vector has pointers to the font family instance which has cmap 14 subtable.
+ std::vector<FontFamily*> mVSFamilyVec;
+
// These are offsets into mInstanceVec, one range per page
std::vector<Range> mRanges;
};
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;
};