mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Gfx: Tweaks
This commit is contained in:
parent
53c6966819
commit
7c90f65659
@ -101,7 +101,7 @@ void TextFormatD2D::SetProperties(const WCHAR* fontFamily, int size, bool bold,
|
|||||||
if (dwFont)
|
if (dwFont)
|
||||||
{
|
{
|
||||||
WCHAR buffer[LF_FACESIZE];
|
WCHAR buffer[LF_FACESIZE];
|
||||||
if (GetDWFontFamilyName(dwFont, buffer, _countof(buffer)))
|
if (GetFamilyNameFromDWFont(dwFont, buffer, _countof(buffer)))
|
||||||
{
|
{
|
||||||
// TODO: If |fontFamily| is e.g. 'Segoe UI Semibold' and |bold| is true, we might want
|
// TODO: If |fontFamily| is e.g. 'Segoe UI Semibold' and |bold| is true, we might want
|
||||||
// to make the weight heaver to match GDI+.
|
// to make the weight heaver to match GDI+.
|
||||||
@ -222,24 +222,24 @@ IDWriteFont* TextFormatD2D::CreateDWFontFromGDIFamilyName(const WCHAR* fontFamil
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextFormatD2D::GetDWFontFamilyName(IDWriteFont* font, WCHAR* buffer, const UINT bufferSize)
|
bool TextFormatD2D::GetFamilyNameFromDWFont(IDWriteFont* font, WCHAR* buffer, const UINT bufferSize)
|
||||||
{
|
{
|
||||||
bool result = false;
|
|
||||||
IDWriteFontFamily* dwFontFamily;
|
IDWriteFontFamily* dwFontFamily;
|
||||||
HRESULT hr = font->GetFontFamily(&dwFontFamily);
|
HRESULT hr = font->GetFontFamily(&dwFontFamily);
|
||||||
|
return SUCCEEDED(hr) ? GetFamilyNameFromDWFontFamily(dwFontFamily, buffer, bufferSize) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TextFormatD2D::GetFamilyNameFromDWFontFamily(IDWriteFontFamily* fontFamily, WCHAR* buffer, const UINT bufferSize)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
IDWriteLocalizedStrings* dwFamilyNames;
|
||||||
|
HRESULT hr = fontFamily->GetFamilyNames(&dwFamilyNames);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
IDWriteLocalizedStrings* dwFamilyNames;
|
// TODO: Determine the best index?
|
||||||
hr = dwFontFamily->GetFamilyNames(&dwFamilyNames);
|
hr = dwFamilyNames->GetString(0, buffer, bufferSize);
|
||||||
if (SUCCEEDED(hr))
|
result = SUCCEEDED(hr);
|
||||||
{
|
dwFamilyNames->Release();
|
||||||
// TODO: Determine the best index?
|
|
||||||
hr = dwFamilyNames->GetString(0, buffer, bufferSize);
|
|
||||||
result = SUCCEEDED(hr);
|
|
||||||
dwFamilyNames->Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
dwFontFamily->Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -56,7 +56,8 @@ private:
|
|||||||
// style.
|
// style.
|
||||||
static IDWriteFont* CreateDWFontFromGDIFamilyName(const WCHAR* fontFamily, bool bold, bool italic);
|
static IDWriteFont* CreateDWFontFromGDIFamilyName(const WCHAR* fontFamily, bool bold, bool italic);
|
||||||
|
|
||||||
static bool GetDWFontFamilyName(IDWriteFont* font, WCHAR* buffer, UINT bufferSize);
|
static bool GetFamilyNameFromDWFont(IDWriteFont* font, WCHAR* buffer, UINT bufferSize);
|
||||||
|
static bool GetFamilyNameFromDWFontFamily(IDWriteFontFamily* fontFamily, WCHAR* buffer, UINT bufferSize);
|
||||||
|
|
||||||
IDWriteTextFormat* m_TextFormat;
|
IDWriteTextFormat* m_TextFormat;
|
||||||
IDWriteTextLayout* m_TextLayout;
|
IDWriteTextLayout* m_TextLayout;
|
||||||
|
Loading…
Reference in New Issue
Block a user