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

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

Issue 149292: Make font fallback case insensitive.... (Closed) Base URL: svn://chrome-svn/chrome/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 17 matching lines...) Expand all
28 } 28 }
29 29
30 // ----------------------------------------------------------------------------- 30 // -----------------------------------------------------------------------------
31 // Normally we only return exactly the font asked for. In last-resort cases, 31 // Normally we only return exactly the font asked for. In last-resort cases,
32 // the request is for one of the basic font names "Sans", "Serif" or 32 // the request is for one of the basic font names "Sans", "Serif" or
33 // "Monospace". This function tells you whether a given request is for such a 33 // "Monospace". This function tells you whether a given request is for such a
34 // fallback. 34 // fallback.
35 // ----------------------------------------------------------------------------- 35 // -----------------------------------------------------------------------------
36 static bool IsFallbackFontAllowed(const std::string& family) 36 static bool IsFallbackFontAllowed(const std::string& family)
37 { 37 {
38 return family == "Sans" || 38 const char* family_cstr = family.c_str();
agl 2009/07/08 01:17:28 NACK. These are magic strings from platform/graphi
39 family == "Serif" || 39 return strcasecmp(family_cstr, "sans") == 0 ||
40 family == "Monospace"; 40 strcasecmp(family_cstr, "serif") == 0 ||
41 strcasecmp(family_cstr, "monospace") == 0;
41 } 42 }
42 43
43 bool FontConfigDirect::Match(std::string* result_family, 44 bool FontConfigDirect::Match(std::string* result_family,
44 unsigned* result_fileid, 45 unsigned* result_fileid,
45 bool fileid_valid, unsigned fileid, 46 bool fileid_valid, unsigned fileid,
46 const std::string& family, bool* is_bold, 47 const std::string& family, bool* is_bold,
47 bool* is_italic) { 48 bool* is_italic) {
48 SkAutoMutexAcquire ac(mutex_); 49 SkAutoMutexAcquire ac(mutex_);
49 FcPattern* pattern = FcPatternCreate(); 50 FcPattern* pattern = FcPatternCreate();
50 51
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 208
208 int FontConfigDirect::Open(unsigned fileid) { 209 int FontConfigDirect::Open(unsigned fileid) {
209 SkAutoMutexAcquire ac(mutex_); 210 SkAutoMutexAcquire ac(mutex_);
210 const std::map<unsigned, std::string>::const_iterator 211 const std::map<unsigned, std::string>::const_iterator
211 i = fileid_to_filename_.find(fileid); 212 i = fileid_to_filename_.find(fileid);
212 if (i == fileid_to_filename_.end()) 213 if (i == fileid_to_filename_.end())
213 return -1; 214 return -1;
214 215
215 return open(i->second.c_str(), O_RDONLY); 216 return open(i->second.c_str(), O_RDONLY);
216 } 217 }
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