OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef SkFontMgr_android_DEFINED | 8 #ifndef SkFontMgr_android_DEFINED |
9 #define SkFontMgr_android_DEFINED | 9 #define SkFontMgr_android_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 | 12 |
13 class SkFontMgr; | 13 class SkFontMgr; |
14 | 14 |
| 15 /** |
| 16 * For test only -- this only affects the default factory. |
| 17 * Load font config from given xml files, instead of those from Android system. |
| 18 */ |
| 19 SK_API void SkUseTestFontConfigFile(const char* mainconf, const char* fallbackco
nf, |
| 20 const char* fontsdir); |
| 21 |
15 struct SkFontMgr_Android_CustomFonts { | 22 struct SkFontMgr_Android_CustomFonts { |
16 /** When specifying custom fonts, indicates how to use system fonts. */ | 23 /** When specifying custom fonts, indicates how to use system fonts. */ |
17 enum SystemFontUse { | 24 enum SystemFontUse { |
18 kOnlyCustom, /** Use only custom fonts. NDK compliant. */ | 25 kOnlyCustom, /** Use only custom fonts. NDK compliant. */ |
19 kPreferCustom, /** Use custom fonts before system fonts. */ | 26 kPreferCustom, /** Use custom fonts before system fonts. */ |
20 kPreferSystem /** Use system fonts before custom fonts. */ | 27 kPreferSystem /** Use system fonts before custom fonts. */ |
21 }; | 28 }; |
22 /** Whether or not to use system fonts. */ | 29 /** Whether or not to use system fonts. */ |
23 SystemFontUse fSystemFontUse; | 30 SystemFontUse fSystemFontUse; |
24 | 31 |
25 /** Base path to resolve relative font file names. If a directory, should en
d with '/'. */ | 32 /** Base path to resolve relative font file names. If a directory, should en
d with '/'. */ |
26 const char* fBasePath; | 33 const char* fBasePath; |
27 | 34 |
28 /** Optional custom configuration file to use. */ | 35 /** Optional custom configuration file to use. */ |
29 const char* fFontsXml; | 36 const char* fFontsXml; |
30 | 37 |
31 /** Optional custom configuration file for fonts which provide fallback. | 38 /** Optional custom configuration file for fonts which provide fallback. |
32 * In the new style (version > 21) fontsXml format is used, this should be
NULL. | 39 * In the new style (version > 21) fontsXml format is used, this should be
NULL. |
33 */ | 40 */ |
34 const char* fFallbackFontsXml; | 41 const char* fFallbackFontsXml; |
35 }; | 42 }; |
36 | 43 |
37 /** Create a font manager for Android. If 'custom' is NULL, use only system font
s. */ | 44 /** Create a font manager for Android. If 'custom' is NULL, use only system font
s. */ |
38 SK_API SkFontMgr* SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts* cus
tom); | 45 SK_API SkFontMgr* SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts* cus
tom); |
39 | 46 |
40 #endif // SkFontMgr_android_DEFINED | 47 #endif // SkFontMgr_android_DEFINED |
OLD | NEW |