1 --- ./include/ports/SkTypeface_win.h
2 +++ ./include/ports/SkTypeface_win.h
3 @@ -75,5 +75,13 @@ SK_API sk_sp<SkFontMgr> SkFontMgr_New_DirectWriteRenderer(sk_sp<SkRemotableFontM
5 SK_API sk_sp<SkRemotableFontMgr> SkRemotableFontMgr_New_DirectWrite();
7 +struct IDWriteFontFace;
9 +struct IDWriteFontFamily;
10 +SK_API SkTypeface* SkCreateTypefaceDirectWrite(sk_sp<SkFontMgr> fontMgr,
11 + IDWriteFontFace* fontFace,
13 + IDWriteFontFamily* fontFamily);
15 #endif // SK_BUILD_FOR_WIN
16 #endif // SkTypeface_win_DEFINED
17 --- ./src/ports/SkFontMgr_win_dw.cpp
18 +++ ./src/ports/SkFontMgr_win_dw.cpp
19 @@ -320,6 +320,10 @@ private:
21 friend class SkFontStyleSet_DirectWrite;
22 friend class FontFallbackRenderer;
23 + friend SK_API SkTypeface* SkCreateTypefaceDirectWrite(sk_sp<SkFontMgr> fontMgr,
24 + IDWriteFontFace* fontFace,
26 + IDWriteFontFamily* fontFamily);
29 class SkFontStyleSet_DirectWrite : public SkFontStyleSet {
30 @@ -1215,6 +1219,18 @@ SK_API sk_sp<SkFontMgr> SkFontMgr_New_DirectWrite(IDWriteFactory* factory,
31 defaultFamilyName, defaultFamilyNameLen);
34 +SkTypeface* SkCreateTypefaceDirectWrite(sk_sp<SkFontMgr> fontMgr,
35 + IDWriteFontFace* fontFace,
37 + IDWriteFontFamily* fontFamily)
39 + SkFontMgr_DirectWrite* mgr = dynamic_cast<SkFontMgr_DirectWrite*>(fontMgr.get());
42 + sk_sp<SkTypeface> typeface = mgr->makeTypefaceFromDWriteFont(fontFace, font, fontFamily);
43 + return typeface.release();
46 #include "include/ports/SkFontMgr_indirect.h"
47 SK_API sk_sp<SkFontMgr> SkFontMgr_New_DirectWriteRenderer(sk_sp<SkRemotableFontMgr> proxy) {
48 sk_sp<SkFontMgr> impl(SkFontMgr_New_DirectWrite());