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
87bc6aac
Commit
87bc6aac
authored
Feb 22, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Correct return glyph origins for RTL runs.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7315afbc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
56 deletions
+27
-56
main.c
dlls/dwrite/main.c
+27
-55
font.c
dlls/dwrite/tests/font.c
+0
-1
No files found.
dlls/dwrite/main.c
View file @
87bc6aac
...
...
@@ -1553,74 +1553,46 @@ static HRESULT WINAPI dwritefactory4_TranslateColorGlyphRun(IDWriteFactory7 *ifa
static
HRESULT
compute_glyph_origins
(
DWRITE_GLYPH_RUN
const
*
run
,
DWRITE_MEASURING_MODE
measuring_mode
,
D2D1_POINT_2F
baseline_origin
,
DWRITE_MATRIX
const
*
transform
,
D2D1_POINT_2F
*
origins
)
{
IDWriteFontFace1
*
fontface1
=
NULL
;
DWRITE_FONT_METRICS
metrics
;
FLOAT
rtl_factor
;
HRESULT
hr
;
UINT32
i
;
struct
dwrite_fontface
*
font_obj
;
unsigned
int
i
;
float
advance
;
rtl_factor
=
run
->
bidiLevel
&
1
?
-
1
.
0
f
:
1
.
0
f
;
font_obj
=
unsafe_impl_from_IDWriteFontFace
(
run
->
fontFace
)
;
if
(
run
->
fontFace
)
{
IDWriteFontFace_GetMetrics
(
run
->
fontFace
,
&
metrics
);
if
(
FAILED
(
hr
=
IDWriteFontFace_QueryInterface
(
run
->
fontFace
,
&
IID_IDWriteFontFace1
,
(
void
**
)
&
fontface1
)))
WARN
(
"Failed to get IDWriteFontFace1, %#x.
\n
"
,
hr
);
}
for
(
i
=
0
;
i
<
run
->
glyphCount
;
++
i
)
{
origins
[
i
]
=
baseline_origin
;
for
(
i
=
0
;
i
<
run
->
glyphCount
;
i
++
)
{
FLOAT
advance
;
if
(
run
->
bidiLevel
&
1
)
{
advance
=
fontface_get_scaled_design_advance
(
font_obj
,
measuring_mode
,
run
->
fontEmSize
,
1
.
0
f
,
transform
,
run
->
glyphIndices
[
i
],
run
->
isSideways
);
/* Use nominal advances if not provided by caller. */
if
(
run
->
glyphAdvances
)
advance
=
rtl_factor
*
run
->
glyphAdvances
[
i
];
else
{
INT32
a
;
origins
[
i
].
x
-=
advance
;
advance
=
0
.
0
f
;
switch
(
measuring_mode
)
if
(
run
->
glyphOffsets
)
{
case
DWRITE_MEASURING_MODE_NATURAL
:
if
(
SUCCEEDED
(
IDWriteFontFace1_GetDesignGlyphAdvances
(
fontface1
,
1
,
run
->
glyphIndices
+
i
,
&
a
,
run
->
isSideways
)))
advance
=
rtl_factor
*
get_scaled_advance_width
(
a
,
run
->
fontEmSize
,
&
metrics
);
break
;
case
DWRITE_MEASURING_MODE_GDI_CLASSIC
:
case
DWRITE_MEASURING_MODE_GDI_NATURAL
:
if
(
SUCCEEDED
(
IDWriteFontFace1_GetGdiCompatibleGlyphAdvances
(
fontface1
,
run
->
fontEmSize
,
1
.
0
f
,
transform
,
measuring_mode
==
DWRITE_MEASURING_MODE_GDI_NATURAL
,
run
->
isSideways
,
1
,
run
->
glyphIndices
+
i
,
&
a
)))
advance
=
rtl_factor
*
floorf
(
a
*
run
->
fontEmSize
/
metrics
.
designUnitsPerEm
+
0
.
5
f
);
break
;
default:
;
}
origins
[
i
].
x
-=
run
->
glyphOffsets
[
i
].
advanceOffset
;
origins
[
i
].
y
-=
run
->
glyphOffsets
[
i
].
ascenderOffset
;
}
origins
[
i
]
=
baseline_origin
;
/* Apply offsets. */
if
(
run
->
glyphOffsets
)
{
FLOAT
advanceoffset
=
rtl_factor
*
run
->
glyphOffsets
[
i
].
advanceOffset
;
FLOAT
ascenderoffset
=
-
run
->
glyphOffsets
[
i
].
ascenderOffset
;
if
(
run
->
isSideways
)
{
origins
[
i
].
x
+=
ascenderoffset
;
origins
[
i
].
y
+=
advanceoffset
;
}
else
{
origins
[
i
].
x
+=
advanceoffset
;
origins
[
i
].
y
+=
ascenderoffset
;
baseline_origin
.
x
-=
run
->
glyphAdvances
?
run
->
glyphAdvances
[
i
]
:
advance
;
}
else
{
if
(
run
->
glyphOffsets
)
{
origins
[
i
].
x
+=
run
->
glyphOffsets
[
i
].
advanceOffset
;
origins
[
i
].
y
-=
run
->
glyphOffsets
[
i
].
ascenderOffset
;
}
if
(
run
->
isSideways
)
baseline_origin
.
y
+=
advance
;
else
baseline_origin
.
x
+=
advance
;
baseline_origin
.
x
+=
run
->
glyphAdvances
?
run
->
glyphAdvances
[
i
]
:
fontface_get_scaled_design_advance
(
font_obj
,
measuring_mode
,
run
->
fontEmSize
,
1
.
0
f
,
transform
,
run
->
glyphIndices
[
i
],
run
->
isSideways
);
}
}
if
(
fontface1
)
IDWriteFontFace1_Release
(
fontface1
);
return
S_OK
;
}
...
...
dlls/dwrite/tests/font.c
View file @
87bc6aac
...
...
@@ -8468,7 +8468,6 @@ static void test_ComputeGlyphOrigins(void)
ok
(
hr
==
S_OK
,
"%u: failed to compute glyph origins, hr %#x.
\n
"
,
i
,
hr
);
for
(
j
=
0
;
j
<
run
.
glyphCount
;
++
j
)
{
todo_wine_if
(
run
.
bidiLevel
&
1
)
ok
(
!
memcmp
(
&
origins
[
j
],
&
expected_origins
[
j
],
sizeof
(
origins
[
j
])),
"%u: unexpected origin[%u] (%f, %f) - (%f, %f).
\n
"
,
i
,
j
,
origins
[
j
].
x
,
origins
[
j
].
y
,
expected_origins
[
j
].
x
,
expected_origins
[
j
].
y
);
...
...
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