diff -ur skia.org/include/ports/SkFontMgr_fontconfig.h skia/include/ports/SkFontMgr_fontconfig.h --- skia.org/include/ports/SkFontMgr_fontconfig.h 2024-10-09 10:25:16.421928663 +0200 +++ skia/include/ports/SkFontMgr_fontconfig.h 2024-10-09 10:27:17.914640682 +0200 @@ -19,4 +19,9 @@ */ SK_API sk_sp SkFontMgr_New_FontConfig(FcConfig* fc); +struct _FcPattern; +typedef struct _FcPattern FcPattern; +class SkTypeface; +SK_API sk_sp SkFontMgr_createTypefaceFromFcPattern(const sk_sp& mgr, FcPattern* pattern); + #endif // #ifndef SkFontMgr_fontconfig_DEFINED diff -ur skia.org/src/ports/SkFontMgr_fontconfig.cpp skia/src/ports/SkFontMgr_fontconfig.cpp --- skia.org/src/ports/SkFontMgr_fontconfig.cpp 2024-10-09 10:25:16.460928891 +0200 +++ skia/src/ports/SkFontMgr_fontconfig.cpp 2024-10-09 10:27:30.405714112 +0200 @@ -660,6 +660,7 @@ /** Creates a typeface using a typeface cache. * @param pattern a complete pattern from FcFontRenderPrepare. */ +public: sk_sp createTypefaceFromFcPattern(SkAutoFcPattern pattern) const { if (!pattern) { return nullptr; @@ -966,6 +967,16 @@ } }; -sk_sp SkFontMgr_New_FontConfig(FcConfig* fc) { +SK_API sk_sp SkFontMgr_New_FontConfig(FcConfig* fc) { return sk_make_sp(fc); } + +SK_API sk_sp SkFontMgr_createTypefaceFromFcPattern(const sk_sp& mgr, FcPattern* pattern) +{ + SkAutoFcPattern p([pattern]() { + FCLocker lock; + FcPatternReference(pattern); + return pattern; + }()); + return static_cast(mgr.get())->createTypefaceFromFcPattern(std::move(p)); +} Only in skia/src/ports: SkFontMgr_fontconfig.cpp.orig