Index: src/ports/SkFontHost_fontconfig.cpp |
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp |
index 32e9f80560cefe0ad6c31cee45ae44a3184b564a..f45c7491e36045084539a72a2b41563b09b5d34e 100644 |
--- a/src/ports/SkFontHost_fontconfig.cpp |
+++ b/src/ports/SkFontHost_fontconfig.cpp |
@@ -118,6 +118,13 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface( |
face = FontConfigTypeface::Create(SkFontStyle(outStyle), indentity, outFamilyName); |
SkTypefaceCache::Add(face, requestedStyle); |
+ // If any aliased name is returned for the requested family, cache SkTypeface |
+ // with the original family name so the following lookups will hit the cache. |
+ if (!outFamilyName.equals(familyName)) { |
+ SkTypeface* face_orig = |
+ FontConfigTypeface::Create(SkFontStyle(outStyle), indentity, SkString(familyName)); |
+ SkTypefaceCache::Add(face_orig, requestedStyle); |
+ } |
//SkDebugf("add face <%s> <%s> %p [%d]\n", |
// familyName, outFamilyName.c_str(), |
// face, face->getRefCnt()); |