Index: src/ports/SkFontHost_fontconfig.cpp |
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp |
index 012ce90c8cdf9f7525da8be9c12e09353061e0a1..0db44b242f41e20440a60c40049d312d3b93c610 100644 |
--- a/src/ports/SkFontHost_fontconfig.cpp |
+++ b/src/ports/SkFontHost_fontconfig.cpp |
@@ -109,6 +109,15 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface( |
return NULL; |
} |
+ // check if we, in fact, already have this. perhaps fontconfig aliased the |
+ // requested name to some other name we actually have... |
+ rec.fFamilyName = outFamilyName.c_str(); |
+ rec.fStyle = outStyle; |
+ face = SkTypefaceCache::FindByProcAndRef(find_proc, &rec); |
+ if (face) { |
+ return face; |
+ } |
+ |
face = SkNEW_ARGS(FontConfigTypeface, (outStyle, indentity, outFamilyName)); |
SkTypefaceCache::Add(face, style); |
// SkDebugf("add face <%s> <%s> %p [%d]\n", familyName, outFamilyName.c_str(), face, face->getRefCnt()); |