Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: src/ports/SkFontHost_fontconfig.cpp

Issue 23710072: fix fontconfig backend to only cache new fonts if their outName was unique (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/FontMgrTest.cpp » ('j') | tests/FontMgrTest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « no previous file | tests/FontMgrTest.cpp » ('j') | tests/FontMgrTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698