| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 return strcasecmp(family_cstr, "sans") == 0 || | 39 return strcasecmp(family_cstr, "sans") == 0 || |
| 40 strcasecmp(family_cstr, "serif") == 0 || | 40 strcasecmp(family_cstr, "serif") == 0 || |
| 41 strcasecmp(family_cstr, "monospace") == 0; | 41 strcasecmp(family_cstr, "monospace") == 0; |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool FontConfigDirect::Match(std::string* result_family, | 44 bool FontConfigDirect::Match(std::string* result_family, |
| 45 unsigned* result_fileid, | 45 unsigned* result_fileid, |
| 46 bool fileid_valid, unsigned fileid, | 46 bool fileid_valid, unsigned fileid, |
| 47 const std::string& family, bool* is_bold, | 47 const std::string& family, bool* is_bold, |
| 48 bool* is_italic) { | 48 bool* is_italic) { |
| 49 if (family.length() > kMaxFontFamilyLength) |
| 50 return false; |
| 51 |
| 49 SkAutoMutexAcquire ac(mutex_); | 52 SkAutoMutexAcquire ac(mutex_); |
| 50 FcPattern* pattern = FcPatternCreate(); | 53 FcPattern* pattern = FcPatternCreate(); |
| 51 | 54 |
| 52 FcValue fcvalue; | 55 FcValue fcvalue; |
| 53 if (fileid_valid) { | 56 if (fileid_valid) { |
| 54 const std::map<unsigned, std::string>::const_iterator | 57 const std::map<unsigned, std::string>::const_iterator |
| 55 i = fileid_to_filename_.find(fileid); | 58 i = fileid_to_filename_.find(fileid); |
| 56 if (i == fileid_to_filename_.end()) { | 59 if (i == fileid_to_filename_.end()) { |
| 57 FcPatternDestroy(pattern); | 60 FcPatternDestroy(pattern); |
| 58 return false; | 61 return false; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 253 |
| 251 int FontConfigDirect::Open(unsigned fileid) { | 254 int FontConfigDirect::Open(unsigned fileid) { |
| 252 SkAutoMutexAcquire ac(mutex_); | 255 SkAutoMutexAcquire ac(mutex_); |
| 253 const std::map<unsigned, std::string>::const_iterator | 256 const std::map<unsigned, std::string>::const_iterator |
| 254 i = fileid_to_filename_.find(fileid); | 257 i = fileid_to_filename_.find(fileid); |
| 255 if (i == fileid_to_filename_.end()) | 258 if (i == fileid_to_filename_.end()) |
| 256 return -1; | 259 return -1; |
| 257 | 260 |
| 258 return open(i->second.c_str(), O_RDONLY); | 261 return open(i->second.c_str(), O_RDONLY); |
| 259 } | 262 } |
| OLD | NEW |