From c0128d4683d033f5250c35a22e1f857561b22a4b Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Wed, 8 Mar 2017 10:36:31 -0500 Subject: [PATCH] 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 Reviewed-by: Mike Reed Commit-Queue: Ben Wagner --- src/ports/SkFontMgr_win_dw.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp index 6ccd7fc99e..f985c4f245 100644 --- a/src/ports/SkFontMgr_win_dw.cpp +++ b/src/ports/SkFontMgr_win_dw.cpp @@ -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()) {