Commit 3905ed8c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Store last line wrapping property.

parent 7a83be7b
...@@ -45,6 +45,7 @@ struct dwrite_textformat_data { ...@@ -45,6 +45,7 @@ struct dwrite_textformat_data {
DWRITE_PARAGRAPH_ALIGNMENT paralign; DWRITE_PARAGRAPH_ALIGNMENT paralign;
DWRITE_READING_DIRECTION readingdir; DWRITE_READING_DIRECTION readingdir;
DWRITE_WORD_WRAPPING wrapping; DWRITE_WORD_WRAPPING wrapping;
BOOL last_line_wrapping;
DWRITE_TEXT_ALIGNMENT textalignment; DWRITE_TEXT_ALIGNMENT textalignment;
DWRITE_FLOW_DIRECTION flow; DWRITE_FLOW_DIRECTION flow;
DWRITE_LINE_SPACING_METHOD spacingmethod; DWRITE_LINE_SPACING_METHOD spacingmethod;
...@@ -3202,15 +3203,15 @@ static DWRITE_VERTICAL_GLYPH_ORIENTATION WINAPI dwritetextlayout2_GetVerticalGly ...@@ -3202,15 +3203,15 @@ static DWRITE_VERTICAL_GLYPH_ORIENTATION WINAPI dwritetextlayout2_GetVerticalGly
static HRESULT WINAPI dwritetextlayout2_SetLastLineWrapping(IDWriteTextLayout2 *iface, BOOL lastline_wrapping_enabled) static HRESULT WINAPI dwritetextlayout2_SetLastLineWrapping(IDWriteTextLayout2 *iface, BOOL lastline_wrapping_enabled)
{ {
struct dwrite_textlayout *This = impl_from_IDWriteTextLayout2(iface); struct dwrite_textlayout *This = impl_from_IDWriteTextLayout2(iface);
FIXME("(%p)->(%d): stub\n", This, lastline_wrapping_enabled); TRACE("(%p)->(%d)\n", This, lastline_wrapping_enabled);
return E_NOTIMPL; return IDWriteTextFormat1_SetLastLineWrapping(&This->IDWriteTextFormat1_iface, lastline_wrapping_enabled);
} }
static BOOL WINAPI dwritetextlayout2_GetLastLineWrapping(IDWriteTextLayout2 *iface) static BOOL WINAPI dwritetextlayout2_GetLastLineWrapping(IDWriteTextLayout2 *iface)
{ {
struct dwrite_textlayout *This = impl_from_IDWriteTextLayout2(iface); struct dwrite_textlayout *This = impl_from_IDWriteTextLayout2(iface);
FIXME("(%p): stub\n", This); TRACE("(%p)\n", This);
return FALSE; return IDWriteTextFormat1_GetLastLineWrapping(&This->IDWriteTextFormat1_iface);
} }
static HRESULT WINAPI dwritetextlayout2_SetOpticalAlignment(IDWriteTextLayout2 *iface, DWRITE_OPTICAL_ALIGNMENT alignment) static HRESULT WINAPI dwritetextlayout2_SetOpticalAlignment(IDWriteTextLayout2 *iface, DWRITE_OPTICAL_ALIGNMENT alignment)
...@@ -3609,15 +3610,18 @@ static DWRITE_VERTICAL_GLYPH_ORIENTATION WINAPI dwritetextformat1_layout_GetVert ...@@ -3609,15 +3610,18 @@ static DWRITE_VERTICAL_GLYPH_ORIENTATION WINAPI dwritetextformat1_layout_GetVert
static HRESULT WINAPI dwritetextformat1_layout_SetLastLineWrapping(IDWriteTextFormat1 *iface, BOOL lastline_wrapping_enabled) static HRESULT WINAPI dwritetextformat1_layout_SetLastLineWrapping(IDWriteTextFormat1 *iface, BOOL lastline_wrapping_enabled)
{ {
struct dwrite_textlayout *This = impl_layout_form_IDWriteTextFormat1(iface); struct dwrite_textlayout *This = impl_layout_form_IDWriteTextFormat1(iface);
FIXME("(%p)->(%d): stub\n", This, lastline_wrapping_enabled);
return E_NOTIMPL; TRACE("(%p)->(%d)\n", This, lastline_wrapping_enabled);
This->format.last_line_wrapping = !!lastline_wrapping_enabled;
return S_OK;
} }
static BOOL WINAPI dwritetextformat1_layout_GetLastLineWrapping(IDWriteTextFormat1 *iface) static BOOL WINAPI dwritetextformat1_layout_GetLastLineWrapping(IDWriteTextFormat1 *iface)
{ {
struct dwrite_textlayout *This = impl_layout_form_IDWriteTextFormat1(iface); struct dwrite_textlayout *This = impl_layout_form_IDWriteTextFormat1(iface);
FIXME("(%p): stub\n", This); TRACE("(%p)\n", This);
return FALSE; return This->format.last_line_wrapping;
} }
static HRESULT WINAPI dwritetextformat1_layout_SetOpticalAlignment(IDWriteTextFormat1 *iface, DWRITE_OPTICAL_ALIGNMENT alignment) static HRESULT WINAPI dwritetextformat1_layout_SetOpticalAlignment(IDWriteTextFormat1 *iface, DWRITE_OPTICAL_ALIGNMENT alignment)
...@@ -4542,15 +4546,18 @@ static DWRITE_VERTICAL_GLYPH_ORIENTATION WINAPI dwritetextformat1_GetVerticalGly ...@@ -4542,15 +4546,18 @@ static DWRITE_VERTICAL_GLYPH_ORIENTATION WINAPI dwritetextformat1_GetVerticalGly
static HRESULT WINAPI dwritetextformat1_SetLastLineWrapping(IDWriteTextFormat1 *iface, BOOL lastline_wrapping_enabled) static HRESULT WINAPI dwritetextformat1_SetLastLineWrapping(IDWriteTextFormat1 *iface, BOOL lastline_wrapping_enabled)
{ {
struct dwrite_textformat *This = impl_from_IDWriteTextFormat1(iface); struct dwrite_textformat *This = impl_from_IDWriteTextFormat1(iface);
FIXME("(%p)->(%d): stub\n", This, lastline_wrapping_enabled);
return E_NOTIMPL; TRACE("(%p)->(%d)\n", This, lastline_wrapping_enabled);
This->format.last_line_wrapping = !!lastline_wrapping_enabled;
return S_OK;
} }
static BOOL WINAPI dwritetextformat1_GetLastLineWrapping(IDWriteTextFormat1 *iface) static BOOL WINAPI dwritetextformat1_GetLastLineWrapping(IDWriteTextFormat1 *iface)
{ {
struct dwrite_textformat *This = impl_from_IDWriteTextFormat1(iface); struct dwrite_textformat *This = impl_from_IDWriteTextFormat1(iface);
FIXME("(%p): stub\n", This); TRACE("(%p)\n", This);
return FALSE; return This->format.last_line_wrapping;
} }
static HRESULT WINAPI dwritetextformat1_SetOpticalAlignment(IDWriteTextFormat1 *iface, DWRITE_OPTICAL_ALIGNMENT alignment) static HRESULT WINAPI dwritetextformat1_SetOpticalAlignment(IDWriteTextFormat1 *iface, DWRITE_OPTICAL_ALIGNMENT alignment)
...@@ -4649,6 +4656,7 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle ...@@ -4649,6 +4656,7 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
This->format.textalignment = DWRITE_TEXT_ALIGNMENT_LEADING; This->format.textalignment = DWRITE_TEXT_ALIGNMENT_LEADING;
This->format.paralign = DWRITE_PARAGRAPH_ALIGNMENT_NEAR; This->format.paralign = DWRITE_PARAGRAPH_ALIGNMENT_NEAR;
This->format.wrapping = DWRITE_WORD_WRAPPING_WRAP; This->format.wrapping = DWRITE_WORD_WRAPPING_WRAP;
This->format.last_line_wrapping = TRUE;
This->format.readingdir = DWRITE_READING_DIRECTION_LEFT_TO_RIGHT; This->format.readingdir = DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
This->format.flow = DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM; This->format.flow = DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM;
This->format.spacingmethod = DWRITE_LINE_SPACING_METHOD_DEFAULT; This->format.spacingmethod = DWRITE_LINE_SPACING_METHOD_DEFAULT;
......
...@@ -4130,6 +4130,53 @@ static void test_SetTypography(void) ...@@ -4130,6 +4130,53 @@ static void test_SetTypography(void)
IDWriteFactory_Release(factory); IDWriteFactory_Release(factory);
} }
static void test_SetLastLineWrapping(void)
{
static const WCHAR strW[] = {'a',0};
IDWriteTextLayout2 *layout2;
IDWriteTextFormat1 *format1;
IDWriteTextLayout *layout;
IDWriteTextFormat *format;
IDWriteFactory *factory;
HRESULT hr;
BOOL ret;
factory = create_factory();
hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL, 10.0, enusW, &format);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDWriteTextFormat_QueryInterface(format, &IID_IDWriteTextFormat1, (void**)&format1);
IDWriteTextFormat_Release(format);
if (hr != S_OK) {
win_skip("SetLastLineWrapping() is not supported\n");
IDWriteFactory_Release(factory);
return;
}
ret = IDWriteTextFormat1_GetLastLineWrapping(format1);
ok(ret, "got %d\n", ret);
hr = IDWriteTextFormat1_SetLastLineWrapping(format1, FALSE);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, (IDWriteTextFormat*)format1, 1000.0, 1000.0, &layout);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextLayout2, (void**)&layout2);
ok(hr == S_OK, "got 0x%08x\n", hr);
IDWriteTextLayout_Release(layout);
ret = IDWriteTextLayout2_GetLastLineWrapping(layout2);
ok(!ret, "got %d\n", ret);
hr = IDWriteTextLayout2_SetLastLineWrapping(layout2, TRUE);
ok(hr == S_OK, "got 0x%08x\n", hr);
IDWriteFactory_Release(factory);
}
START_TEST(layout) START_TEST(layout)
{ {
static const WCHAR ctrlstrW[] = {0x202a,0}; static const WCHAR ctrlstrW[] = {0x202a,0};
...@@ -4178,6 +4225,7 @@ START_TEST(layout) ...@@ -4178,6 +4225,7 @@ START_TEST(layout)
test_MapCharacters(); test_MapCharacters();
test_FontFallbackBuilder(); test_FontFallbackBuilder();
test_SetTypography(); test_SetTypography();
test_SetLastLineWrapping();
IDWriteFactory_Release(factory); IDWriteFactory_Release(factory);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment