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