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
1a8d6f55
Commit
1a8d6f55
authored
Dec 02, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Allocate outline buffers on PE side.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6356717c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
31 deletions
+46
-31
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-1
font.c
dlls/dwrite/font.c
+23
-4
freetype.c
dlls/dwrite/freetype.c
+22
-26
No files found.
dlls/dwrite/dwrite_private.h
View file @
1a8d6f55
...
...
@@ -742,7 +742,7 @@ struct font_backend_funcs
font_object_handle
(
CDECL
*
create_font_object
)(
const
void
*
data_ptr
,
UINT64
data_size
,
unsigned
int
index
);
void
(
CDECL
*
release_font_object
)(
font_object_handle
object
);
void
(
CDECL
*
notify_release
)(
void
*
key
);
int
(
CDECL
*
get_glyph_outline
)(
void
*
key
,
float
em_
size
,
unsigned
int
simulations
,
UINT16
glyph
,
int
(
CDECL
*
get_glyph_outline
)(
font_object_handle
object
,
float
em
size
,
unsigned
int
simulations
,
UINT16
glyph
,
struct
dwrite_outline
*
outline
);
UINT16
(
CDECL
*
get_glyph_count
)(
font_object_handle
object
);
INT32
(
CDECL
*
get_glyph_advance
)(
void
*
key
,
float
em_size
,
UINT16
index
,
DWRITE_MEASURING_MODE
measuring_mode
,
...
...
dlls/dwrite/font.c
View file @
1a8d6f55
...
...
@@ -835,12 +835,13 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace5 *iface,
{
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFace5
(
iface
);
D2D1_POINT_2F
*
origins
,
baseline_origin
=
{
0
};
struct
dwrite_outline
outline
=
{{
0
}}
;
struct
dwrite_outline
outline
,
outline_size
;
D2D1_BEZIER_SEGMENT
segment
;
D2D1_POINT_2F
point
;
DWRITE_GLYPH_RUN
run
;
unsigned
int
i
,
j
,
p
;
HRESULT
hr
;
int
ret
;
TRACE
(
"%p, %.8e, %p, %p, %p, %u, %d, %d, %p.
\n
"
,
iface
,
emSize
,
glyphs
,
advances
,
offsets
,
count
,
is_sideways
,
is_rtl
,
sink
);
...
...
@@ -871,14 +872,32 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace5 *iface,
ID2D1SimplifiedGeometrySink_SetFillMode
(
sink
,
D2D1_FILL_MODE_WINDING
);
memset
(
&
outline_size
,
0
,
sizeof
(
outline_size
));
memset
(
&
outline
,
0
,
sizeof
(
outline
));
for
(
i
=
0
;
i
<
count
;
++
i
)
{
outline
.
tags
.
count
=
outline
.
points
.
count
=
0
;
if
(
font_funcs
->
get_glyph_outline
(
iface
,
emSize
,
fontface
->
simulations
,
glyphs
[
i
],
&
outline
))
EnterCriticalSection
(
&
fontface
->
cs
);
if
(
!
(
ret
=
font_funcs
->
get_glyph_outline
(
fontface
->
get_font_object
(
fontface
),
emSize
,
fontface
->
simulations
,
glyphs
[
i
],
&
outline_size
)))
{
WARN
(
"Failed to get glyph outline for glyph %u.
\n
"
,
glyphs
[
i
]);
continue
;
dwrite_array_reserve
((
void
**
)
&
outline
.
tags
.
values
,
&
outline
.
tags
.
size
,
outline_size
.
tags
.
count
,
sizeof
(
*
outline
.
tags
.
values
));
dwrite_array_reserve
((
void
**
)
&
outline
.
points
.
values
,
&
outline
.
points
.
size
,
outline_size
.
points
.
count
,
sizeof
(
*
outline
.
points
.
values
));
if
((
ret
=
font_funcs
->
get_glyph_outline
(
fontface
->
get_font_object
(
fontface
),
emSize
,
fontface
->
simulations
,
glyphs
[
i
],
&
outline
)))
{
WARN
(
"Failed to get glyph outline for glyph %u.
\n
"
,
glyphs
[
i
]);
}
}
LeaveCriticalSection
(
&
fontface
->
cs
);
if
(
ret
)
continue
;
for
(
j
=
0
,
p
=
0
;
j
<
outline
.
tags
.
count
;
++
j
)
{
...
...
dlls/dwrite/freetype.c
View file @
1a8d6f55
...
...
@@ -318,11 +318,8 @@ static inline void ft_vector_to_d2d_point(const FT_Vector *v, D2D1_POINT_2F *p)
static
int
dwrite_outline_push_tag
(
struct
dwrite_outline
*
outline
,
unsigned
char
tag
)
{
if
(
!
dwrite_array_reserve
((
void
**
)
&
outline
->
tags
.
values
,
&
outline
->
tags
.
size
,
outline
->
tags
.
count
+
1
,
sizeof
(
*
outline
->
tags
.
values
)))
{
if
(
outline
->
tags
.
size
<
outline
->
tags
.
count
+
1
)
return
1
;
}
outline
->
tags
.
values
[
outline
->
tags
.
count
++
]
=
tag
;
...
...
@@ -331,11 +328,8 @@ static int dwrite_outline_push_tag(struct dwrite_outline *outline, unsigned char
static
int
dwrite_outline_push_points
(
struct
dwrite_outline
*
outline
,
const
D2D1_POINT_2F
*
points
,
unsigned
int
count
)
{
if
(
!
dwrite_array_reserve
((
void
**
)
&
outline
->
points
.
values
,
&
outline
->
points
.
size
,
outline
->
points
.
count
+
count
,
sizeof
(
*
outline
->
points
.
values
)))
{
if
(
outline
->
points
.
size
<
outline
->
points
.
count
+
count
)
return
1
;
}
memcpy
(
&
outline
->
points
.
values
[
outline
->
points
.
count
],
points
,
sizeof
(
*
points
)
*
count
);
outline
->
points
.
count
+=
count
;
...
...
@@ -512,30 +506,25 @@ static void embolden_glyph(FT_Glyph glyph, FLOAT emsize)
embolden_glyph_outline
(
&
outline_glyph
->
outline
,
emsize
);
}
static
int
CDECL
freetype_get_glyph_outline
(
void
*
key
,
float
emS
ize
,
unsigned
int
simulations
,
static
int
CDECL
freetype_get_glyph_outline
(
font_object_handle
object
,
float
ems
ize
,
unsigned
int
simulations
,
UINT16
glyph
,
struct
dwrite_outline
*
outline
)
{
FT
C_ScalerRec
scaler
;
FT
_Face
face
=
object
;
FT_Size
size
;
int
ret
;
int
ret
=
0
;
scaler
.
face_id
=
key
;
scaler
.
width
=
emSize
;
scaler
.
height
=
emSize
;
scaler
.
pixel
=
1
;
scaler
.
x_res
=
0
;
scaler
.
y_res
=
0
;
if
(
!
(
size
=
freetype_set_face_size
(
face
,
emsize
)))
return
0
;
RtlEnterCriticalSection
(
&
freetype_cs
);
if
(
!
(
ret
=
pFTC_Manager_LookupSize
(
cache_manager
,
&
scaler
,
&
size
)))
if
(
!
pFT_Load_Glyph
(
face
,
glyph
,
FT_LOAD_NO_BITMAP
))
{
if
(
pFT_Load_Glyph
(
size
->
face
,
glyph
,
FT_LOAD_NO_BITMAP
)
==
0
)
{
FT_Outline
*
ft_outline
=
&
size
->
face
->
glyph
->
outline
;
FT_Matrix
m
;
FT_Outline
*
ft_outline
=
&
face
->
glyph
->
outline
;
FT_Matrix
m
;
if
(
outline
->
points
.
values
)
{
if
(
simulations
&
DWRITE_FONT_SIMULATIONS_BOLD
)
embolden_glyph_outline
(
ft_outline
,
em
S
ize
);
embolden_glyph_outline
(
ft_outline
,
em
s
ize
);
m
.
xx
=
1
<<
16
;
m
.
xy
=
simulations
&
DWRITE_FONT_SIMULATIONS_OBLIQUE
?
(
1
<<
16
)
/
3
:
0
;
...
...
@@ -546,8 +535,15 @@ static int CDECL freetype_get_glyph_outline(void *key, float emSize, unsigned in
ret
=
decompose_outline
(
ft_outline
,
outline
);
}
else
{
/* Intentionally overestimate numbers to keep it simple. */
outline
->
points
.
count
=
ft_outline
->
n_points
*
3
;
outline
->
tags
.
count
=
ft_outline
->
n_points
+
ft_outline
->
n_contours
*
2
;
}
}
RtlLeaveCriticalSection
(
&
freetype_cs
);
pFT_Done_Size
(
size
);
return
ret
;
}
...
...
@@ -856,7 +852,7 @@ static void CDECL null_notify_release(void *key)
{
}
static
int
CDECL
null_get_glyph_outline
(
void
*
key
,
float
emSize
,
unsigned
int
simulations
,
static
int
CDECL
null_get_glyph_outline
(
font_object_handle
object
,
float
emSize
,
unsigned
int
simulations
,
UINT16
glyph
,
struct
dwrite_outline
*
outline
)
{
return
1
;
...
...
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