Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Unified Diff: src/ports/SkFontMgr_win_dw.cpp

Issue 1607083003: Allow custom font collection for DirectWrite font manager. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/ports/SkTypeface_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontMgr_win_dw.cpp
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index 585d809406a765454dbc85f3850b303c8ba05561..1bb5d996f9256e42653037e9d54efe56fdaf8832 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,14 @@ SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) {
}
}
- SkTScopedComPtr<IDWriteFontCollection> sysFontCollection;
- HRNM(factory->GetSystemFontCollection(&sysFontCollection, FALSE),
- "Could not get system font collection.");
+ SkTScopedComPtr<IDWriteFontCollection> fontCollection;
+ if (collection != nullptr) {
+ fontCollection.swap(SkTScopedComPtr<IDWriteFontCollection>(collection));
+ }
+ else {
+ HRNM(factory->GetSystemFontCollection(&fontCollection, FALSE),
+ "Could not get system font collection.");
+ }
bungeman-skia 2016/01/29 20:12:29 I would write this whole block as SkTScopedComPtr
Ilya Kulshin 2016/01/29 22:10:15 Done. While looking at it I also noticed that SkTS
WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH];
WCHAR* localeName = nullptr;
@@ -1095,7 +1101,7 @@ SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory) {
};
}
- return new SkFontMgr_DirectWrite(factory, sysFontCollection.get(), localeName, localeNameLen);
+ return new SkFontMgr_DirectWrite(factory, fontCollection.get(), localeName, localeNameLen);
}
#include "SkFontMgr_indirect.h"
« no previous file with comments | « include/ports/SkTypeface_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698