| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 if (!IsFallbackFontAllowed(family)) { | 155 if (!IsFallbackFontAllowed(family)) { |
| 156 bool family_names_match = false; | 156 bool family_names_match = false; |
| 157 for (int id = 0; id < 255; ++id) { | 157 for (int id = 0; id < 255; ++id) { |
| 158 FcChar8* post_match_family; | 158 FcChar8* post_match_family; |
| 159 if (FcPatternGetString(match, FC_FAMILY, id, &post_match_family) != | 159 if (FcPatternGetString(match, FC_FAMILY, id, &post_match_family) != |
| 160 FcResultMatch) | 160 FcResultMatch) |
| 161 break; | 161 break; |
| 162 family_names_match = | 162 family_names_match = |
| 163 family.empty() ? | 163 family.empty() ? |
| 164 true : | 164 true : |
| 165 strcasecmp((char *)post_config_family, | 165 (strcasecmp((char *)post_config_family, |
| 166 (char *)post_match_family) == 0; | 166 (char *)post_match_family) == 0 || |
| 167 // Workaround for Issue 12530: |
| 168 // requested family: "Bitstream Vera Sans" |
| 169 // post_config_family: "Arial" |
| 170 // post_match_family: "Bitstream Vera Sans" |
| 171 // -> We should treat this case as a good match. |
| 172 strcasecmp(family.c_str(), |
| 173 (char *)post_match_family) == 0); |
| 167 if (family_names_match) | 174 if (family_names_match) |
| 168 break; | 175 break; |
| 169 } | 176 } |
| 170 if (!family.empty() && !family_names_match) { | 177 if (!family.empty() && !family_names_match) { |
| 171 FcPatternDestroy(pattern); | 178 FcPatternDestroy(pattern); |
| 172 FcFontSetDestroy(font_set); | 179 FcFontSetDestroy(font_set); |
| 173 return false; | 180 return false; |
| 174 } | 181 } |
| 175 } | 182 } |
| 176 | 183 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 250 |
| 244 int FontConfigDirect::Open(unsigned fileid) { | 251 int FontConfigDirect::Open(unsigned fileid) { |
| 245 SkAutoMutexAcquire ac(mutex_); | 252 SkAutoMutexAcquire ac(mutex_); |
| 246 const std::map<unsigned, std::string>::const_iterator | 253 const std::map<unsigned, std::string>::const_iterator |
| 247 i = fileid_to_filename_.find(fileid); | 254 i = fileid_to_filename_.find(fileid); |
| 248 if (i == fileid_to_filename_.end()) | 255 if (i == fileid_to_filename_.end()) |
| 249 return -1; | 256 return -1; |
| 250 | 257 |
| 251 return open(i->second.c_str(), O_RDONLY); | 258 return open(i->second.c_str(), O_RDONLY); |
| 252 } | 259 } |
| OLD | NEW |