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
76f421b0
Commit
76f421b0
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: Use correct glyph origins during rendering.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
87bc6aac
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
68 deletions
+29
-68
dwrite_private.h
dlls/dwrite/dwrite_private.h
+2
-0
font.c
dlls/dwrite/font.c
+5
-52
freetype.c
dlls/dwrite/freetype.c
+21
-15
main.c
dlls/dwrite/main.c
+1
-1
No files found.
dlls/dwrite/dwrite_private.h
View file @
76f421b0
...
...
@@ -347,6 +347,8 @@ extern HRESULT create_inmemory_fileloader(IDWriteInMemoryFontFileLoader **loader
extern
HRESULT
create_font_resource
(
IDWriteFactory7
*
factory
,
IDWriteFontFile
*
file
,
UINT32
face_index
,
IDWriteFontResource
**
resource
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_fontset_builder
(
IDWriteFactory7
*
factory
,
IDWriteFontSetBuilder2
**
ret
)
DECLSPEC_HIDDEN
;
extern
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
)
DECLSPEC_HIDDEN
;
struct
dwrite_fontface
;
...
...
dlls/dwrite/font.c
View file @
76f421b0
...
...
@@ -5918,10 +5918,7 @@ float fontface_get_scaled_design_advance(struct dwrite_fontface *fontface, DWRIT
HRESULT
create_glyphrunanalysis
(
const
struct
glyphrunanalysis_desc
*
desc
,
IDWriteGlyphRunAnalysis
**
ret
)
{
struct
dwrite_glyphrunanalysis
*
analysis
;
struct
dwrite_fontface
*
fontface
;
D2D_POINT_2F
origin
;
FLOAT
rtl_factor
;
UINT32
i
;
unsigned
int
i
;
*
ret
=
NULL
;
...
...
@@ -5977,57 +5974,13 @@ HRESULT create_glyphrunanalysis(const struct glyphrunanalysis_desc *desc, IDWrit
}
analysis
->
run
.
glyphIndices
=
analysis
->
glyphs
;
rtl_factor
=
desc
->
run
->
bidiLevel
&
1
?
-
1
.
0
f
:
1
.
0
f
;
memcpy
(
analysis
->
glyphs
,
desc
->
run
->
glyphIndices
,
desc
->
run
->
glyphCount
*
sizeof
(
*
desc
->
run
->
glyphIndices
));
fontface
=
unsafe_impl_from_IDWriteFontFace
(
desc
->
run
->
fontFace
);
origin
.
x
=
desc
->
origin
.
x
;
origin
.
y
=
desc
->
origin
.
y
;
for
(
i
=
0
;
i
<
desc
->
run
->
glyphCount
;
++
i
)
compute_glyph_origins
(
desc
->
run
,
desc
->
measuring_mode
,
desc
->
origin
,
desc
->
transform
,
analysis
->
origins
);
if
(
analysis
->
flags
&
RUNANALYSIS_USE_TRANSFORM
)
{
float
advance
;
/* Use nominal advances if not provided by caller. */
if
(
desc
->
run
->
glyphAdvances
)
advance
=
rtl_factor
*
desc
->
run
->
glyphAdvances
[
i
];
else
advance
=
rtl_factor
*
fontface_get_scaled_design_advance
(
fontface
,
desc
->
measuring_mode
,
desc
->
run
->
fontEmSize
,
1
.
0
f
,
desc
->
transform
,
desc
->
run
->
glyphIndices
[
i
],
desc
->
run
->
isSideways
);
analysis
->
origins
[
i
]
=
origin
;
if
(
desc
->
run
->
bidiLevel
&
1
)
{
if
(
desc
->
run
->
isSideways
)
analysis
->
origins
[
i
].
y
+=
advance
;
else
analysis
->
origins
[
i
].
x
+=
advance
;
}
/* Offsets are optional, appled to pre-transformed origin. */
if
(
desc
->
run
->
glyphOffsets
)
{
FLOAT
advanceoffset
=
rtl_factor
*
desc
->
run
->
glyphOffsets
[
i
].
advanceOffset
;
FLOAT
ascenderoffset
=
-
desc
->
run
->
glyphOffsets
[
i
].
ascenderOffset
;
if
(
desc
->
run
->
isSideways
)
{
analysis
->
origins
[
i
].
x
+=
ascenderoffset
;
analysis
->
origins
[
i
].
y
+=
advanceoffset
;
}
else
{
analysis
->
origins
[
i
].
x
+=
advanceoffset
;
analysis
->
origins
[
i
].
y
+=
ascenderoffset
;
}
}
if
(
analysis
->
flags
&
RUNANALYSIS_USE_TRANSFORM
)
transform_point
(
analysis
->
origins
+
i
,
&
analysis
->
m
);
if
(
desc
->
run
->
isSideways
)
origin
.
y
+=
advance
;
else
origin
.
x
+=
advance
;
for
(
i
=
0
;
i
<
desc
->
run
->
glyphCount
;
++
i
)
transform_point
(
&
analysis
->
origins
[
i
],
&
analysis
->
m
);
}
*
ret
=
&
analysis
->
IDWriteGlyphRunAnalysis_iface
;
...
...
dlls/dwrite/freetype.c
View file @
76f421b0
...
...
@@ -488,8 +488,8 @@ HRESULT freetype_get_glyphrun_outline(IDWriteFontFace5 *fontface, float emSize,
scaler
.
y_res
=
0
;
EnterCriticalSection
(
&
freetype_cs
);
if
(
pFTC_Manager_LookupSize
(
cache_manager
,
&
scaler
,
&
size
)
==
0
)
{
float
rtl_factor
=
is_rtl
?
-
1
.
0
f
:
1
.
0
f
;
if
(
pFTC_Manager_LookupSize
(
cache_manager
,
&
scaler
,
&
size
)
==
0
)
{
D2D1_POINT_2F
origin
;
unsigned
int
i
;
...
...
@@ -501,7 +501,6 @@ HRESULT freetype_get_glyphrun_outline(IDWriteFontFace5 *fontface, float emSize,
FLOAT
ft_advance
=
size
->
face
->
glyph
->
metrics
.
horiAdvance
>>
6
;
FT_Outline
*
outline
=
&
size
->
face
->
glyph
->
outline
;
D2D1_POINT_2F
glyph_origin
;
float
advance
;
FT_Matrix
m
;
if
(
simulations
&
DWRITE_FONT_SIMULATIONS_BOLD
)
...
...
@@ -514,25 +513,32 @@ HRESULT freetype_get_glyphrun_outline(IDWriteFontFace5 *fontface, float emSize,
pFT_Outline_Transform
(
outline
,
&
m
);
if
(
advances
)
advance
=
rtl_factor
*
advances
[
i
];
else
advance
=
rtl_factor
*
ft_advance
;
glyph_origin
=
origin
;
if
(
is_rtl
)
glyph_origin
.
x
+=
advance
;
{
glyph_origin
.
x
-=
ft_advance
;
/* glyph offsets act as current glyph adjustment */
if
(
offsets
)
if
(
offsets
)
{
glyph_origin
.
x
-=
offsets
[
i
].
advanceOffset
;
glyph_origin
.
y
-=
offsets
[
i
].
ascenderOffset
;
}
origin
.
x
-=
advances
?
advances
[
i
]
:
ft_advance
;
}
else
{
glyph_origin
.
x
+=
rtl_factor
*
offsets
[
i
].
advanceOffset
;
glyph_origin
.
y
-=
offsets
[
i
].
ascenderOffset
;
if
(
offsets
)
{
glyph_origin
.
x
+=
offsets
[
i
].
advanceOffset
;
glyph_origin
.
y
-=
offsets
[
i
].
ascenderOffset
;
}
origin
.
x
+=
advances
?
advances
[
i
]
:
ft_advance
;
}
decompose_outline
(
outline
,
glyph_origin
,
sink
);
origin
.
x
+=
advance
;
}
}
}
...
...
dlls/dwrite/main.c
View file @
76f421b0
...
...
@@ -1550,7 +1550,7 @@ static HRESULT WINAPI dwritefactory4_TranslateColorGlyphRun(IDWriteFactory7 *ifa
return
E_NOTIMPL
;
}
static
HRESULT
compute_glyph_origins
(
DWRITE_GLYPH_RUN
const
*
run
,
DWRITE_MEASURING_MODE
measuring_mode
,
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
)
{
struct
dwrite_fontface
*
font_obj
;
...
...
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