mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Gfx: Fix mistakes in b737352
This commit is contained in:
parent
1fd382d192
commit
31d717085e
@ -30,11 +30,11 @@ HRESULT GetDWritePropertiesFromGDIProperties(
|
|||||||
IDWriteFont* dwriteFont = CreateDWriteFontFromGDIFamilyName(factory, gdiFamilyName);
|
IDWriteFont* dwriteFont = CreateDWriteFontFromGDIFamilyName(factory, gdiFamilyName);
|
||||||
if (dwriteFont)
|
if (dwriteFont)
|
||||||
{
|
{
|
||||||
if (GetFamilyNameFromDWriteFont(dwriteFont, dwriteFamilyName, dwriteFamilyNameSize))
|
hr = GetFamilyNameFromDWriteFont(dwriteFont, dwriteFamilyName, dwriteFamilyNameSize);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
GetPropertiesFromDWriteFont(
|
GetPropertiesFromDWriteFont(
|
||||||
dwriteFont, gdiBold, gdiItalic, &dwriteFontWeight, &dwriteFontStyle, &dwriteFontStretch);
|
dwriteFont, gdiBold, gdiItalic, &dwriteFontWeight, &dwriteFontStyle, &dwriteFontStretch);
|
||||||
hr = S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dwriteFont->Release();
|
dwriteFont->Release();
|
||||||
@ -109,7 +109,7 @@ HRESULT GetFamilyNameFromDWriteFont(IDWriteFont* font, WCHAR* buffer, const UINT
|
|||||||
HRESULT hr = font->GetFontFamily(&dwriteFontFamily);
|
HRESULT hr = font->GetFontFamily(&dwriteFontFamily);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
GetFamilyNameFromDWriteFontFamily(dwriteFontFamily, buffer, bufferSize);
|
hr = GetFamilyNameFromDWriteFontFamily(dwriteFontFamily, buffer, bufferSize);
|
||||||
dwriteFontFamily->Release();
|
dwriteFontFamily->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,6 @@ bool IsFamilyInSystemFontCollection(IDWriteFactory* factory, const WCHAR* family
|
|||||||
|
|
||||||
HRESULT GetGDIFamilyNameFromDWriteFont(IDWriteFont* font, WCHAR* buffer, UINT bufferSize)
|
HRESULT GetGDIFamilyNameFromDWriteFont(IDWriteFont* font, WCHAR* buffer, UINT bufferSize)
|
||||||
{
|
{
|
||||||
bool result = false;
|
|
||||||
IDWriteLocalizedStrings* strings;
|
IDWriteLocalizedStrings* strings;
|
||||||
BOOL stringsExist;
|
BOOL stringsExist;
|
||||||
HRESULT hr = font->GetInformationalStrings(
|
HRESULT hr = font->GetInformationalStrings(
|
||||||
@ -163,13 +162,9 @@ HRESULT GetGDIFamilyNameFromDWriteFont(IDWriteFont* font, WCHAR* buffer, UINT bu
|
|||||||
if (SUCCEEDED(hr) && stringsExist)
|
if (SUCCEEDED(hr) && stringsExist)
|
||||||
{
|
{
|
||||||
hr = strings->GetString(0, buffer, bufferSize);
|
hr = strings->GetString(0, buffer, bufferSize);
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
IDWriteFont* FindDWriteFontInFontFamilyByGDIFamilyName(
|
IDWriteFont* FindDWriteFontInFontFamilyByGDIFamilyName(
|
||||||
@ -183,8 +178,8 @@ IDWriteFont* FindDWriteFontInFontFamilyByGDIFamilyName(
|
|||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
WCHAR buffer[LF_FACESIZE];
|
WCHAR buffer[LF_FACESIZE];
|
||||||
if (GetGDIFamilyNameFromDWriteFont(font, buffer, _countof(buffer)) &&
|
hr = GetGDIFamilyNameFromDWriteFont(font, buffer, _countof(buffer));
|
||||||
_wcsicmp(gdiFamilyName, buffer) == 0)
|
if (SUCCEEDED(hr) && _wcsicmp(gdiFamilyName, buffer) == 0)
|
||||||
{
|
{
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user