| Index: src/ports/SkFontMgr_win_dw.cpp
|
| diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
|
| index ef09210e38de9669ddb141101ee0a52af9fe4380..11afec3b53623205dad6612ab7cc0057c958181e 100644
|
| --- a/src/ports/SkFontMgr_win_dw.cpp
|
| +++ b/src/ports/SkFontMgr_win_dw.cpp
|
| @@ -1067,7 +1067,8 @@ SkTypeface* SkFontStyleSet_DirectWrite::matchStyle(const SkFontStyle& pattern) {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| #include "SkTypeface_win.h"
|
|
|
| -SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) {
|
| +SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory,
|
| + IDWriteFontCollection* collection) {
|
| if (nullptr == factory) {
|
| factory = sk_get_dwrite_factory();
|
| if (nullptr == factory) {
|
| @@ -1075,9 +1076,12 @@ SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) {
|
| }
|
| }
|
|
|
| - SkTScopedComPtr<IDWriteFontCollection> sysFontCollection;
|
| - HRNM(factory->GetSystemFontCollection(&sysFontCollection, FALSE),
|
| - "Could not get system font collection.");
|
| + SkTScopedComPtr<IDWriteFontCollection> systemFontCollection;
|
| + if (nullptr == collection) {
|
| + HRNM(factory->GetSystemFontCollection(&systemFontCollection, FALSE),
|
| + "Could not get system font collection.");
|
| + collection = systemFontCollection.get();
|
| + }
|
|
|
| WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH];
|
| WCHAR* localeName = nullptr;
|
| @@ -1095,7 +1099,7 @@ SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) {
|
| };
|
| }
|
|
|
| - return new SkFontMgr_DirectWrite(factory, sysFontCollection.get(), localeName, localeNameLen);
|
| + return new SkFontMgr_DirectWrite(factory, collection, localeName, localeNameLen);
|
| }
|
|
|
| #include "SkFontMgr_indirect.h"
|
|
|