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 * 2021.9.9 SkFontMgr::Factory() on previewer of ohos. 7 * Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved. 8 * 2022.9.4 SkFontMgr::Factory() on previewer of ohos and container. 9 * Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 10 */ 11 12 #include "include/core/SkFontMgr.h" 13 #include "include/ports/SkTypeface_win.h" 14 #include "src/ports/SkFontMgr_preview.h" 15 16 std::string SkFontMgr::runtimeOS = "OHOS"; 17 SK_API sk_sp<SkFontMgr> SkFontMgr_New_OHOS(const char *path); 18 Factory()19sk_sp<SkFontMgr> SkFontMgr::Factory() 20 { 21 if (SkFontMgr::runtimeOS == "OHOS") { 22 return SkFontMgr_New_OHOS(nullptr); 23 } 24 if (SkFontMgr::runtimeOS == "OHOS_Container") { 25 return SkFontMgr_New_Preview(); 26 } 27 return SkFontMgr_New_DirectWrite(); 28 }