mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Gfx: Minor fixes
This commit is contained in:
parent
e10cdd2a86
commit
0f6f6d48e5
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "DWriteHelpers.h"
|
#include "DWriteHelpers.h"
|
||||||
|
#include <wrl/client.h>
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
namespace Util {
|
namespace Util {
|
||||||
@ -76,8 +77,8 @@ void GetPropertiesFromDWriteFont(
|
|||||||
|
|
||||||
IDWriteFont* CreateDWriteFontFromGDIFamilyName(IDWriteFactory* factory, const WCHAR* gdiFamilyName)
|
IDWriteFont* CreateDWriteFontFromGDIFamilyName(IDWriteFactory* factory, const WCHAR* gdiFamilyName)
|
||||||
{
|
{
|
||||||
IDWriteGdiInterop* dwGdiInterop;
|
Microsoft::WRL::ComPtr<IDWriteGdiInterop> dwGdiInterop;
|
||||||
HRESULT hr = factory->GetGdiInterop(&dwGdiInterop);
|
HRESULT hr = factory->GetGdiInterop(dwGdiInterop.GetAddressOf());
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
LOGFONT lf = {};
|
LOGFONT lf = {};
|
||||||
@ -96,8 +97,6 @@ IDWriteFont* CreateDWriteFontFromGDIFamilyName(IDWriteFactory* factory, const WC
|
|||||||
{
|
{
|
||||||
return dwFont;
|
return dwFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwGdiInterop->Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -155,25 +154,16 @@ bool IsFamilyInSystemFontCollection(IDWriteFactory* factory, const WCHAR* family
|
|||||||
|
|
||||||
HRESULT GetGDIFamilyNameFromDWriteFont(IDWriteFont* font, WCHAR* buffer, UINT bufferSize)
|
HRESULT GetGDIFamilyNameFromDWriteFont(IDWriteFont* font, WCHAR* buffer, UINT bufferSize)
|
||||||
{
|
{
|
||||||
IDWriteLocalizedStrings* strings;
|
Microsoft::WRL::ComPtr<IDWriteLocalizedStrings> strings;
|
||||||
BOOL stringsExist;
|
BOOL stringsExist;
|
||||||
HRESULT hr = font->GetInformationalStrings(
|
font->GetInformationalStrings(
|
||||||
DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &strings, &stringsExist);
|
DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, strings.GetAddressOf(), &stringsExist);
|
||||||
if (SUCCEEDED(hr))
|
if (strings && stringsExist)
|
||||||
{
|
{
|
||||||
if (stringsExist)
|
return strings->GetString(0, buffer, bufferSize);
|
||||||
{
|
|
||||||
hr = strings->GetString(0, buffer, bufferSize);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hr = E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
strings->Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
IDWriteFont* FindDWriteFontInFontFamilyByGDIFamilyName(
|
IDWriteFont* FindDWriteFontInFontFamilyByGDIFamilyName(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user