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