From 31d717085eb717a307b1693ed4b006d13f238e31 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sat, 13 Apr 2013 18:58:24 +0300 Subject: [PATCH] Gfx: Fix mistakes in b737352 --- Common/Gfx/Util/DWriteHelpers.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Common/Gfx/Util/DWriteHelpers.cpp b/Common/Gfx/Util/DWriteHelpers.cpp index dd250bf6..dee4247b 100644 --- a/Common/Gfx/Util/DWriteHelpers.cpp +++ b/Common/Gfx/Util/DWriteHelpers.cpp @@ -30,11 +30,11 @@ HRESULT GetDWritePropertiesFromGDIProperties( IDWriteFont* dwriteFont = CreateDWriteFontFromGDIFamilyName(factory, gdiFamilyName); if (dwriteFont) { - if (GetFamilyNameFromDWriteFont(dwriteFont, dwriteFamilyName, dwriteFamilyNameSize)) + hr = GetFamilyNameFromDWriteFont(dwriteFont, dwriteFamilyName, dwriteFamilyNameSize); + if (SUCCEEDED(hr)) { GetPropertiesFromDWriteFont( dwriteFont, gdiBold, gdiItalic, &dwriteFontWeight, &dwriteFontStyle, &dwriteFontStretch); - hr = S_OK; } dwriteFont->Release(); @@ -109,7 +109,7 @@ HRESULT GetFamilyNameFromDWriteFont(IDWriteFont* font, WCHAR* buffer, const UINT HRESULT hr = font->GetFontFamily(&dwriteFontFamily); if (SUCCEEDED(hr)) { - GetFamilyNameFromDWriteFontFamily(dwriteFontFamily, buffer, bufferSize); + hr = GetFamilyNameFromDWriteFontFamily(dwriteFontFamily, buffer, bufferSize); dwriteFontFamily->Release(); } @@ -155,7 +155,6 @@ bool IsFamilyInSystemFontCollection(IDWriteFactory* factory, const WCHAR* family HRESULT GetGDIFamilyNameFromDWriteFont(IDWriteFont* font, WCHAR* buffer, UINT bufferSize) { - bool result = false; IDWriteLocalizedStrings* strings; BOOL stringsExist; HRESULT hr = font->GetInformationalStrings( @@ -163,13 +162,9 @@ HRESULT GetGDIFamilyNameFromDWriteFont(IDWriteFont* font, WCHAR* buffer, UINT bu if (SUCCEEDED(hr) && stringsExist) { hr = strings->GetString(0, buffer, bufferSize); - if (SUCCEEDED(hr)) - { - result = true; - } } - return result; + return hr; } IDWriteFont* FindDWriteFontInFontFamilyByGDIFamilyName( @@ -183,8 +178,8 @@ IDWriteFont* FindDWriteFontInFontFamilyByGDIFamilyName( if (SUCCEEDED(hr)) { WCHAR buffer[LF_FACESIZE]; - if (GetGDIFamilyNameFromDWriteFont(font, buffer, _countof(buffer)) && - _wcsicmp(gdiFamilyName, buffer) == 0) + hr = GetGDIFamilyNameFromDWriteFont(font, buffer, _countof(buffer)); + if (SUCCEEDED(hr) && _wcsicmp(gdiFamilyName, buffer) == 0) { return font; }