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

Side by Side Diff: src/ports/SkFontConfigInterface_direct.cpp

Issue 23684041: improve bitmap font support (FreeType only) (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Correct selection logic, remove debug code. Created 7 years 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
OLDNEW
1 /* 1 /*
2 * Copyright 2009 Google Inc. 2 * Copyright 2009 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 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ 8 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */
9 9
10 #include <string> 10 #include <string>
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // tells you whether a given request is for such a fallback. 323 // tells you whether a given request is for such a fallback.
324 bool IsFallbackFontAllowed(const std::string& family) { 324 bool IsFallbackFontAllowed(const std::string& family) {
325 const char* family_cstr = family.c_str(); 325 const char* family_cstr = family.c_str();
326 return family.empty() || 326 return family.empty() ||
327 strcasecmp(family_cstr, "sans") == 0 || 327 strcasecmp(family_cstr, "sans") == 0 ||
328 strcasecmp(family_cstr, "serif") == 0 || 328 strcasecmp(family_cstr, "serif") == 0 ||
329 strcasecmp(family_cstr, "monospace") == 0; 329 strcasecmp(family_cstr, "monospace") == 0;
330 } 330 }
331 331
332 static bool valid_pattern(FcPattern* pattern) { 332 static bool valid_pattern(FcPattern* pattern) {
333 #ifdef SK_FONT_CONFIG_ONLY_ALLOW_SCALABLE_FONTS
333 FcBool is_scalable; 334 FcBool is_scalable;
334 if (FcPatternGetBool(pattern, FC_SCALABLE, 0, &is_scalable) != FcResultMatch 335 if (FcPatternGetBool(pattern, FC_SCALABLE, 0, &is_scalable) != FcResultMatch
335 || !is_scalable) { 336 || !is_scalable) {
336 return false; 337 return false;
337 } 338 }
339 #endif
338 340
339 // fontconfig can also return fonts which are unreadable 341 // fontconfig can also return fonts which are unreadable
340 const char* c_filename = get_name(pattern, FC_FILE); 342 const char* c_filename = get_name(pattern, FC_FILE);
341 if (!c_filename) { 343 if (!c_filename) {
342 return false; 344 return false;
343 } 345 }
344 if (access(c_filename, R_OK) != 0) { 346 if (access(c_filename, R_OK) != 0) {
345 return false; 347 return false;
346 } 348 }
347 return true; 349 return true;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 *trimmedMatches.append() = match[i]; 727 *trimmedMatches.append() = match[i];
726 } 728 }
727 } 729 }
728 730
729 SkFontStyleSet_FC* sset = SkNEW_ARGS(SkFontStyleSet_FC, 731 SkFontStyleSet_FC* sset = SkNEW_ARGS(SkFontStyleSet_FC,
730 (trimmedMatches.begin(), 732 (trimmedMatches.begin(),
731 trimmedMatches.count())); 733 trimmedMatches.count()));
732 #endif 734 #endif
733 return false; 735 return false;
734 } 736 }
OLDNEW
« gm/coloremoji.cpp ('K') | « gm/coloremoji.cpp ('k') | src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698