dwrite: Derive some format data for text layout from specified text format.
This commit is contained in:
parent
8089f73e87
commit
2250f0e533
|
@ -70,7 +70,7 @@ static inline LPWSTR heap_strdupnW(const WCHAR *str, UINT32 len)
|
|||
extern HRESULT create_font_from_logfont(const LOGFONTW*, IDWriteFont**) DECLSPEC_HIDDEN;
|
||||
extern HRESULT create_textformat(const WCHAR*,IDWriteFontCollection*,DWRITE_FONT_WEIGHT,DWRITE_FONT_STYLE,DWRITE_FONT_STRETCH,
|
||||
FLOAT,const WCHAR*,IDWriteTextFormat**) DECLSPEC_HIDDEN;
|
||||
extern HRESULT create_textlayout(const WCHAR*,UINT32,IDWriteTextLayout**) DECLSPEC_HIDDEN;
|
||||
extern HRESULT create_textlayout(const WCHAR*,UINT32,IDWriteTextFormat*,IDWriteTextLayout**) DECLSPEC_HIDDEN;
|
||||
extern HRESULT create_gdiinterop(IDWriteGdiInterop**) DECLSPEC_HIDDEN;
|
||||
extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDEN;
|
||||
extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -664,7 +664,7 @@ static const IDWriteTextLayoutVtbl dwritetextlayoutvtbl = {
|
|||
dwritetextlayout_HitTestTextRange
|
||||
};
|
||||
|
||||
HRESULT create_textlayout(const WCHAR *str, UINT32 len, IDWriteTextLayout **layout)
|
||||
HRESULT create_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *format, IDWriteTextLayout **layout)
|
||||
{
|
||||
struct dwrite_textlayout *This;
|
||||
|
||||
|
@ -678,6 +678,16 @@ HRESULT create_textlayout(const WCHAR *str, UINT32 len, IDWriteTextLayout **layo
|
|||
This->str = heap_strdupnW(str, len);
|
||||
memset(&This->format, 0, sizeof(This->format));
|
||||
|
||||
/* reference is not kept here, instead copy all underlying data */
|
||||
if (format)
|
||||
{
|
||||
IDWriteTextFormat_GetFontCollection(format, &This->format.collection);
|
||||
This->format.weight = IDWriteTextFormat_GetFontWeight(format);
|
||||
This->format.style = IDWriteTextFormat_GetFontStyle(format);
|
||||
This->format.stretch = IDWriteTextFormat_GetFontStretch(format);
|
||||
This->format.size = IDWriteTextFormat_GetFontSize(format);
|
||||
}
|
||||
|
||||
*layout = &This->IDWriteTextLayout_iface;
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -506,10 +506,10 @@ static HRESULT WINAPI dwritefactory_GetGdiInterop(IDWriteFactory *iface, IDWrite
|
|||
static HRESULT WINAPI dwritefactory_CreateTextLayout(IDWriteFactory *iface, WCHAR const* string,
|
||||
UINT32 len, IDWriteTextFormat *format, FLOAT max_width, FLOAT max_height, IDWriteTextLayout **layout)
|
||||
{
|
||||
FIXME("(%s %u %p %f %f %p): stub\n", debugstr_w(string), len, format, max_width, max_height, layout);
|
||||
TRACE("(%s %u %p %f %f %p)\n", debugstr_w(string), len, format, max_width, max_height, layout);
|
||||
|
||||
if (!format) return E_INVALIDARG;
|
||||
return create_textlayout(string, len, layout);
|
||||
return create_textlayout(string, len, format, layout);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dwritefactory_CreateGdiCompatibleTextLayout(IDWriteFactory *iface, WCHAR const* string,
|
||||
|
@ -520,7 +520,7 @@ static HRESULT WINAPI dwritefactory_CreateGdiCompatibleTextLayout(IDWriteFactory
|
|||
pixels_per_dip, transform, use_gdi_natural, layout);
|
||||
|
||||
if (!format) return E_INVALIDARG;
|
||||
return create_textlayout(string, len, layout);
|
||||
return create_textlayout(string, len, format, layout);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dwritefactory_CreateEllipsisTrimmingSign(IDWriteFactory *iface, IDWriteTextFormat *format,
|
||||
|
|
Loading…
Reference in New Issue