Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
8a14df1e
Commit
8a14df1e
authored
Sep 21, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite/layout: Test resulting line width before adding inline trimming run.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d23b5f10
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
layout.c
dlls/dwrite/layout.c
+3
-0
layout.c
dlls/dwrite/tests/layout.c
+43
-0
No files found.
dlls/dwrite/layout.c
View file @
8a14df1e
...
...
@@ -1926,6 +1926,9 @@ static void layout_add_line(struct dwrite_textlayout *layout, UINT32 first_clust
if
(
FAILED
(
hr
))
return
;
if
(
get_cluster_range_width
(
layout
,
start
,
i
)
+
sign_metrics
.
width
>
layout
->
metrics
.
layoutWidth
)
append_trimming_run
=
FALSE
;
if
(
append_trimming_run
)
{
struct
layout_effective_inline
*
trimming_sign
;
...
...
dlls/dwrite/tests/layout.c
View file @
8a14df1e
...
...
@@ -1636,6 +1636,11 @@ static const struct drawcall_entry draw_seq[] = {
{
DRAW_LAST_KIND
}
};
static
const
struct
drawcall_entry
draw_trimmed_seq
[]
=
{
{
DRAW_GLYPHRUN
,
{
'a'
,
0
},
{
'e'
,
'n'
,
'-'
,
'u'
,
's'
,
0
},
1
},
{
DRAW_LAST_KIND
}
};
static
const
struct
drawcall_entry
draw_seq2
[]
=
{
{
DRAW_GLYPHRUN
,
{
's'
,
0
},
{
'r'
,
'u'
,
0
},
1
},
{
DRAW_GLYPHRUN
,
{
't'
,
0
},
{
'r'
,
'u'
,
0
},
1
},
...
...
@@ -2386,6 +2391,44 @@ todo_wine
IDWriteTextLayout_Release
(
layout
);
/* Single cluster layout, trigger trimming. */
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
str6W
,
1
,
format
,
1000
.
0
f
,
200
.
0
f
,
&
layout
);
ok
(
hr
==
S_OK
,
"Failed to create layout, hr %#x.
\n
"
,
hr
);
count
=
0
;
memset
(
metrics
,
0
,
sizeof
(
metrics
));
hr
=
IDWriteTextLayout_GetClusterMetrics
(
layout
,
metrics
,
1
,
&
count
);
ok
(
hr
==
S_OK
,
"Failed to get cluster metrics, hr %#x.
\n
"
,
hr
);
ok
(
count
==
1
,
"Unexpected cluster count %u.
\n
"
,
count
);
hr
=
IDWriteTextLayout_SetMaxWidth
(
layout
,
metrics
[
0
].
width
/
2
.
0
f
);
ok
(
hr
==
S_OK
,
"Failed to set layout width, hr %#x.
\n
"
,
hr
);
trimming_options
.
granularity
=
DWRITE_TRIMMING_GRANULARITY_CHARACTER
;
trimming_options
.
delimiter
=
0
;
trimming_options
.
delimiterCount
=
0
;
hr
=
IDWriteTextLayout_SetTrimming
(
layout
,
&
trimming_options
,
trimm
);
ok
(
hr
==
S_OK
,
"Failed to set trimming options, hr %#x.
\n
"
,
hr
);
count
=
0
;
memset
(
metrics
,
0
,
sizeof
(
metrics
));
hr
=
IDWriteTextLayout_GetClusterMetrics
(
layout
,
metrics
,
1
,
&
count
);
ok
(
hr
==
S_OK
,
"Failed to get cluster metrics, hr %#x.
\n
"
,
hr
);
ok
(
count
==
1
,
"Unexpected cluster count %u.
\n
"
,
count
);
hr
=
IDWriteTextLayout_GetLineMetrics
(
layout
,
&
line
,
1
,
&
count
);
ok
(
hr
==
S_OK
,
"Failed to get line metrics, hr %#x.
\n
"
,
hr
);
ok
(
count
==
1
,
"Unexpected line count %u.
\n
"
,
count
);
ok
(
line
.
length
==
1
,
"Unexpected line length %u.
\n
"
,
line
.
length
);
ok
(
line
.
isTrimmed
,
"Unexpected trimming flag %x.
\n
"
,
line
.
isTrimmed
);
flush_sequence
(
sequences
,
RENDERER_ID
);
hr
=
IDWriteTextLayout_Draw
(
layout
,
NULL
,
&
testrenderer
,
0
.
0
f
,
0
.
0
f
);
ok
(
hr
==
S_OK
,
"Draw() failed, hr %#x.
\n
"
,
hr
);
ok_sequence
(
sequences
,
RENDERER_ID
,
draw_trimmed_seq
,
"Trimmed draw test"
,
FALSE
);
IDWriteTextLayout_Release
(
layout
);
IDWriteInlineObject_Release
(
trimm
);
IDWriteTextFormat_Release
(
format
);
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