Revert "Use DirectWrite for default font."

This reverts commit 375a953239.

Reason for revert: win7-rel bots failing on roll (didn't fail on CL).

Original change's description:
> 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>

TBR=bungeman@google.com,herb@google.com

Change-Id: I8cb94a37027dad340fef04751386e6df81945e7c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:969107, chromium:963636
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217943
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2019-06-03 21:01:00 +00:00 committed by Skia Commit-Bot
parent 081bf6667d
commit 30e918d915

View File

@ -1035,6 +1035,17 @@ HRESULT SkFontMgr_DirectWrite::getByFamilyName(const WCHAR wideFamilyName[],
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;
@ -1047,10 +1058,7 @@ sk_sp<SkTypeface> SkFontMgr_DirectWrite::onLegacyMakeTypeface(const char familyN
if (nullptr == fontFamily.get()) {
// No family with given name, try default.
sk_sp<SkTypeface> face(this->onMatchFamilyStyleCharacter(nullptr, style, nullptr, 0, 32));
if (face) {
return face;
}
this->getDefaultFontFamily(&fontFamily);
}
if (nullptr == fontFamily.get()) {