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
c9b21a57
Commit
c9b21a57
authored
Oct 31, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add a helper function to create a font from a face.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ef77b388
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
27 deletions
+26
-27
font.c
dlls/gdi32/font.c
+21
-10
freetype.c
dlls/gdi32/freetype.c
+3
-16
gdi_private.h
dlls/gdi32/gdi_private.h
+2
-1
No files found.
dlls/gdi32/font.c
View file @
c9b21a57
...
@@ -1016,7 +1016,7 @@ static void free_font_handle( DWORD handle )
...
@@ -1016,7 +1016,7 @@ static void free_font_handle( DWORD handle )
}
}
}
}
struct
gdi_font
*
alloc_gdi_font
(
const
WCHAR
*
file
,
void
*
data_ptr
,
SIZE_T
data_size
)
st
atic
st
ruct
gdi_font
*
alloc_gdi_font
(
const
WCHAR
*
file
,
void
*
data_ptr
,
SIZE_T
data_size
)
{
{
UINT
len
=
file
?
strlenW
(
file
)
:
0
;
UINT
len
=
file
?
strlenW
(
file
)
:
0
;
struct
gdi_font
*
font
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
struct
gdi_font
*
font
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
...
@@ -1083,6 +1083,25 @@ void set_gdi_font_names( struct gdi_font *font, const WCHAR *family_name, const
...
@@ -1083,6 +1083,25 @@ void set_gdi_font_names( struct gdi_font *font, const WCHAR *family_name, const
font
->
otm
.
otmpFaceName
=
(
char
*
)
strdupW
(
full_name
);
font
->
otm
.
otmpFaceName
=
(
char
*
)
strdupW
(
full_name
);
}
}
struct
gdi_font
*
create_gdi_font
(
const
struct
gdi_font_face
*
face
,
const
WCHAR
*
family_name
,
const
LOGFONTW
*
lf
)
{
struct
gdi_font
*
font
;
if
(
!
(
font
=
alloc_gdi_font
(
face
->
file
,
face
->
data_ptr
,
face
->
data_size
)))
return
NULL
;
font
->
fs
=
face
->
fs
;
font
->
lf
=
*
lf
;
font
->
fake_italic
=
(
lf
->
lfItalic
&&
!
(
face
->
ntmFlags
&
NTM_ITALIC
));
font
->
fake_bold
=
(
lf
->
lfWeight
>
550
&&
!
(
face
->
ntmFlags
&
NTM_BOLD
));
font
->
scalable
=
face
->
scalable
;
font
->
face_index
=
face
->
face_index
;
font
->
ntmFlags
=
face
->
ntmFlags
;
font
->
aa_flags
=
HIWORD
(
face
->
flags
);
if
(
!
family_name
)
family_name
=
face
->
family
->
family_name
;
set_gdi_font_names
(
font
,
family_name
,
face
->
style_name
,
face
->
full_name
);
return
font
;
}
struct
glyph_metrics
struct
glyph_metrics
{
{
GLYPHMETRICS
gm
;
GLYPHMETRICS
gm
;
...
@@ -1490,22 +1509,14 @@ static void add_child_font( struct gdi_font *font, const WCHAR *family_name )
...
@@ -1490,22 +1509,14 @@ static void add_child_font( struct gdi_font *font, const WCHAR *family_name )
}
}
if
(
!
best_face
)
return
;
if
(
!
best_face
)
return
;
child
=
alloc_gdi_font
(
best_face
->
file
,
best_face
->
data_ptr
,
best_face
->
data_size
);
if
(
!
(
child
=
create_gdi_font
(
best_face
,
family_name
,
&
font
->
lf
)))
return
;
child
->
fake_italic
=
italic
&&
!
(
best_face
->
ntmFlags
&
NTM_ITALIC
);
child
->
fake_bold
=
bold
&&
!
(
best_face
->
ntmFlags
&
NTM_BOLD
);
child
->
lf
=
font
->
lf
;
child
->
matrix
=
font
->
matrix
;
child
->
matrix
=
font
->
matrix
;
child
->
can_use_bitmap
=
font
->
can_use_bitmap
;
child
->
can_use_bitmap
=
font
->
can_use_bitmap
;
child
->
face_index
=
best_face
->
face_index
;
child
->
ntmFlags
=
best_face
->
ntmFlags
;
child
->
aa_flags
=
HIWORD
(
best_face
->
flags
);
child
->
scale_y
=
font
->
scale_y
;
child
->
scale_y
=
font
->
scale_y
;
child
->
aveWidth
=
font
->
aveWidth
;
child
->
aveWidth
=
font
->
aveWidth
;
child
->
charset
=
font
->
charset
;
child
->
charset
=
font
->
charset
;
child
->
codepage
=
font
->
codepage
;
child
->
codepage
=
font
->
codepage
;
child
->
base_font
=
font
;
child
->
base_font
=
font
;
set_gdi_font_names
(
child
,
family_name
,
best_face
->
style_name
,
best_face
->
full_name
);
list_add_tail
(
&
font
->
child_fonts
,
&
child
->
entry
);
list_add_tail
(
&
font
->
child_fonts
,
&
child
->
entry
);
TRACE
(
"created child font %p for base %p
\n
"
,
child
,
font
);
TRACE
(
"created child font %p for base %p
\n
"
,
child
,
font
);
}
}
...
...
dlls/gdi32/freetype.c
View file @
c9b21a57
...
@@ -3274,20 +3274,10 @@ found_face:
...
@@ -3274,20 +3274,10 @@ found_face:
height
=
lf
.
lfHeight
;
height
=
lf
.
lfHeight
;
TRACE
(
"not in cache
\n
"
);
TRACE
(
"not in cache
\n
"
);
font
=
alloc_gdi_font
(
face
->
file
,
face
->
data_ptr
,
face
->
data_size
);
font
=
create_gdi_font
(
face
,
orig_name
,
&
lf
);
font
->
matrix
=
dcmat
;
font
->
matrix
=
dcmat
;
font
->
lf
=
lf
;
font
->
can_use_bitmap
=
can_use_bitmap
;
font
->
can_use_bitmap
=
can_use_bitmap
;
font
->
fake_italic
=
(
it
&&
!
(
face
->
ntmFlags
&
NTM_ITALIC
));
font
->
fake_bold
=
(
bd
&&
!
(
face
->
ntmFlags
&
NTM_BOLD
));
font
->
fs
=
face
->
fs
;
font
->
face_index
=
face
->
face_index
;
font
->
ntmFlags
=
face
->
ntmFlags
;
font
->
aa_flags
=
HIWORD
(
face
->
flags
);
set_gdi_font_names
(
font
,
orig_name
?
orig_name
:
family
->
family_name
,
face
->
style_name
,
face
->
full_name
);
if
(
csi
.
fs
.
fsCsb
[
0
])
{
if
(
csi
.
fs
.
fsCsb
[
0
])
{
font
->
charset
=
lf
.
lfCharSet
;
font
->
charset
=
lf
.
lfCharSet
;
font
->
codepage
=
csi
.
ciACP
;
font
->
codepage
=
csi
.
ciACP
;
...
@@ -3506,6 +3496,7 @@ static void GetEnumStructs(Face *face, const WCHAR *family_name, LPENUMLOGFONTEX
...
@@ -3506,6 +3496,7 @@ static void GetEnumStructs(Face *face, const WCHAR *family_name, LPENUMLOGFONTEX
NEWTEXTMETRICEXW
*
pntm
)
NEWTEXTMETRICEXW
*
pntm
)
{
{
struct
gdi_font
*
font
;
struct
gdi_font
*
font
;
LOGFONTW
lf
=
{
.
lfHeight
=
100
};
if
(
face
->
cached_enum_data
)
if
(
face
->
cached_enum_data
)
{
{
...
@@ -3515,11 +3506,7 @@ static void GetEnumStructs(Face *face, const WCHAR *family_name, LPENUMLOGFONTEX
...
@@ -3515,11 +3506,7 @@ static void GetEnumStructs(Face *face, const WCHAR *family_name, LPENUMLOGFONTEX
return
;
return
;
}
}
font
=
alloc_gdi_font
(
face
->
file
,
face
->
data_ptr
,
face
->
data_size
);
if
(
!
(
font
=
create_gdi_font
(
face
,
family_name
,
&
lf
)))
return
;
font
->
lf
.
lfHeight
=
100
;
font
->
face_index
=
face
->
face_index
;
font
->
ntmFlags
=
face
->
ntmFlags
;
set_gdi_font_names
(
font
,
family_name
,
face
->
style_name
,
face
->
full_name
);
if
(
!
freetype_load_font
(
font
))
if
(
!
freetype_load_font
(
font
))
{
{
...
...
dlls/gdi32/gdi_private.h
View file @
c9b21a57
...
@@ -474,7 +474,6 @@ extern struct gdi_font_family *find_family_from_font_links( const WCHAR *name, c
...
@@ -474,7 +474,6 @@ extern struct gdi_font_family *find_family_from_font_links( const WCHAR *name, c
FONTSIGNATURE
fs
)
DECLSPEC_HIDDEN
;
FONTSIGNATURE
fs
)
DECLSPEC_HIDDEN
;
extern
void
create_child_font_list
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
void
create_child_font_list
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
struct
gdi_font
*
alloc_gdi_font
(
const
WCHAR
*
file
,
void
*
data_ptr
,
SIZE_T
data_size
)
DECLSPEC_HIDDEN
;
extern
void
free_gdi_font
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
void
free_gdi_font
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
void
cache_gdi_font
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
void
cache_gdi_font
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
struct
gdi_font
*
find_cached_gdi_font
(
const
LOGFONTW
*
lf
,
const
FMAT2
*
matrix
,
extern
struct
gdi_font
*
find_cached_gdi_font
(
const
LOGFONTW
*
lf
,
const
FMAT2
*
matrix
,
...
@@ -482,6 +481,8 @@ extern struct gdi_font *find_cached_gdi_font( const LOGFONTW *lf, const FMAT2 *m
...
@@ -482,6 +481,8 @@ extern struct gdi_font *find_cached_gdi_font( const LOGFONTW *lf, const FMAT2 *m
static
inline
const
WCHAR
*
get_gdi_font_name
(
struct
gdi_font
*
font
)
{
return
(
WCHAR
*
)
font
->
otm
.
otmpFamilyName
;
}
static
inline
const
WCHAR
*
get_gdi_font_name
(
struct
gdi_font
*
font
)
{
return
(
WCHAR
*
)
font
->
otm
.
otmpFamilyName
;
}
extern
void
set_gdi_font_names
(
struct
gdi_font
*
font
,
const
WCHAR
*
family_name
,
const
WCHAR
*
style_name
,
extern
void
set_gdi_font_names
(
struct
gdi_font
*
font
,
const
WCHAR
*
family_name
,
const
WCHAR
*
style_name
,
const
WCHAR
*
full_name
)
DECLSPEC_HIDDEN
;
const
WCHAR
*
full_name
)
DECLSPEC_HIDDEN
;
extern
struct
gdi_font
*
create_gdi_font
(
const
struct
gdi_font_face
*
face
,
const
WCHAR
*
family_name
,
const
LOGFONTW
*
lf
)
DECLSPEC_HIDDEN
;
extern
void
*
get_GSUB_vert_feature
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
void
*
get_GSUB_vert_feature
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
void
font_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
font_init
(
void
)
DECLSPEC_HIDDEN
;
extern
CRITICAL_SECTION
font_cs
DECLSPEC_HIDDEN
;
extern
CRITICAL_SECTION
font_cs
DECLSPEC_HIDDEN
;
...
...
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