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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/FontMgrTest.cpp » ('j') | tests/FontMgrTest.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 Google Inc. 2 * Copyright 2008 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkFontConfigInterface.h" 8 #include "SkFontConfigInterface.h"
9 #include "SkFontConfigTypeface.h" 9 #include "SkFontConfigTypeface.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 SkFontConfigInterface::FontIdentity indentity; 103 SkFontConfigInterface::FontIdentity indentity;
104 SkString outFamilyName; 104 SkString outFamilyName;
105 SkTypeface::Style outStyle; 105 SkTypeface::Style outStyle;
106 106
107 if (!fci->matchFamilyName(familyName, style, 107 if (!fci->matchFamilyName(familyName, style,
108 &indentity, &outFamilyName, &outStyle)) { 108 &indentity, &outFamilyName, &outStyle)) {
109 return NULL; 109 return NULL;
110 } 110 }
111 111
112 // check if we, in fact, already have this. perhaps fontconfig aliased the
113 // requested name to some other name we actually have...
114 rec.fFamilyName = outFamilyName.c_str();
115 rec.fStyle = outStyle;
116 face = SkTypefaceCache::FindByProcAndRef(find_proc, &rec);
117 if (face) {
118 return face;
119 }
120
112 face = SkNEW_ARGS(FontConfigTypeface, (outStyle, indentity, outFamilyName)); 121 face = SkNEW_ARGS(FontConfigTypeface, (outStyle, indentity, outFamilyName));
113 SkTypefaceCache::Add(face, style); 122 SkTypefaceCache::Add(face, style);
114 // SkDebugf("add face <%s> <%s> %p [%d]\n", familyName, outFamilyName.c_str() , face, face->getRefCnt()); 123 // SkDebugf("add face <%s> <%s> %p [%d]\n", familyName, outFamilyName.c_str() , face, face->getRefCnt());
115 return face; 124 return face;
116 } 125 }
117 126
118 #ifndef SK_FONTHOST_USES_FONTMGR 127 #ifndef SK_FONTHOST_USES_FONTMGR
119 128
120 SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, 129 SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
121 const char familyName[], 130 const char familyName[],
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 207
199 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc, 208 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
200 bool* isLocalStream) const { 209 bool* isLocalStream) const {
201 desc->setFamilyName(this->getFamilyName()); 210 desc->setFamilyName(this->getFamilyName());
202 *isLocalStream = SkToBool(this->getLocalStream()); 211 *isLocalStream = SkToBool(this->getLocalStream());
203 } 212 }
204 213
205 SkTypeface* FontConfigTypeface::onRefMatchingStyle(Style style) const { 214 SkTypeface* FontConfigTypeface::onRefMatchingStyle(Style style) const {
206 return LegacyCreateTypeface(this, NULL, style); 215 return LegacyCreateTypeface(this, NULL, style);
207 } 216 }
OLDNEW
« 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