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
d26462b5
Commit
d26462b5
authored
Oct 21, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Move the font file information out of freetype.c.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
82c140f1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
60 deletions
+40
-60
font.c
dlls/gdi32/font.c
+37
-2
freetype.c
dlls/gdi32/freetype.c
+1
-48
gdi_private.h
dlls/gdi32/gdi_private.h
+2
-10
No files found.
dlls/gdi32/font.c
View file @
d26462b5
...
...
@@ -422,9 +422,37 @@ void free_gdi_font( struct gdi_font *font )
{
if
(
font
->
private
)
font_funcs
->
destroy_font
(
font
);
free_font_handle
(
font
->
handle
);
HeapFree
(
GetProcessHeap
(),
0
,
font
->
fileinfo
);
HeapFree
(
GetProcessHeap
(),
0
,
font
);
}
/* Undocumented structure filled in by GetFontFileInfo */
struct
font_fileinfo
{
FILETIME
writetime
;
LARGE_INTEGER
size
;
WCHAR
path
[
1
];
};
void
set_gdi_font_file_info
(
struct
gdi_font
*
font
,
const
WCHAR
*
file
,
SIZE_T
data_size
)
{
WIN32_FILE_ATTRIBUTE_DATA
info
;
int
len
=
0
;
if
(
file
)
len
=
strlenW
(
file
);
if
(
!
(
font
->
fileinfo
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
offsetof
(
struct
font_fileinfo
,
path
[
len
+
1
]
))))
return
;
if
(
file
&&
GetFileAttributesExW
(
file
,
GetFileExInfoStandard
,
&
info
))
{
font
->
fileinfo
->
writetime
=
info
.
ftLastWriteTime
;
font
->
fileinfo
->
size
.
QuadPart
=
(
LONGLONG
)
info
.
nFileSizeHigh
<<
32
|
info
.
nFileSizeLow
;
strcpyW
(
font
->
fileinfo
->
path
,
file
);
}
else
font
->
fileinfo
->
size
.
QuadPart
=
data_size
;
}
/* font cache */
static
struct
list
gdi_font_list
=
LIST_INIT
(
gdi_font_list
);
...
...
@@ -5179,12 +5207,19 @@ BOOL WINAPI GetFontFileInfo( DWORD instance_id, DWORD unknown, struct font_filei
if
(
!
needed
)
needed
=
&
required_size
;
if
(
!
font
_funcs
||
!
font
)
if
(
!
font
)
{
*
needed
=
0
;
return
FALSE
;
}
return
font_funcs
->
pGetFontFileInfo
(
font
,
unknown
,
info
,
size
,
needed
);
*
needed
=
sizeof
(
*
info
)
+
strlenW
(
font
->
fileinfo
->
path
)
*
sizeof
(
WCHAR
);
if
(
*
needed
>
size
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
}
memcpy
(
info
,
font
->
fileinfo
,
*
needed
);
return
TRUE
;
}
struct
realization_info
...
...
dlls/gdi32/freetype.c
View file @
d26462b5
...
...
@@ -350,7 +350,6 @@ struct tagGdiFont {
VOID
*
GSUB_Table
;
const
VOID
*
vert_feature
;
ULONG
ttc_item_offset
;
/* 0 if font is not a part of TrueType collection */
struct
font_fileinfo
*
fileinfo
;
};
static
inline
GdiFont
*
get_font_ptr
(
struct
gdi_font
*
font
)
{
return
font
->
private
;
}
...
...
@@ -4112,7 +4111,6 @@ static void CDECL freetype_destroy_font( struct gdi_font *gdi_font )
HeapFree
(
GetProcessHeap
(),
0
,
child
);
}
HeapFree
(
GetProcessHeap
(),
0
,
font
->
fileinfo
);
if
(
font
->
ft_face
)
pFT_Done_Face
(
font
->
ft_face
);
if
(
font
->
mapping
)
unmap_font_file
(
font
->
mapping
);
HeapFree
(
GetProcessHeap
(),
0
,
font
->
kern_pairs
);
...
...
@@ -4767,30 +4765,6 @@ static const VOID * get_GSUB_vert_feature(const GdiFont *font)
return
feature
;
}
static
void
fill_fileinfo_from_face
(
GdiFont
*
font
,
Face
*
face
)
{
WIN32_FILE_ATTRIBUTE_DATA
info
;
int
len
;
if
(
!
face
->
file
)
{
font
->
fileinfo
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
font
->
fileinfo
));
font
->
fileinfo
->
size
.
QuadPart
=
face
->
font_data_size
;
return
;
}
len
=
strlenW
(
face
->
file
);
font
->
fileinfo
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
font
->
fileinfo
)
+
len
*
sizeof
(
WCHAR
));
if
(
GetFileAttributesExW
(
face
->
file
,
GetFileExInfoStandard
,
&
info
))
{
font
->
fileinfo
->
writetime
=
info
.
ftLastWriteTime
;
font
->
fileinfo
->
size
.
QuadPart
=
(
LONGLONG
)
info
.
nFileSizeHigh
<<
32
|
info
.
nFileSizeLow
;
strcpyW
(
font
->
fileinfo
->
path
,
face
->
file
);
}
else
memset
(
font
->
fileinfo
,
0
,
sizeof
(
*
font
->
fileinfo
)
+
len
*
sizeof
(
WCHAR
));
}
/*************************************************************
* freetype_SelectFont
*/
...
...
@@ -5183,7 +5157,7 @@ found_face:
goto
done
;
}
fill_fileinfo_from_face
(
ret
,
fac
e
);
set_gdi_font_file_info
(
gdi_font
,
face
->
file
,
face
->
font_data_siz
e
);
ret
->
ntmFlags
=
face
->
ntmFlags
;
pick_charmap
(
ret
->
ft_face
,
ret
->
charset
);
...
...
@@ -7969,26 +7943,6 @@ static BOOL CDECL freetype_GetFontFileData( struct gdi_font *gdi_font, DWORD unk
}
/*************************************************************************
* freetype_GetFontFileInfo
*/
static
BOOL
CDECL
freetype_GetFontFileInfo
(
struct
gdi_font
*
gdi_font
,
DWORD
unknown
,
struct
font_fileinfo
*
info
,
SIZE_T
size
,
SIZE_T
*
needed
)
{
const
GdiFont
*
font
=
get_font_ptr
(
gdi_font
);
*
needed
=
sizeof
(
*
info
)
+
strlenW
(
font
->
fileinfo
->
path
)
*
sizeof
(
WCHAR
);
if
(
*
needed
>
size
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
}
/* path is included too */
memcpy
(
info
,
font
->
fileinfo
,
*
needed
);
return
TRUE
;
}
/*************************************************************************
* Kerning support for TrueType fonts
*/
...
...
@@ -8261,7 +8215,6 @@ static const struct font_backend_funcs font_funcs =
freetype_AddFontMemResourceEx
,
freetype_CreateScalableFontResource
,
freetype_GetFontFileData
,
freetype_GetFontFileInfo
,
freetype_alloc_font
,
freetype_destroy_font
};
...
...
dlls/gdi32/gdi_private.h
View file @
d26462b5
...
...
@@ -301,14 +301,6 @@ struct char_width_info
INT
unk
;
/* unknown */
};
/* Undocumented structure filled in by GetFontFileInfo */
struct
font_fileinfo
{
FILETIME
writetime
;
LARGE_INTEGER
size
;
WCHAR
path
[
1
];
};
typedef
struct
{
FLOAT
eM11
,
eM12
,
eM21
,
eM22
;
}
FMAT2
;
struct
gdi_font
...
...
@@ -324,6 +316,7 @@ struct gdi_font
LOGFONTW
lf
;
FMAT2
matrix
;
BOOL
can_use_bitmap
;
struct
font_fileinfo
*
fileinfo
;
};
struct
font_backend_funcs
...
...
@@ -356,8 +349,6 @@ struct font_backend_funcs
LPCWSTR
font_file
,
LPCWSTR
font_path
);
BOOL
(
CDECL
*
pGetFontFileData
)(
struct
gdi_font
*
font
,
DWORD
unknown
,
UINT64
offset
,
void
*
buff
,
DWORD
buff_size
);
BOOL
(
CDECL
*
pGetFontFileInfo
)(
struct
gdi_font
*
font
,
DWORD
unknown
,
struct
font_fileinfo
*
info
,
SIZE_T
size
,
SIZE_T
*
needed
);
BOOL
(
CDECL
*
alloc_font
)(
struct
gdi_font
*
font
);
void
(
CDECL
*
destroy_font
)(
struct
gdi_font
*
font
);
...
...
@@ -368,6 +359,7 @@ extern void free_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
,
BOOL
can_use_bitmap
)
DECLSPEC_HIDDEN
;
extern
void
set_gdi_font_file_info
(
struct
gdi_font
*
font
,
const
WCHAR
*
file
,
SIZE_T
data_size
)
DECLSPEC_HIDDEN
;
extern
void
font_init
(
void
)
DECLSPEC_HIDDEN
;
/* freetype.c */
...
...
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