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
849b5dd9
Commit
849b5dd9
authored
Feb 23, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Set runHeight attribute for underlines.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fd6e12af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
layout.c
dlls/dwrite/layout.c
+6
-4
layout.c
dlls/dwrite/tests/layout.c
+0
-2
No files found.
dlls/dwrite/layout.c
View file @
849b5dd9
/*
* Text format and layout
*
* Copyright 2012, 2014-201
6
Nikolay Sivov for CodeWeavers
* Copyright 2012, 2014-201
7
Nikolay Sivov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -1662,27 +1662,29 @@ static BOOL is_same_u_splitting(struct layout_underline_splitting_params *left,
static
HRESULT
layout_add_underline
(
struct
dwrite_textlayout
*
layout
,
struct
layout_effective_run
*
first
,
struct
layout_effective_run
*
last
)
{
FLOAT
thickness
,
offset
,
runheight
;
struct
layout_effective_run
*
cur
;
DWRITE_FONT_METRICS
metrics
;
FLOAT
thickness
,
offset
;
if
(
first
==
layout_get_prev_erun
(
layout
,
last
))
{
layout_get_erun_font_metrics
(
layout
,
first
,
&
metrics
);
thickness
=
SCALE_FONT_METRIC
(
metrics
.
underlineThickness
,
first
->
run
->
u
.
regular
.
run
.
fontEmSize
,
&
metrics
);
offset
=
SCALE_FONT_METRIC
(
metrics
.
underlinePosition
,
first
->
run
->
u
.
regular
.
run
.
fontEmSize
,
&
metrics
);
runheight
=
SCALE_FONT_METRIC
(
metrics
.
capHeight
,
first
->
run
->
u
.
regular
.
run
.
fontEmSize
,
&
metrics
);
}
else
{
FLOAT
width
=
0
.
0
f
;
/* Single underline is added for consecutive underlined runs. In this case underline parameters are
calculated as weighted average, where run width acts as a weight. */
thickness
=
offset
=
0
.
0
f
;
thickness
=
offset
=
runheight
=
0
.
0
f
;
cur
=
first
;
do
{
layout_get_erun_font_metrics
(
layout
,
cur
,
&
metrics
);
thickness
+=
SCALE_FONT_METRIC
(
metrics
.
underlineThickness
,
cur
->
run
->
u
.
regular
.
run
.
fontEmSize
,
&
metrics
)
*
cur
->
width
;
offset
+=
SCALE_FONT_METRIC
(
metrics
.
underlinePosition
,
cur
->
run
->
u
.
regular
.
run
.
fontEmSize
,
&
metrics
)
*
cur
->
width
;
runheight
=
max
(
SCALE_FONT_METRIC
(
metrics
.
capHeight
,
cur
->
run
->
u
.
regular
.
run
.
fontEmSize
,
&
metrics
),
runheight
);
width
+=
cur
->
width
;
cur
=
layout_get_next_erun
(
layout
,
cur
);
...
...
@@ -1721,7 +1723,7 @@ static HRESULT layout_add_underline(struct dwrite_textlayout *layout, struct lay
/* Font metrics convention is to have it negative when below baseline, for rendering
however Y grows from baseline down for horizontal baseline. */
u
->
u
.
offset
=
-
offset
;
u
->
u
.
runHeight
=
0
.
0
f
;
/* FIXME */
u
->
u
.
runHeight
=
runheight
;
u
->
u
.
readingDirection
=
is_run_rtl
(
cur
)
?
DWRITE_READING_DIRECTION_RIGHT_TO_LEFT
:
DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
;
u
->
u
.
flowDirection
=
layout
->
format
.
flow
;
...
...
dlls/dwrite/tests/layout.c
View file @
849b5dd9
...
...
@@ -596,7 +596,6 @@ static HRESULT WINAPI testrenderer_DrawUnderline(IDWriteTextRenderer *iface,
if
(
ctxt
)
TEST_MEASURING_MODE
(
ctxt
,
underline
->
measuringMode
);
todo_wine
ok
(
underline
->
runHeight
>
0
.
0
f
,
"Expected non-zero run height
\n
"
);
if
(
ctxt
&&
ctxt
->
format
)
{
DWRITE_FONT_METRICS
metrics
;
...
...
@@ -609,7 +608,6 @@ todo_wine
ok
(
emsize
==
metrics
.
designUnitsPerEm
,
"Unexpected font size %f
\n
"
,
emsize
);
/* Expected height is in design units, allow some absolute difference from it. Seems to only happen on Vista */
todo_wine
ok
(
abs
(
metrics
.
capHeight
-
underline
->
runHeight
)
<
2
.
0
f
,
"Expected runHeight %u, got %f
\n
"
,
metrics
.
capHeight
,
underline
->
runHeight
);
...
...
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