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 #include "include/core/SkFontMgr.h" 9 #include "include/ports/SkFontMgr_directory.h" 10 11 #ifndef SK_FONT_FILE_PREFIX 12 # if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 13 # define SK_FONT_FILE_PREFIX "/System/Library/Fonts/" 14 # else 15 # define SK_FONT_FILE_PREFIX "/usr/share/fonts/" 16 # endif 17 #endif 18 19 #if defined(SK_BUILD_FONT_MGR_FOR_PREVIEW_LINUX) 20 std::string SkFontMgr::containerFontPath = ""; 21 std::string SkFontMgr::runtimeOS = "OHOS"; 22 SK_API sk_sp<SkFontMgr> SkFontMgr_New_OHOS(const char *path); Factory()23sk_sp<SkFontMgr> SkFontMgr::Factory() 24 { 25 if (SkFontMgr::runtimeOS == "OHOS") { 26 return SkFontMgr_New_OHOS(nullptr); 27 } 28 return SkFontMgr_New_Custom_Directory(SK_FONT_FILE_PREFIX); 29 } 30 #else Factory()31sk_sp<SkFontMgr> SkFontMgr::Factory() 32 { 33 return SkFontMgr_New_Custom_Directory(SK_FONT_FILE_PREFIX); 34 } 35 #endif 36