bungeman | 7fa87cd | 2015-02-06 07:59:19 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkFontMgr_android_DEFINED |
| 9 | #define SkFontMgr_android_DEFINED |
| 10 | |
Hal Canary | 6b20a55 | 2017-02-07 14:09:38 -0500 | [diff] [blame] | 11 | #include "SkRefCnt.h" |
bungeman | 7fa87cd | 2015-02-06 07:59:19 -0800 | [diff] [blame] | 12 | |
| 13 | class SkFontMgr; |
| 14 | |
bungeman | 7fa87cd | 2015-02-06 07:59:19 -0800 | [diff] [blame] | 15 | struct SkFontMgr_Android_CustomFonts { |
| 16 | /** When specifying custom fonts, indicates how to use system fonts. */ |
| 17 | enum SystemFontUse { |
| 18 | kOnlyCustom, /** Use only custom fonts. NDK compliant. */ |
| 19 | kPreferCustom, /** Use custom fonts before system fonts. */ |
| 20 | kPreferSystem /** Use system fonts before custom fonts. */ |
| 21 | }; |
| 22 | /** Whether or not to use system fonts. */ |
| 23 | SystemFontUse fSystemFontUse; |
| 24 | |
| 25 | /** Base path to resolve relative font file names. If a directory, should end with '/'. */ |
| 26 | const char* fBasePath; |
| 27 | |
| 28 | /** Optional custom configuration file to use. */ |
| 29 | const char* fFontsXml; |
| 30 | |
| 31 | /** Optional custom configuration file for fonts which provide fallback. |
| 32 | * In the new style (version > 21) fontsXml format is used, this should be NULL. |
| 33 | */ |
| 34 | const char* fFallbackFontsXml; |
khushalsagar | ebc465b | 2016-02-12 12:42:48 -0800 | [diff] [blame] | 35 | |
| 36 | /** Optional custom flag. If set to true the SkFontMgr will acquire all requisite |
| 37 | * system IO resources on initialization. |
| 38 | */ |
| 39 | bool fIsolated; |
bungeman | 7fa87cd | 2015-02-06 07:59:19 -0800 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | /** Create a font manager for Android. If 'custom' is NULL, use only system fonts. */ |
Ben Wagner | 3546ff1 | 2017-01-03 13:32:36 -0500 | [diff] [blame] | 43 | SK_API sk_sp<SkFontMgr> SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts* custom); |
bungeman | 7fa87cd | 2015-02-06 07:59:19 -0800 | [diff] [blame] | 44 | |
| 45 | #endif // SkFontMgr_android_DEFINED |