Module: wine Branch: master Commit: ebdad92d1112c54af52255235acc6eab1a6fd383 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ebdad92d1112c54af52255235a...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Mon Apr 7 09:18:49 2014 +0400
dwrite: Store text format properties.
---
dlls/dwrite/layout.c | 36 ++++++++++++++++++++++-------------- dlls/dwrite/tests/layout.c | 19 +++++++++++++++++++ 2 files changed, 41 insertions(+), 14 deletions(-)
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 942673d..8fea3ad 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -801,36 +801,41 @@ static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat *iface) static HRESULT WINAPI dwritetextformat_SetTextAlignment(IDWriteTextFormat *iface, DWRITE_TEXT_ALIGNMENT alignment) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface); - FIXME("(%p)->(%d): stub\n", This, alignment); - return E_NOTIMPL; + TRACE("(%p)->(%d)\n", This, alignment); + This->format.textalignment = alignment; + return S_OK; }
static HRESULT WINAPI dwritetextformat_SetParagraphAlignment(IDWriteTextFormat *iface, DWRITE_PARAGRAPH_ALIGNMENT alignment) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface); - FIXME("(%p)->(%d): stub\n", This, alignment); - return E_NOTIMPL; + TRACE("(%p)->(%d)\n", This, alignment); + This->format.paralign = alignment; + return S_OK; }
static HRESULT WINAPI dwritetextformat_SetWordWrapping(IDWriteTextFormat *iface, DWRITE_WORD_WRAPPING wrapping) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface); - FIXME("(%p)->(%d): stub\n", This, wrapping); - return E_NOTIMPL; + TRACE("(%p)->(%d)\n", This, wrapping); + This->format.wrapping = wrapping; + return S_OK; }
static HRESULT WINAPI dwritetextformat_SetReadingDirection(IDWriteTextFormat *iface, DWRITE_READING_DIRECTION direction) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface); - FIXME("(%p)->(%d): stub\n", This, direction); - return E_NOTIMPL; + TRACE("(%p)->(%d)\n", This, direction); + This->format.readingdir = direction; + return S_OK; }
static HRESULT WINAPI dwritetextformat_SetFlowDirection(IDWriteTextFormat *iface, DWRITE_FLOW_DIRECTION direction) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface); - FIXME("(%p)->(%d): stub\n", This, direction); - return E_NOTIMPL; + TRACE("(%p)->(%d)\n", This, direction); + This->format.flow = direction; + return S_OK; }
static HRESULT WINAPI dwritetextformat_SetIncrementalTabStop(IDWriteTextFormat *iface, FLOAT tabstop) @@ -848,12 +853,15 @@ static HRESULT WINAPI dwritetextformat_SetTrimming(IDWriteTextFormat *iface, DWR return E_NOTIMPL; }
-static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat *iface, DWRITE_LINE_SPACING_METHOD spacing, - FLOAT line_spacing, FLOAT baseline) +static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat *iface, DWRITE_LINE_SPACING_METHOD method, + FLOAT spacing, FLOAT baseline) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface); - FIXME("(%p)->(%d %f %f): stub\n", This, spacing, line_spacing, baseline); - return E_NOTIMPL; + TRACE("(%p)->(%d %f %f)\n", This, method, spacing, baseline); + This->format.spacingmethod = method; + This->format.spacing = spacing; + This->format.baseline = baseline; + return S_OK; }
static DWRITE_TEXT_ALIGNMENT WINAPI dwritetextformat_GetTextAlignment(IDWriteTextFormat *iface) diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index b531b03..5699ff7 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -160,6 +160,25 @@ if (0) /* crashes on native */ ok(baseline == 0.0, "got %f\n", baseline); ok(method == DWRITE_LINE_SPACING_METHOD_DEFAULT, "got %d\n", method);
+ /* setters */ + hr = IDWriteTextFormat_SetTextAlignment(format, DWRITE_TEXT_ALIGNMENT_LEADING); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteTextFormat_SetParagraphAlignment(format, DWRITE_PARAGRAPH_ALIGNMENT_NEAR); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteTextFormat_SetWordWrapping(format, DWRITE_WORD_WRAPPING_WRAP); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteTextFormat_SetReadingDirection(format, DWRITE_READING_DIRECTION_LEFT_TO_RIGHT); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteTextFormat_SetFlowDirection(format, DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteTextFormat_SetLineSpacing(format, DWRITE_LINE_SPACING_METHOD_DEFAULT, 0.0, 0.0); + ok(hr == S_OK, "got 0x%08x\n", hr); + IDWriteTextFormat_Release(format); }