From dac6d4b03951bcf2b6a2b26ec676b37c4d259628 Mon Sep 17 00:00:00 2001 From: zhaona45 Date: Wed, 3 Sep 2025 16:10:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dsvg=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaona45 --- m133/include/core/SkFontMgr.h | 2 +- m133/modules/svg/BUILD.gn | 20 +++++++++++++++++++ m133/modules/svg/include/SkSVGRenderContext.h | 2 +- m133/modules/svg/src/SkSVGDOM.cpp | 3 ++- m133/src/core/SkFontMgr.cpp | 2 -- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/m133/include/core/SkFontMgr.h b/m133/include/core/SkFontMgr.h index d247c9f723..c3dec6def6 100644 --- a/m133/include/core/SkFontMgr.h +++ b/m133/include/core/SkFontMgr.h @@ -149,10 +149,10 @@ public: } std::vector> getSystemFonts(); +#endif /** Return the default fontmgr. */ static sk_sp RefDefault(); -#endif /* Returns an empty font manager without any typeface dependencies */ static sk_sp RefEmpty(); diff --git a/m133/modules/svg/BUILD.gn b/m133/modules/svg/BUILD.gn index 004f7406df..ea1a306546 100644 --- a/m133/modules/svg/BUILD.gn +++ b/m133/modules/svg/BUILD.gn @@ -18,6 +18,25 @@ if (skia_enable_svg && skia_use_expat) { ] } + config("svg_private_config") { + defines = [] + if (skia_use_harfbuzz) { + defines += [ "SK_SHAPER_HARFBUZZ_AVAILABLE" ] + } + if (skia_enable_skunicode) { + defines += [ "SK_SHAPER_UNICODE_AVAILABLE" ] + } + if (skia_use_libgrapheme) { + defines += [ "SK_UNICODE_LIBGRAPHEME_IMPLEMENTATION" ] + } + if (skia_use_icu4x) { + defines += [ "SK_UNICODE_ICU4X_IMPLEMENTATION" ] + } + if (skia_use_icu) { + defines += [ "SK_UNICODE_ICU_IMPLEMENTATION" ] + } + } + ohos_source_set("svg") { check_includes = false import("svg.gni") @@ -27,6 +46,7 @@ if (skia_enable_svg && skia_use_expat) { configs = [ "../../:skia_private" ] if (use_oh_skia) { configs += [ "../../:skia_wno" ] + configs += [ ":svg_private_config" ] } } diff --git a/m133/modules/svg/include/SkSVGRenderContext.h b/m133/modules/svg/include/SkSVGRenderContext.h index b6bc5d5fac..ddc23acfe7 100644 --- a/m133/modules/svg/include/SkSVGRenderContext.h +++ b/m133/modules/svg/include/SkSVGRenderContext.h @@ -163,7 +163,7 @@ public: // It is probably an oversight to try to render without having set the SkFontMgr. // We will assert this in debug mode, but fallback to an empty fontmgr in release builds. SkASSERT(fFontMgr); - return fFontMgr ? fFontMgr : SkFontMgr::RefEmpty(); + return fFontMgr ? fFontMgr : SkFontMgr::RefDefault(); } // Returns the translate/scale transformation required to map into the current OBB scope, diff --git a/m133/modules/svg/src/SkSVGDOM.cpp b/m133/modules/svg/src/SkSVGDOM.cpp index 8c66f7e4e8..465bcab899 100644 --- a/m133/modules/svg/src/SkSVGDOM.cpp +++ b/m133/modules/svg/src/SkSVGDOM.cpp @@ -13,6 +13,7 @@ #include "include/private/base/SkAssert.h" #include "include/private/base/SkTo.h" #include "modules/skshaper/include/SkShaper_factory.h" +#include "modules/skshaper/utils/FactoryHelpers.h" #include "modules/svg/include/SkSVGAttribute.h" #include "modules/svg/include/SkSVGAttributeParser.h" #include "modules/svg/include/SkSVGCircle.h" @@ -442,7 +443,7 @@ sk_sp SkSVGDOM::Builder::make(SkStream& str) const { auto resource_provider = fResourceProvider ? fResourceProvider : sk_make_sp(); - auto factory = fTextShapingFactory ? fTextShapingFactory : SkShapers::Primitive::Factory(); + auto factory = fTextShapingFactory ? fTextShapingFactory : SkShapers::BestAvailable(); return sk_sp(new SkSVGDOM(sk_sp(static_cast(root.release())), std::move(fFontMgr), diff --git a/m133/src/core/SkFontMgr.cpp b/m133/src/core/SkFontMgr.cpp index 8b49a44f84..20b9f722a2 100644 --- a/m133/src/core/SkFontMgr.cpp +++ b/m133/src/core/SkFontMgr.cpp @@ -170,7 +170,6 @@ sk_sp SkFontMgr::RefEmpty() { return singleton; } -#ifdef ENABLE_TEXT_ENHANCE // A global function pointer that's not declared, but can be overriden at startup by test tools. sk_sp (*gSkFontMgr_DefaultFactory)() = nullptr; @@ -185,7 +184,6 @@ sk_sp SkFontMgr::RefDefault() { }); return singleton; } -#endif /** * Width has the greatest priority. -- Gitee