diff --git a/BUILD.gn b/BUILD.gn index 83bcc9cd5ce6c9a1640be020531f40c1f4b79779..d7bf3adbe8efd48774d0463579eeb1167bcd3f6e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -466,7 +466,6 @@ optional("fontmgr_custom_directory_factory") { enabled = skia_enable_fontmgr_custom_directory deps = [ ":fontmgr_custom_directory" ] sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ] - defines = [ "SK_BUILD_FONT_MGR_FOR_PREVIEW_LINUX" ] } optional("fontmgr_custom_embedded") { diff --git a/src/ports/SkFontMgr_custom_directory_factory.cpp b/src/ports/SkFontMgr_custom_directory_factory.cpp index 4bd403e2df42f58f86bd34295fe3522b1eb93f08..f76c030c649cf9b4a76df8ce12b9e15feedad40b 100644 --- a/src/ports/SkFontMgr_custom_directory_factory.cpp +++ b/src/ports/SkFontMgr_custom_directory_factory.cpp @@ -17,12 +17,16 @@ #endif #if defined(SK_BUILD_FONT_MGR_FOR_PREVIEW_LINUX) +#include "src/ports/SkFontMgr_preview.h" std::string SkFontMgr::runtimeOS = "OHOS"; -SK_API sk_sp SkFontMgr_New_OHOS(const char *path); +SK_API sk_sp SkFontMgr_New_OHOS2(const char *path); sk_sp SkFontMgr::Factory() { if (SkFontMgr::runtimeOS == "OHOS") { - return SkFontMgr_New_OHOS(nullptr); + return SkFontMgr_New_OHOS2(nullptr); + } + if (SkFontMgr::runtimeOS == "OHOS_Container") { + return SkFontMgr_New_Preview(); } return SkFontMgr_New_Custom_Directory(SK_FONT_FILE_PREFIX); } @@ -31,4 +35,4 @@ sk_sp SkFontMgr::Factory() { return SkFontMgr_New_Custom_Directory(SK_FONT_FILE_PREFIX); } -#endif +#endif \ No newline at end of file