summaryrefslogtreecommitdiffstats
path: root/libs/minikin/FontFamily.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/minikin/FontFamily.cpp')
-rw-r--r--libs/minikin/FontFamily.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/libs/minikin/FontFamily.cpp b/libs/minikin/FontFamily.cpp
index 0f71f51..e2d86f0 100644
--- a/libs/minikin/FontFamily.cpp
+++ b/libs/minikin/FontFamily.cpp
@@ -65,6 +65,9 @@ uint32_t FontStyle::pack(int variant, int weight, bool italic) {
return (weight & kWeightMask) | (italic ? kItalicMask : 0) | (variant << kVariantShift);
}
+FontFamily::FontFamily() : FontFamily(0 /* variant */) {
+}
+
FontFamily::FontFamily(int variant) : FontFamily(FontLanguageListCache::kEmptyListId, variant) {
}
@@ -156,6 +159,16 @@ FontStyle FontFamily::getStyle(size_t index) const {
return mFonts[index].style;
}
+bool FontFamily::isColorEmojiFamily() const {
+ const FontLanguages& languageList = FontLanguageListCache::getById(mLangId);
+ for (size_t i = 0; i < languageList.size(); ++i) {
+ if (languageList[i].hasEmojiFlag()) {
+ return true;
+ }
+ }
+ return false;
+}
+
const SparseBitSet* FontFamily::getCoverage() {
if (!mCoverageValid) {
const FontStyle defaultStyle;
@@ -179,9 +192,11 @@ const SparseBitSet* FontFamily::getCoverage() {
return &mCoverage;
}
-bool FontFamily::hasVariationSelector(uint32_t codepoint, uint32_t variationSelector) {
+bool FontFamily::hasGlyph(uint32_t codepoint, uint32_t variationSelector) {
assertMinikinLocked();
- if (!mHasVSTable) {
+ if (variationSelector != 0 && !mHasVSTable) {
+ // Early exit if the variation selector is specified but the font doesn't have a cmap format
+ // 14 subtable.
return false;
}