xref: /aosp_15_r20/external/skia/include/ports/SkFontMgr_android.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 
11 #include "include/core/SkRefCnt.h"
12 
13 #include <memory>
14 
15 class SkFontMgr;
16 class SkFontScanner;
17 
18 struct SkFontMgr_Android_CustomFonts {
19     /** When specifying custom fonts, indicates how to use system fonts. */
20     enum SystemFontUse {
21         kOnlyCustom, /** Use only custom fonts. NDK compliant. */
22         kPreferCustom, /** Use custom fonts before system fonts. */
23         kPreferSystem /** Use system fonts before custom fonts. */
24     };
25     /** Whether or not to use system fonts. */
26     SystemFontUse fSystemFontUse;
27 
28     /** Base path to resolve relative font file names. If a directory, should end with '/'. */
29     const char* fBasePath;
30 
31     /** Optional custom configuration file to use. */
32     const char* fFontsXml;
33 
34     /** Optional custom configuration file for fonts which provide fallback.
35      *  In the new style (version > 21) fontsXml format is used, this should be NULL.
36      */
37     const char* fFallbackFontsXml;
38 
39     /** Optional custom flag. If set to true the SkFontMgr will acquire all requisite
40      *  system IO resources on initialization.
41      */
42     bool fIsolated;
43 };
44 
45 /** Create a font manager for Android. If 'custom' is NULL, use only system fonts. */
46 
47 // Deprecated
48 SK_API sk_sp<SkFontMgr> SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts* custom);
49 
50 SK_API sk_sp<SkFontMgr> SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts* custom,
51                                               std::unique_ptr<SkFontScanner> scanner);
52 #endif // SkFontMgr_android_DEFINED
53