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

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

Issue 131096: Only select scalable fonts.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 FcChar8* post_config_family; 111 FcChar8* post_config_family;
112 FcPatternGetString(pattern, FC_FAMILY, 0, &post_config_family); 112 FcPatternGetString(pattern, FC_FAMILY, 0, &post_config_family);
113 113
114 FcResult result; 114 FcResult result;
115 FcPattern* match = FcFontMatch(0, pattern, &result); 115 FcPattern* match = FcFontMatch(0, pattern, &result);
116 if (!match) { 116 if (!match) {
117 FcPatternDestroy(pattern); 117 FcPatternDestroy(pattern);
118 return false; 118 return false;
119 } 119 }
120 120
121 // Skip non-scalable fonts, they don't work with FT_Set_Char_Size
122 // in SkFontHost_FreeType.cpp.
123 FcBool scalable = FcFalse;
124 FcPatternGetBool(match, FC_SCALABLE, 0, &scalable);
125 if (scalable != FcTrue) {
126 FcPatternDestroy(match);
127 FcPatternDestroy(pattern);
128 return false;
129 }
130
121 FcChar8* post_match_family; 131 FcChar8* post_match_family;
122 FcPatternGetString(match, FC_FAMILY, 0, &post_match_family); 132 FcPatternGetString(match, FC_FAMILY, 0, &post_match_family);
123 const bool family_names_match = 133 const bool family_names_match =
124 family.empty() ? 134 family.empty() ?
125 true : 135 true :
126 strcasecmp((char *)post_config_family, (char *)post_match_family) == 0; 136 strcasecmp((char *)post_config_family, (char *)post_match_family) == 0;
127 137
128 FcPatternDestroy(pattern); 138 FcPatternDestroy(pattern);
129 139
130 if (!family_names_match && !IsFallbackFontAllowed(family)) { 140 if (!family_names_match && !IsFallbackFontAllowed(family)) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 183
174 int FontConfigDirect::Open(unsigned fileid) { 184 int FontConfigDirect::Open(unsigned fileid) {
175 SkAutoMutexAcquire ac(mutex_); 185 SkAutoMutexAcquire ac(mutex_);
176 const std::map<unsigned, std::string>::const_iterator 186 const std::map<unsigned, std::string>::const_iterator
177 i = fileid_to_filename_.find(fileid); 187 i = fileid_to_filename_.find(fileid);
178 if (i == fileid_to_filename_.end()) 188 if (i == fileid_to_filename_.end())
179 return -1; 189 return -1;
180 190
181 return open(i->second.c_str(), O_RDONLY); 191 return open(i->second.c_str(), O_RDONLY);
182 } 192 }
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