Use DirectWrite for default font.
This avoids the problematic use of SystemParametersInfoW.
Bug: chromium:969107,chromium:963636
Change-Id: I78662deb5bc90502fd070da75b7f2cfdc7968941
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217857
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index f7bce89..ab5f54a 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -1035,17 +1035,6 @@
return S_OK;
}
-HRESULT SkFontMgr_DirectWrite::getDefaultFontFamily(IDWriteFontFamily** fontFamily) const {
- NONCLIENTMETRICSW metrics;
- metrics.cbSize = sizeof(metrics);
- if (0 == SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0)) {
- return E_UNEXPECTED;
- }
- HRM(this->getByFamilyName(metrics.lfMessageFont.lfFaceName, fontFamily),
- "Could not create DWrite font family from LOGFONT.");
- return S_OK;
-}
-
sk_sp<SkTypeface> SkFontMgr_DirectWrite::onLegacyMakeTypeface(const char familyName[],
SkFontStyle style) const {
SkTScopedComPtr<IDWriteFontFamily> fontFamily;
@@ -1058,7 +1047,10 @@
if (nullptr == fontFamily.get()) {
// No family with given name, try default.
- this->getDefaultFontFamily(&fontFamily);
+ sk_sp<SkTypeface> face(this->onMatchFamilyStyleCharacter(nullptr, style, nullptr, 0, 32));
+ if (face) {
+ return face;
+ }
}
if (nullptr == fontFamily.get()) {