dwrite: Store text format properties.

oldstable
Nikolay Sivov 2012-10-12 09:12:57 -04:00 committed by Alexandre Julliard
parent 0358413e35
commit 2c0c413224
3 changed files with 28 additions and 4 deletions

View File

@ -54,7 +54,8 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
}
extern HRESULT create_font_from_logfont(const LOGFONTW*, IDWriteFont**) DECLSPEC_HIDDEN;
extern HRESULT create_textformat(IDWriteTextFormat**) DECLSPEC_HIDDEN;
extern HRESULT create_textformat(const WCHAR*,DWRITE_FONT_WEIGHT,DWRITE_FONT_STYLE,DWRITE_FONT_STRETCH,
FLOAT,const WCHAR*,IDWriteTextFormat**) DECLSPEC_HIDDEN;
extern HRESULT create_textlayout(IDWriteTextLayout**) DECLSPEC_HIDDEN;
extern HRESULT create_gdiinterop(IDWriteGdiInterop**) DECLSPEC_HIDDEN;
extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDEN;

View File

@ -40,6 +40,15 @@ struct dwrite_textlayout {
struct dwrite_textformat {
IDWriteTextFormat IDWriteTextFormat_iface;
LONG ref;
WCHAR *family_name;
WCHAR *locale;
DWRITE_FONT_WEIGHT weight;
DWRITE_FONT_STYLE style;
DWRITE_FONT_STRETCH stretch;
FLOAT size;
};
static inline struct dwrite_textlayout *impl_from_IDWriteTextLayout(IDWriteTextLayout *iface)
@ -689,7 +698,11 @@ static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat *iface)
TRACE("(%p)->(%d)\n", This, ref);
if (!ref)
{
heap_free(This->family_name);
heap_free(This->locale);
heap_free(This);
}
return S_OK;
}
@ -904,7 +917,8 @@ static const IDWriteTextFormatVtbl dwritetextformatvtbl = {
dwritetextformat_GetLocaleName
};
HRESULT create_textformat(IDWriteTextFormat **format)
HRESULT create_textformat(const WCHAR *family_name, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style,
DWRITE_FONT_STRETCH stretch, FLOAT size, const WCHAR *locale, IDWriteTextFormat **format)
{
struct dwrite_textformat *This;
@ -913,6 +927,11 @@ HRESULT create_textformat(IDWriteTextFormat **format)
This->IDWriteTextFormat_iface.lpVtbl = &dwritetextformatvtbl;
This->ref = 1;
This->family_name = heap_strdupW(family_name);
This->locale = heap_strdupW(locale);
This->weight = weight;
This->style = style;
This->size = size;
*format = &This->IDWriteTextFormat_iface;

View File

@ -479,9 +479,13 @@ static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory *iface, WCHA
IDWriteFontCollection *collection, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style,
DWRITE_FONT_STRETCH stretch, FLOAT size, WCHAR const *locale, IDWriteTextFormat **format)
{
FIXME("(%s %p %d %d %d %f %s %p): semi-stub\n", debugstr_w(family_name), collection, weight, style, stretch,
TRACE("(%s %p %d %d %d %f %s %p)\n", debugstr_w(family_name), collection, weight, style, stretch,
size, debugstr_w(locale), format);
return create_textformat(format);
if (collection)
FIXME("font collection not supported\n");
return create_textformat(family_name, weight, style, stretch, size, locale, format);
}
static HRESULT WINAPI dwritefactory_CreateTypography(IDWriteFactory *iface, IDWriteTypography **typography)