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
8201fa14
Commit
8201fa14
authored
Jul 09, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 09, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Fix alignment shifts in RTL case.
parent
6d52bc59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
layout.c
dlls/dwrite/layout.c
+14
-3
layout.c
dlls/dwrite/tests/layout.c
+0
-2
No files found.
dlls/dwrite/layout.c
View file @
8201fa14
...
...
@@ -1137,6 +1137,7 @@ static FLOAT layout_get_line_width(struct dwrite_textlayout *layout,
static
void
layout_apply_leading_alignment
(
struct
dwrite_textlayout
*
layout
)
{
BOOL
is_rtl
=
layout
->
format
.
readingdir
==
DWRITE_READING_DIRECTION_RIGHT_TO_LEFT
;
struct
layout_effective_inline
*
inrun
;
struct
layout_effective_run
*
erun
;
...
...
@@ -1153,11 +1154,12 @@ static void layout_apply_leading_alignment(struct dwrite_textlayout *layout)
inrun
=
layout_get_next_inline_run
(
layout
,
inrun
);
}
layout
->
metrics
.
left
=
0
;
layout
->
metrics
.
left
=
is_rtl
?
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
:
0
.
0
;
}
static
void
layout_apply_trailing_alignment
(
struct
dwrite_textlayout
*
layout
)
{
BOOL
is_rtl
=
layout
->
format
.
readingdir
==
DWRITE_READING_DIRECTION_RIGHT_TO_LEFT
;
struct
layout_effective_inline
*
inrun
;
struct
layout_effective_run
*
erun
;
UINT32
line
;
...
...
@@ -1169,6 +1171,9 @@ static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout)
FLOAT
width
=
layout_get_line_width
(
layout
,
erun
,
inrun
,
line
);
FLOAT
shift
=
layout
->
metrics
.
layoutWidth
-
width
;
if
(
is_rtl
)
shift
*=
-
1
.
0
;
while
(
erun
&&
erun
->
line
==
line
)
{
erun
->
align_dx
=
shift
;
erun
=
layout_get_next_erun
(
layout
,
erun
);
...
...
@@ -1180,11 +1185,12 @@ static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout)
}
}
layout
->
metrics
.
left
=
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
;
layout
->
metrics
.
left
=
is_rtl
?
0
.
0
:
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
;
}
static
void
layout_apply_centered_alignment
(
struct
dwrite_textlayout
*
layout
)
{
BOOL
is_rtl
=
layout
->
format
.
readingdir
==
DWRITE_READING_DIRECTION_RIGHT_TO_LEFT
;
struct
layout_effective_inline
*
inrun
;
struct
layout_effective_run
*
erun
;
UINT32
line
;
...
...
@@ -1196,6 +1202,9 @@ static void layout_apply_centered_alignment(struct dwrite_textlayout *layout)
FLOAT
width
=
layout_get_line_width
(
layout
,
erun
,
inrun
,
line
);
FLOAT
shift
=
(
layout
->
metrics
.
layoutWidth
-
width
)
/
2
.
0
;
if
(
is_rtl
)
shift
*=
-
1
.
0
;
while
(
erun
&&
erun
->
line
==
line
)
{
erun
->
align_dx
=
shift
;
erun
=
layout_get_next_erun
(
layout
,
erun
);
...
...
@@ -1277,6 +1286,7 @@ static void layout_apply_par_alignment(struct dwrite_textlayout *layout)
static
HRESULT
layout_compute_effective_runs
(
struct
dwrite_textlayout
*
layout
)
{
BOOL
is_rtl
=
layout
->
format
.
readingdir
==
DWRITE_READING_DIRECTION_RIGHT_TO_LEFT
;
struct
layout_effective_inline
*
inrun
;
struct
layout_effective_run
*
erun
;
const
struct
layout_run
*
run
;
...
...
@@ -1411,7 +1421,8 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
textpos
+=
layout
->
clustermetrics
[
i
].
length
;
}
layout
->
metrics
.
left
=
layout
->
metrics
.
top
=
0
.
0
;
layout
->
metrics
.
left
=
is_rtl
?
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
:
0
;
layout
->
metrics
.
top
=
0
.
0
;
layout
->
metrics
.
maxBidiReorderingDepth
=
1
;
/* FIXME */
layout
->
metrics
.
height
=
0
.
0
;
...
...
dlls/dwrite/tests/layout.c
View file @
8201fa14
...
...
@@ -3168,7 +3168,6 @@ static void test_SetReadingDirection(void)
hr
=
IDWriteTextLayout_GetMetrics
(
layout
,
&
metrics
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
ok
(
metrics
.
left
==
metrics
.
layoutWidth
-
clusters
[
0
].
width
,
"got %.2f
\n
"
,
metrics
.
left
);
ok
(
metrics
.
top
==
0
.
0
,
"got %.2f
\n
"
,
metrics
.
top
);
ok
(
metrics
.
width
==
clusters
[
0
].
width
,
"got %.2f
\n
"
,
metrics
.
width
);
...
...
@@ -3184,7 +3183,6 @@ todo_wine
hr
=
IDWriteTextLayout_GetMetrics
(
layout
,
&
metrics
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
ok
(
metrics
.
left
==
0
.
0
,
"got %.2f
\n
"
,
metrics
.
left
);
ok
(
metrics
.
top
==
0
.
0
,
"got %.2f
\n
"
,
metrics
.
top
);
ok
(
metrics
.
width
==
clusters
[
0
].
width
,
"got %.2f
\n
"
,
metrics
.
width
);
...
...
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