| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The Android Open Source Project | 2 * Copyright 2011 The Android Open Source Project |
| 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 // Despite the name and location, this is portable code. | 8 // Despite the name and location, this is portable code. |
| 9 | 9 |
| 10 #include "SkFontMgr_android_parser.h" | 10 #include "SkFontMgr_android_parser.h" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 * In some versions of Android prior to Android 4.2 (JellyBean MR1 at API | 656 * In some versions of Android prior to Android 4.2 (JellyBean MR1 at API |
| 657 * Level 17) the fallback fonts for certain locales were encoded in their own | 657 * Level 17) the fallback fonts for certain locales were encoded in their own |
| 658 * XML files with a suffix that identified the locale. We search the provided | 658 * XML files with a suffix that identified the locale. We search the provided |
| 659 * directory for those files,add all of their entries to the fallback chain, and | 659 * directory for those files,add all of their entries to the fallback chain, and |
| 660 * include the locale as part of each entry. | 660 * include the locale as part of each entry. |
| 661 */ | 661 */ |
| 662 static void append_fallback_font_families_for_locale(SkTDArray<FontFamily*>& fal
lbackFonts, | 662 static void append_fallback_font_families_for_locale(SkTDArray<FontFamily*>& fal
lbackFonts, |
| 663 const char* dir, | 663 const char* dir, |
| 664 const SkString& basePath) | 664 const SkString& basePath) |
| 665 { | 665 { |
| 666 #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) | |
| 667 // The framework is beyond Android 4.2 and can therefore skip this function | |
| 668 return; | |
| 669 #endif | |
| 670 | |
| 671 SkAutoTCallIProc<DIR, closedir> fontDirectory(opendir(dir)); | 666 SkAutoTCallIProc<DIR, closedir> fontDirectory(opendir(dir)); |
| 672 if (nullptr == fontDirectory) { | 667 if (nullptr == fontDirectory) { |
| 673 return; | 668 return; |
| 674 } | 669 } |
| 675 | 670 |
| 676 for (struct dirent* dirEntry; (dirEntry = readdir(fontDirectory));) { | 671 for (struct dirent* dirEntry; (dirEntry = readdir(fontDirectory));) { |
| 677 // The size of the prefix and suffix. | 672 // The size of the prefix and suffix. |
| 678 static const size_t fixedLen = sizeof(LOCALE_FALLBACK_FONTS_PREFIX) - 1 | 673 static const size_t fixedLen = sizeof(LOCALE_FALLBACK_FONTS_PREFIX) - 1 |
| 679 + sizeof(LOCALE_FALLBACK_FONTS_SUFFIX) - 1; | 674 + sizeof(LOCALE_FALLBACK_FONTS_SUFFIX) - 1; |
| 680 | 675 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 const char* tag = fTag.c_str(); | 783 const char* tag = fTag.c_str(); |
| 789 | 784 |
| 790 // strip off the rightmost "-.*" | 785 // strip off the rightmost "-.*" |
| 791 const char* parentTagEnd = strrchr(tag, '-'); | 786 const char* parentTagEnd = strrchr(tag, '-'); |
| 792 if (parentTagEnd == nullptr) { | 787 if (parentTagEnd == nullptr) { |
| 793 return SkLanguage(); | 788 return SkLanguage(); |
| 794 } | 789 } |
| 795 size_t parentTagLen = parentTagEnd - tag; | 790 size_t parentTagLen = parentTagEnd - tag; |
| 796 return SkLanguage(tag, parentTagLen); | 791 return SkLanguage(tag, parentTagLen); |
| 797 } | 792 } |
| OLD | NEW |