1 /* 2 * Copyright 2017 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 #include "include/core/SkTypes.h" 9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 10 11 #include "include/core/SkFontMgr.h" 12 #include "include/ports/SkFontMgr_mac_ct.h" 13 #include "src/ports/SkFontMgr_preview.h" 14 15 std::string SkFontMgr::runtimeOS = "OHOS"; 16 std::string containerFontPath = ""; 17 std::string fileName = "fontconfig.json"; 18 SK_API sk_sp<SkFontMgr> SkFontMgr_New_OHOS(const char *path); 19 Factory()20sk_sp<SkFontMgr> SkFontMgr::Factory() { 21 #if !defined(USE_DEFAULT_FONT) 22 if (SkFontMgr::runtimeOS == "OHOS") { 23 return SkFontMgr_New_OHOS(nullptr); 24 } 25 if (SkFontMgr::runtimeOS == "OHOS_Container") { 26 return SkFontMgr_New_OHOS((containerFontPath + fileName).c_str()); 27 } 28 #endif 29 return SkFontMgr_New_CoreText(nullptr); 30 } 31 32 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 33