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
93a852e2
Commit
93a852e2
authored
May 13, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite/layout: Fix layout metrics width for whitespace-only lines.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6dc35e2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
layout.c
dlls/dwrite/layout.c
+3
-2
layout.c
dlls/dwrite/tests/layout.c
+20
-0
No files found.
dlls/dwrite/layout.c
View file @
93a852e2
...
...
@@ -1831,7 +1831,7 @@ static void layout_add_line(struct dwrite_textlayout *layout, UINT32 first_clust
FLOAT
descent
,
trailingspacewidth
;
BOOL
append_trimming_run
=
FALSE
;
const
struct
layout_run
*
run
;
FLOAT
width
,
origin_x
;
float
width
=
0
.
0
f
,
origin_x
;
HRESULT
hr
;
/* Take a look at clusters we got for this line in reverse order to set trailing properties for current line */
...
...
@@ -1871,7 +1871,8 @@ static void layout_add_line(struct dwrite_textlayout *layout, UINT32 first_clust
}
/* Does not include trailing space width */
width
=
get_cluster_range_width
(
layout
,
first_cluster
,
last_cluster
+
1
);
if
(
!
layout
->
clustermetrics
[
last_cluster
].
isWhitespace
)
width
=
get_cluster_range_width
(
layout
,
first_cluster
,
last_cluster
+
1
);
/* Append trimming run if necessary */
if
(
width
>
layout
->
metrics
.
layoutWidth
&&
layout
->
format
.
trimmingsign
!=
NULL
&&
...
...
dlls/dwrite/tests/layout.c
View file @
93a852e2
...
...
@@ -3205,6 +3205,7 @@ static void test_GetMetrics(void)
static
const
WCHAR
str2W
[]
=
{
0x2066
,
')'
,
')'
,
0x661
,
'('
,
0x627
,
')'
,
0
};
static
const
WCHAR
strW
[]
=
{
'a'
,
'b'
,
'c'
,
'd'
,
0
};
static
const
WCHAR
str3W
[]
=
{
'a'
,
0
};
static
const
WCHAR
str4W
[]
=
{
' '
,
0
};
DWRITE_CLUSTER_METRICS
clusters
[
4
];
DWRITE_TEXT_METRICS
metrics
;
IDWriteTextFormat
*
format
;
...
...
@@ -3290,6 +3291,25 @@ todo_wine
ok
(
metrics
.
lineCount
==
1
,
"got %u
\n
"
,
metrics
.
lineCount
);
IDWriteTextLayout_Release
(
layout
);
/* Whitespace only. */
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
str4W
,
1
,
format
,
500
.
0
,
1000
.
0
,
&
layout
);
ok
(
hr
==
S_OK
,
"Failed to create text layout, hr %#x.
\n
"
,
hr
);
memset
(
&
metrics
,
0xcc
,
sizeof
(
metrics
));
hr
=
IDWriteTextLayout_GetMetrics
(
layout
,
&
metrics
);
ok
(
hr
==
S_OK
,
"Failed to get layout metrics, hr %#x.
\n
"
,
hr
);
ok
(
metrics
.
left
==
0
.
0
f
,
"Unexpected value for left %f.
\n
"
,
metrics
.
left
);
ok
(
metrics
.
top
==
0
.
0
f
,
"Unexpected value for top %f.
\n
"
,
metrics
.
top
);
ok
(
metrics
.
width
==
0
.
0
f
,
"Unexpected width %f.
\n
"
,
metrics
.
width
);
ok
(
metrics
.
widthIncludingTrailingWhitespace
>
0
.
0
f
,
"Unexpected full width %f.
\n
"
,
metrics
.
widthIncludingTrailingWhitespace
);
ok
(
metrics
.
height
>
0
.
0
,
"Unexpected height %f.
\n
"
,
metrics
.
height
);
ok
(
metrics
.
layoutWidth
==
500
.
0
,
"Unexpected box width %f.
\n
"
,
metrics
.
layoutWidth
);
ok
(
metrics
.
layoutHeight
==
1000
.
0
,
"Unexpected box height %f.
\n
"
,
metrics
.
layoutHeight
);
ok
(
metrics
.
maxBidiReorderingDepth
==
1
,
"Unexpected reordering depth %u.
\n
"
,
metrics
.
maxBidiReorderingDepth
);
ok
(
metrics
.
lineCount
==
1
,
"Unexpected line coun %u.
\n
"
,
metrics
.
lineCount
);
IDWriteTextLayout_Release
(
layout
);
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