OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "SkFontConfigParser_android.h" | 8 #include "SkFontConfigParser_android.h" |
9 #include "SkFontDescriptor.h" | 9 #include "SkFontDescriptor.h" |
10 #include "SkFontHost_FreeType_common.h" | 10 #include "SkFontHost_FreeType_common.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 static SkTypeface_AndroidSystem* find_family_style_character( | 347 static SkTypeface_AndroidSystem* find_family_style_character( |
348 const SkTDArray<NameToFamily>& fallbackNameToFamilyMap, | 348 const SkTDArray<NameToFamily>& fallbackNameToFamilyMap, |
349 const SkFontStyle& style, bool elegant, | 349 const SkFontStyle& style, bool elegant, |
350 const SkString& langTag, SkUnichar character) | 350 const SkString& langTag, SkUnichar character) |
351 { | 351 { |
352 for (int i = 0; i < fallbackNameToFamilyMap.count(); ++i) { | 352 for (int i = 0; i < fallbackNameToFamilyMap.count(); ++i) { |
353 SkFontStyleSet_Android* family = fallbackNameToFamilyMap[i].styleSet; | 353 SkFontStyleSet_Android* family = fallbackNameToFamilyMap[i].styleSet; |
354 SkAutoTUnref<SkTypeface_AndroidSystem> face(family->matchStyle(style)); | 354 SkAutoTUnref<SkTypeface_AndroidSystem> face(family->matchStyle(style)); |
355 | 355 |
356 if (!langTag.isEmpty() && langTag != face->fLang.getTag()) { | 356 if (!langTag.isEmpty() && !face->fLang.getTag().startsWith(langTag.c_str
())) { |
357 continue; | 357 continue; |
358 } | 358 } |
359 | 359 |
360 if (SkToBool(face->fVariantStyle & kElegant_FontVariant) != elegant) { | 360 if (SkToBool(face->fVariantStyle & kElegant_FontVariant) != elegant) { |
361 continue; | 361 continue; |
362 } | 362 } |
363 | 363 |
364 SkPaint paint; | 364 SkPaint paint; |
365 paint.setTypeface(face); | 365 paint.setTypeface(face); |
366 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); | 366 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 SkDEBUGF(("Use Test Config File Main %s, Fallback %s, Font Dir %s", | 552 SkDEBUGF(("Use Test Config File Main %s, Fallback %s, Font Dir %s", |
553 gTestMainConfigFile, gTestFallbackConfigFile, gTestFontFilePrefix)
); | 553 gTestMainConfigFile, gTestFallbackConfigFile, gTestFontFilePrefix)
); |
554 } | 554 } |
555 | 555 |
556 void SkGetTestFontConfiguration(const char** mainconf, const char** fallbackconf
, | 556 void SkGetTestFontConfiguration(const char** mainconf, const char** fallbackconf
, |
557 const char** fontsdir) { | 557 const char** fontsdir) { |
558 *mainconf = gTestMainConfigFile; | 558 *mainconf = gTestMainConfigFile; |
559 *fallbackconf = gTestFallbackConfigFile; | 559 *fallbackconf = gTestFallbackConfigFile; |
560 *fontsdir = gTestFontFilePrefix; | 560 *fontsdir = gTestFontFilePrefix; |
561 } | 561 } |
OLD | NEW |