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

Side by Side Diff: skia/ext/SkFontHost_fontconfig_direct.cpp

Issue 155751: Tries to retrieve all post_match_families in the font to support non-ascii fo... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* libs/graphics/ports/SkFontHost_fontconfig_direct.cpp 1 /* libs/graphics/ports/SkFontHost_fontconfig_direct.cpp
2 ** 2 **
3 ** Copyright 2009, Google Inc. 3 ** Copyright 2009, Google Inc.
4 ** 4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License"); 5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License. 6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at 7 ** You may obtain a copy of the License at
8 ** 8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0 9 ** http://www.apache.org/licenses/LICENSE-2.0
10 ** 10 **
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 match = current; 145 match = current;
146 break; 146 break;
147 } 147 }
148 148
149 if (!match) { 149 if (!match) {
150 FcPatternDestroy(pattern); 150 FcPatternDestroy(pattern);
151 FcFontSetDestroy(font_set); 151 FcFontSetDestroy(font_set);
152 return false; 152 return false;
153 } 153 }
154 154
155 FcChar8* post_match_family; 155 if (!IsFallbackFontAllowed(family)) {
156 FcPatternGetString(match, FC_FAMILY, 0, &post_match_family); 156 bool family_names_match = false;
157 const bool family_names_match = 157 for (int id = 0; id < 255; ++id) {
158 family.empty() ? 158 FcChar8* post_match_family;
159 true : 159 if (FcPatternGetString(match, FC_FAMILY, id, &post_match_family) !=
160 strcasecmp((char *)post_config_family, (char *)post_match_family) == 0; 160 FcResultMatch)
161 break;
162 family_names_match =
163 family.empty() ?
164 true :
165 strcasecmp((char *)post_config_family,
166 (char *)post_match_family) == 0;
167 if (family_names_match)
168 break;
169 }
170 if (!family.empty() && !family_names_match) {
171 FcPatternDestroy(pattern);
172 FcFontSetDestroy(font_set);
173 return false;
174 }
175 }
161 176
162 FcPatternDestroy(pattern); 177 FcPatternDestroy(pattern);
163 178
164 if (!family_names_match && !IsFallbackFontAllowed(family)) {
165 FcFontSetDestroy(font_set);
166 return false;
167 }
168
169 FcChar8* c_filename; 179 FcChar8* c_filename;
170 if (FcPatternGetString(match, FC_FILE, 0, &c_filename) != FcResultMatch) { 180 if (FcPatternGetString(match, FC_FILE, 0, &c_filename) != FcResultMatch) {
171 FcFontSetDestroy(font_set); 181 FcFontSetDestroy(font_set);
172 return false; 182 return false;
173 } 183 }
174 const std::string filename((char *) c_filename); 184 const std::string filename((char *) c_filename);
175 185
176 unsigned out_fileid; 186 unsigned out_fileid;
177 if (fileid_valid) { 187 if (fileid_valid) {
178 out_fileid = fileid; 188 out_fileid = fileid;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 243
234 int FontConfigDirect::Open(unsigned fileid) { 244 int FontConfigDirect::Open(unsigned fileid) {
235 SkAutoMutexAcquire ac(mutex_); 245 SkAutoMutexAcquire ac(mutex_);
236 const std::map<unsigned, std::string>::const_iterator 246 const std::map<unsigned, std::string>::const_iterator
237 i = fileid_to_filename_.find(fileid); 247 i = fileid_to_filename_.find(fileid);
238 if (i == fileid_to_filename_.end()) 248 if (i == fileid_to_filename_.end())
239 return -1; 249 return -1;
240 250
241 return open(i->second.c_str(), O_RDONLY); 251 return open(i->second.c_str(), O_RDONLY);
242 } 252 }
OLDNEW
« 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