Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2f79a876
Commit
2f79a876
authored
Jul 12, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Implement SetWordWrapping() for layout.
parent
cf5d9848
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
10 deletions
+63
-10
layout.c
dlls/dwrite/layout.c
+24
-10
layout.c
dlls/dwrite/tests/layout.c
+39
-0
No files found.
dlls/dwrite/layout.c
View file @
2f79a876
...
...
@@ -363,6 +363,16 @@ static inline HRESULT format_set_readingdirection(struct dwrite_textformat_data
return
S_OK
;
}
static
inline
HRESULT
format_set_wordwrapping
(
struct
dwrite_textformat_data
*
format
,
DWRITE_WORD_WRAPPING
wrapping
,
BOOL
*
changed
)
{
if
((
UINT32
)
wrapping
>
DWRITE_WORD_WRAPPING_CHARACTER
)
return
E_INVALIDARG
;
if
(
changed
)
*
changed
=
format
->
wrapping
!=
wrapping
;
format
->
wrapping
=
wrapping
;
return
S_OK
;
}
static
HRESULT
get_fontfallback_from_format
(
const
struct
dwrite_textformat_data
*
format
,
IDWriteFontFallback
**
fallback
)
{
*
fallback
=
format
->
fallback
;
...
...
@@ -2199,7 +2209,6 @@ static HRESULT WINAPI dwritetextlayout_SetParagraphAlignment(IDWriteTextLayout2
static
HRESULT
WINAPI
dwritetextlayout_SetWordWrapping
(
IDWriteTextLayout2
*
iface
,
DWRITE_WORD_WRAPPING
wrapping
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout2
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
wrapping
);
return
IDWriteTextFormat1_SetWordWrapping
(
&
This
->
IDWriteTextFormat1_iface
,
wrapping
);
}
...
...
@@ -3296,8 +3305,19 @@ static HRESULT WINAPI dwritetextformat1_layout_SetParagraphAlignment(IDWriteText
static
HRESULT
WINAPI
dwritetextformat1_layout_SetWordWrapping
(
IDWriteTextFormat1
*
iface
,
DWRITE_WORD_WRAPPING
wrapping
)
{
struct
dwrite_textlayout
*
This
=
impl_layout_form_IDWriteTextFormat1
(
iface
);
FIXME
(
"(%p)->(%d): stub
\n
"
,
This
,
wrapping
);
return
E_NOTIMPL
;
BOOL
changed
;
HRESULT
hr
;
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
wrapping
);
hr
=
format_set_wordwrapping
(
&
This
->
format
,
wrapping
,
&
changed
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
changed
)
This
->
recompute
|=
RECOMPUTE_EFFECTIVE_RUNS
;
return
S_OK
;
}
static
HRESULT
WINAPI
dwritetextformat1_layout_SetReadingDirection
(
IDWriteTextFormat1
*
iface
,
DWRITE_READING_DIRECTION
direction
)
...
...
@@ -4181,14 +4201,8 @@ static HRESULT WINAPI dwritetextformat_SetParagraphAlignment(IDWriteTextFormat1
static
HRESULT
WINAPI
dwritetextformat_SetWordWrapping
(
IDWriteTextFormat1
*
iface
,
DWRITE_WORD_WRAPPING
wrapping
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat1
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
wrapping
);
if
((
UINT32
)
wrapping
>
DWRITE_WORD_WRAPPING_CHARACTER
)
return
E_INVALIDARG
;
This
->
format
.
wrapping
=
wrapping
;
return
S_OK
;
return
format_set_wordwrapping
(
&
This
->
format
,
wrapping
,
NULL
);
}
static
HRESULT
WINAPI
dwritetextformat_SetReadingDirection
(
IDWriteTextFormat1
*
iface
,
DWRITE_READING_DIRECTION
direction
)
...
...
dlls/dwrite/tests/layout.c
View file @
2f79a876
...
...
@@ -3396,6 +3396,44 @@ static void test_pixelsnapping(void)
IDWriteFactory_Release
(
factory
);
}
static
void
test_SetWordWrapping
(
void
)
{
static
const
WCHAR
strW
[]
=
{
'a'
,
0
};
IDWriteTextFormat
*
format
;
IDWriteTextLayout
*
layout
;
IDWriteFactory
*
factory
;
DWRITE_WORD_WRAPPING
v
;
HRESULT
hr
;
factory
=
create_factory
();
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
12
.
0
,
enusW
,
&
format
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
v
=
IDWriteTextFormat_GetWordWrapping
(
format
);
ok
(
v
==
DWRITE_WORD_WRAPPING_WRAP
,
"got %d
\n
"
,
v
);
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
strW
,
1
,
format
,
500
.
0
,
100
.
0
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
v
=
IDWriteTextLayout_GetWordWrapping
(
layout
);
ok
(
v
==
DWRITE_WORD_WRAPPING_WRAP
,
"got %d
\n
"
,
v
);
hr
=
IDWriteTextLayout_SetWordWrapping
(
layout
,
DWRITE_WORD_WRAPPING_NO_WRAP
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextLayout_SetWordWrapping
(
layout
,
DWRITE_WORD_WRAPPING_NO_WRAP
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
v
=
IDWriteTextFormat_GetWordWrapping
(
format
);
ok
(
v
==
DWRITE_WORD_WRAPPING_WRAP
,
"got %d
\n
"
,
v
);
IDWriteTextLayout_Release
(
layout
);
IDWriteTextFormat_Release
(
format
);
IDWriteFactory_Release
(
factory
);
}
START_TEST
(
layout
)
{
static
const
WCHAR
ctrlstrW
[]
=
{
0x202a
,
0
};
...
...
@@ -3440,6 +3478,7 @@ START_TEST(layout)
test_SetParagraphAlignment
();
test_SetReadingDirection
();
test_pixelsnapping
();
test_SetWordWrapping
();
IDWriteFactory_Release
(
factory
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment