| OLD | NEW |
| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 PMINCHO, | 165 PMINCHO, |
| 166 MINCHO, | 166 MINCHO, |
| 167 SIMSUN, | 167 SIMSUN, |
| 168 NSIMSUN, | 168 NSIMSUN, |
| 169 SIMHEI, | 169 SIMHEI, |
| 170 PMINGLIU, | 170 PMINGLIU, |
| 171 MINGLIU, | 171 MINGLIU, |
| 172 PMINGLIUHK, | 172 PMINGLIUHK, |
| 173 MINGLIUHK, | 173 MINGLIUHK, |
| 174 CAMBRIA, | 174 CAMBRIA, |
| 175 CALIBRI, |
| 175 }; | 176 }; |
| 176 | 177 |
| 177 // Match the font name against a whilelist of fonts, returning the equivalence | 178 // Match the font name against a whilelist of fonts, returning the equivalence |
| 178 // class. | 179 // class. |
| 179 FontEquivClass GetFontEquivClass(const char* fontname) | 180 FontEquivClass GetFontEquivClass(const char* fontname) |
| 180 { | 181 { |
| 181 // It would be nice for fontconfig to tell us whether a given suggested | 182 // It would be nice for fontconfig to tell us whether a given suggested |
| 182 // replacement is a "strong" match (that is, an equivalent font) or | 183 // replacement is a "strong" match (that is, an equivalent font) or |
| 183 // a "weak" match (that is, fontconfig's next-best attempt at finding a | 184 // a "weak" match (that is, fontconfig's next-best attempt at finding a |
| 184 // substitute). However, I played around with the fontconfig API for | 185 // substitute). However, I played around with the fontconfig API for |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 { PMINGLIUHK, "MSung B5HK"}, | 278 { PMINGLIUHK, "MSung B5HK"}, |
| 278 | 279 |
| 279 // 細明體 | 280 // 細明體 |
| 280 { MINGLIUHK, "MingLiU_HKSCS"}, | 281 { MINGLIUHK, "MingLiU_HKSCS"}, |
| 281 { MINGLIUHK, "\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94_HKSCS" }, | 282 { MINGLIUHK, "\xe7\xb4\xb0\xe6\x98\x8e\xe9\xab\x94_HKSCS" }, |
| 282 { MINGLIUHK, "MSung B5HK"}, | 283 { MINGLIUHK, "MSung B5HK"}, |
| 283 | 284 |
| 284 // Cambria | 285 // Cambria |
| 285 { CAMBRIA, "Cambria" }, | 286 { CAMBRIA, "Cambria" }, |
| 286 { CAMBRIA, "Caladea" }, | 287 { CAMBRIA, "Caladea" }, |
| 288 |
| 289 // Calibri |
| 290 { CALIBRI, "Calibri" }, |
| 291 { CALIBRI, "Carlito" }, |
| 287 }; | 292 }; |
| 288 | 293 |
| 289 static const size_t kFontCount = | 294 static const size_t kFontCount = |
| 290 sizeof(kFontEquivMap)/sizeof(kFontEquivMap[0]); | 295 sizeof(kFontEquivMap)/sizeof(kFontEquivMap[0]); |
| 291 | 296 |
| 292 // TODO(jungshik): If this loop turns out to be hot, turn | 297 // TODO(jungshik): If this loop turns out to be hot, turn |
| 293 // the array to a static (hash)map to speed it up. | 298 // the array to a static (hash)map to speed it up. |
| 294 for (size_t i = 0; i < kFontCount; ++i) { | 299 for (size_t i = 0; i < kFontCount; ++i) { |
| 295 if (strcasecmp(kFontEquivMap[i].name, fontname) == 0) | 300 if (strcasecmp(kFontEquivMap[i].name, fontname) == 0) |
| 296 return kFontEquivMap[i].clazz; | 301 return kFontEquivMap[i].clazz; |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 *trimmedMatches.append() = match[i]; | 722 *trimmedMatches.append() = match[i]; |
| 718 } | 723 } |
| 719 } | 724 } |
| 720 | 725 |
| 721 SkFontStyleSet_FC* sset = SkNEW_ARGS(SkFontStyleSet_FC, | 726 SkFontStyleSet_FC* sset = SkNEW_ARGS(SkFontStyleSet_FC, |
| 722 (trimmedMatches.begin(), | 727 (trimmedMatches.begin(), |
| 723 trimmedMatches.count())); | 728 trimmedMatches.count())); |
| 724 #endif | 729 #endif |
| 725 return false; | 730 return false; |
| 726 } | 731 } |
| OLD | NEW |