Gfx: Cosmetics

This commit is contained in:
Birunthan Mohanathas
2013-04-12 19:18:56 +03:00
parent 73adaffe43
commit b73735251e
3 changed files with 23 additions and 28 deletions

View File

@ -95,25 +95,24 @@ void TextFormatD2D::SetProperties(
{
Dispose();
HRESULT hr = E_FAIL;
// |fontFamily| uses the GDI/GDI+ font naming convention so try to create DirectWrite font
// using the GDI family name and then create a text format using the DirectWrite family name
// obtained from it.
WCHAR dwFamilyName[LF_FACESIZE];
DWRITE_FONT_WEIGHT dwFontWeight;
DWRITE_FONT_STYLE dwFontStyle;
DWRITE_FONT_STRETCH dwFontStretch;
if (Util::GetDWritePropertiesFromGDIProperties(
CanvasD2D::c_DWFactory, fontFamily, bold, italic, dwFontWeight, dwFontStyle, dwFontStretch,
dwFamilyName, _countof(dwFamilyName)))
WCHAR dwriteFamilyName[LF_FACESIZE];
DWRITE_FONT_WEIGHT dwriteFontWeight;
DWRITE_FONT_STYLE dwriteFontStyle;
DWRITE_FONT_STRETCH dwriteFontStretch;
HRESULT hr = Util::GetDWritePropertiesFromGDIProperties(
CanvasD2D::c_DWFactory, fontFamily, bold, italic, dwriteFontWeight, dwriteFontStyle,
dwriteFontStretch, dwriteFamilyName, _countof(dwriteFamilyName));
if (SUCCEEDED(hr))
{
hr = CanvasD2D::c_DWFactory->CreateTextFormat(
dwFamilyName,
dwriteFamilyName,
nullptr,
dwFontWeight,
dwFontStyle,
dwFontStretch,
dwriteFontWeight,
dwriteFontStyle,
dwriteFontStretch,
size * (4.0f / 3.0f),
L"",
&m_TextFormat);