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

Unified Diff: src/ports/SkFontHost_fontconfig.cpp

Issue 838743002: Cache SkTypeface for alternative family name (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: add a comment Created 5 years, 11 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 | no next file » | no next file with comments »
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 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());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698