| Index: src/ports/SkFontHost_fontconfig.cpp
|
| diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp
|
| index 2fdb16e3645b8f288de28b2ea46788e8780ec491..f43c01b95778d73aeffc432922b4c56ae79d442f 100644
|
| --- a/src/ports/SkFontHost_fontconfig.cpp
|
| +++ b/src/ports/SkFontHost_fontconfig.cpp
|
| @@ -105,17 +105,17 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char familyName[],
|
| return face;
|
| }
|
|
|
| - SkFontConfigInterface::FontIdentity indentity;
|
| + SkFontConfigInterface::FontIdentity identity;
|
| SkString outFamilyName;
|
| SkTypeface::Style outStyle;
|
| - if (!fci->matchFamilyName(familyName, style, &indentity, &outFamilyName, &outStyle)) {
|
| + if (!fci->matchFamilyName(familyName, style, &identity, &outFamilyName, &outStyle)) {
|
| return NULL;
|
| }
|
|
|
| - // Check if a typeface with this FontIdentity is already in the FontIdentity cache.
|
| - face = SkTypefaceCache::FindByProcAndRef(find_by_FontIdentity, &indentity);
|
| + // Check if a typeface with this outFamily is already in the FontIdentity cache.
|
| + face = SkTypefaceCache::FindByProcAndRef(find_by_FontIdentity, &identity);
|
| if (!face) {
|
| - face = FontConfigTypeface::Create(SkFontStyle(outStyle), indentity, outFamilyName);
|
| + face = FontConfigTypeface::Create(SkFontStyle(outStyle), identity, outFamilyName);
|
| // Add this FontIdentity to the FontIdentity cache.
|
| SkTypefaceCache::Add(face, requestedStyle);
|
| }
|
| @@ -124,6 +124,16 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char familyName[],
|
| //SkDebugf("add face <%s> <%s> %p [%d]\n",
|
| // familyName, outFamilyName.c_str(),
|
| // face, face->getRefCnt());
|
| +
|
| + // 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), identity, SkString(familyName));
|
| + SkTypefaceCache::Add(face_orig, requestedStyle);
|
| + //SkDebugf("add face <%s> %p [%d]\n",
|
| + // familyName, face_orig, face_orig->getRefCnt());
|
| + }
|
| return face;
|
| }
|
|
|
|
|