| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |