DW last resort font default name not necessary.

Currently in SkFontMgr_DirectWrite when trying to find some last resort
font SystemParametersInfoW failing is considered a fatal error and so
onLegacyCreateTypeface will return nullptr. Instead, treat failure of
getDefaultFontFamily as ignorable and continue to the default default.

BUG=chromium:697672

Change-Id: I1ea018627487fbd39b1d0eebad4c798346d09c94
Reviewed-on: https://skia-review.googlesource.com/9408
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2017-03-08 10:36:31 -05:00 committed by Skia Commit-Bot
parent aa3af7b469
commit c0128d4683

View File

@ -938,10 +938,7 @@ HRESULT SkFontMgr_DirectWrite::getByFamilyName(const WCHAR wideFamilyName[],
HRESULT SkFontMgr_DirectWrite::getDefaultFontFamily(IDWriteFontFamily** fontFamily) const {
NONCLIENTMETRICSW metrics;
metrics.cbSize = sizeof(metrics);
if (0 == SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
sizeof(metrics),
&metrics,
0)) {
if (0 == SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0)) {
return E_UNEXPECTED;
}
HRM(this->getByFamilyName(metrics.lfMessageFont.lfFaceName, fontFamily),
@ -961,7 +958,7 @@ SkTypeface* SkFontMgr_DirectWrite::onLegacyCreateTypeface(const char familyName[
if (nullptr == fontFamily.get()) {
// No family with given name, try default.
HRNM(this->getDefaultFontFamily(&fontFamily), "Could not get default font family.");
this->getDefaultFontFamily(&fontFamily);
}
if (nullptr == fontFamily.get()) {