DW last resort font default name not necessary.
authorBen Wagner <bungeman@google.com>
Wed, 8 Mar 2017 15:36:31 +0000 (10:36 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 8 Mar 2017 16:38:45 +0000 (16:38 +0000)
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>

src/ports/SkFontMgr_win_dw.cpp

index 6ccd7fc..f985c4f 100644 (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()) {