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
6c5dc58a
Commit
6c5dc58a
authored
Nov 04, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Move the remove_font() function out of freetype.c.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
28764bd0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
44 deletions
+32
-44
font.c
dlls/gdi32/font.c
+32
-12
freetype.c
dlls/gdi32/freetype.c
+0
-29
gdi_private.h
dlls/gdi32/gdi_private.h
+0
-3
No files found.
dlls/gdi32/font.c
View file @
6c5dc58a
...
...
@@ -574,7 +574,7 @@ static struct gdi_font_family *create_family( const WCHAR *name, const WCHAR *se
return
family
;
}
void
release_family
(
struct
gdi_font_family
*
family
)
static
void
release_family
(
struct
gdi_font_family
*
family
)
{
if
(
--
family
->
refcount
)
return
;
assert
(
list_empty
(
&
family
->
faces
));
...
...
@@ -754,7 +754,7 @@ static void reorder_font_list(void)
default_sans
=
set_default_family
(
default_sans_list
);
}
void
release_face
(
struct
gdi_font_face
*
face
)
static
void
release_face
(
struct
gdi_font_face
*
face
)
{
if
(
--
face
->
refcount
)
return
;
if
(
face
->
family
)
...
...
@@ -770,6 +770,33 @@ void release_face( struct gdi_font_face *face )
HeapFree
(
GetProcessHeap
(),
0
,
face
);
}
static
int
remove_font
(
const
WCHAR
*
file
,
DWORD
flags
)
{
struct
gdi_font_family
*
family
,
*
family_next
;
struct
gdi_font_face
*
face
,
*
face_next
;
int
count
=
0
;
EnterCriticalSection
(
&
font_cs
);
LIST_FOR_EACH_ENTRY_SAFE
(
family
,
family_next
,
&
font_list
,
struct
gdi_font_family
,
entry
)
{
family
->
refcount
++
;
LIST_FOR_EACH_ENTRY_SAFE
(
face
,
face_next
,
&
family
->
faces
,
struct
gdi_font_face
,
entry
)
{
if
(
!
face
->
file
)
continue
;
if
(
LOWORD
(
face
->
flags
)
!=
LOWORD
(
flags
))
continue
;
if
(
!
strcmpiW
(
face
->
file
,
file
))
{
TRACE
(
"removing matching face %s refcount %d
\n
"
,
debugstr_w
(
face
->
file
),
face
->
refcount
);
release_face
(
face
);
count
++
;
}
}
release_family
(
family
);
}
LeaveCriticalSection
(
&
font_cs
);
return
count
;
}
static
inline
BOOL
faces_equal
(
const
struct
gdi_font_face
*
f1
,
const
struct
gdi_font_face
*
f2
)
{
if
(
strcmpiW
(
f1
->
full_name
,
f2
->
full_name
))
return
FALSE
;
...
...
@@ -7351,15 +7378,10 @@ static BOOL remove_system_font_resource( LPCWSTR file, DWORD flags )
int
ret
;
get_fonts_win_dir_path
(
file
,
path
);
EnterCriticalSection
(
&
font_cs
);
ret
=
font_funcs
->
remove_font
(
path
,
flags
);
LeaveCriticalSection
(
&
font_cs
);
if
(
!
ret
)
if
(
!
(
ret
=
remove_font
(
path
,
flags
)))
{
get_fonts_data_dir_path
(
file
,
path
);
EnterCriticalSection
(
&
font_cs
);
ret
=
font_funcs
->
remove_font
(
path
,
flags
);
LeaveCriticalSection
(
&
font_cs
);
ret
=
remove_font
(
path
,
flags
);
}
return
ret
;
}
...
...
@@ -7395,9 +7417,7 @@ static BOOL remove_font_resource( LPCWSTR file, DWORD flags )
DWORD
addfont_flags
=
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_RESOURCE
;
if
(
!
(
flags
&
FR_PRIVATE
))
addfont_flags
|=
ADDFONT_ADD_TO_CACHE
;
EnterCriticalSection
(
&
font_cs
);
ret
=
font_funcs
->
remove_font
(
path
,
addfont_flags
);
LeaveCriticalSection
(
&
font_cs
);
ret
=
remove_font
(
path
,
addfont_flags
);
}
if
(
!
ret
&&
!
strchrW
(
file
,
'\\'
))
...
...
dlls/gdi32/freetype.c
View file @
6c5dc58a
...
...
@@ -1178,34 +1178,6 @@ static INT CDECL freetype_add_mem_font( void *ptr, SIZE_T size, DWORD flags )
return
AddFontToList
(
NULL
,
NULL
,
ptr
,
size
,
flags
);
}
/*************************************************************
* freetype_remove_font
*/
static
INT
CDECL
freetype_remove_font
(
const
WCHAR
*
file
,
DWORD
flags
)
{
Family
*
family
,
*
family_next
;
Face
*
face
,
*
face_next
;
int
count
=
0
;
LIST_FOR_EACH_ENTRY_SAFE
(
family
,
family_next
,
&
font_list
,
Family
,
entry
)
{
family
->
refcount
++
;
LIST_FOR_EACH_ENTRY_SAFE
(
face
,
face_next
,
&
family
->
faces
,
Face
,
entry
)
{
if
(
!
face
->
file
)
continue
;
if
(
LOWORD
(
face
->
flags
)
!=
LOWORD
(
flags
))
continue
;
if
(
!
strcmpiW
(
face
->
file
,
file
))
{
TRACE
(
"removing matching face %s refcount %d
\n
"
,
debugstr_w
(
face
->
file
),
face
->
refcount
);
release_face
(
face
);
count
++
;
}
}
release_family
(
family
);
}
return
count
;
}
#ifdef __ANDROID__
static
BOOL
ReadFontDir
(
const
char
*
dirname
,
BOOL
external_fonts
)
{
...
...
@@ -4431,7 +4403,6 @@ static const struct font_backend_funcs font_funcs =
freetype_load_fonts
,
freetype_add_font
,
freetype_add_mem_font
,
freetype_remove_font
,
freetype_load_font
,
freetype_get_font_data
,
freetype_get_aa_flags
,
...
...
dlls/gdi32/gdi_private.h
View file @
6c5dc58a
...
...
@@ -430,7 +430,6 @@ struct font_backend_funcs
void
(
CDECL
*
load_fonts
)(
void
);
INT
(
CDECL
*
add_font
)(
const
WCHAR
*
file
,
DWORD
flags
);
INT
(
CDECL
*
add_mem_font
)(
void
*
ptr
,
SIZE_T
size
,
DWORD
flags
);
BOOL
(
CDECL
*
remove_font
)(
const
WCHAR
*
file
,
DWORD
flags
);
BOOL
(
CDECL
*
load_font
)(
struct
gdi_font
*
gdi_font
);
DWORD
(
CDECL
*
get_font_data
)(
struct
gdi_font
*
gdi_font
,
DWORD
table
,
DWORD
offset
,
...
...
@@ -452,9 +451,7 @@ struct font_backend_funcs
extern
const
WCHAR
*
get_gdi_font_subst
(
const
WCHAR
*
from_name
,
int
from_charset
,
int
*
to_charset
)
DECLSPEC_HIDDEN
;
extern
struct
list
font_list
DECLSPEC_HIDDEN
;
extern
void
release_family
(
struct
gdi_font_family
*
family
)
DECLSPEC_HIDDEN
;
extern
struct
gdi_font_family
*
find_family_from_any_name
(
const
WCHAR
*
name
)
DECLSPEC_HIDDEN
;
extern
void
release_face
(
struct
gdi_font_face
*
face
)
DECLSPEC_HIDDEN
;
extern
int
add_gdi_face
(
const
WCHAR
*
family_name
,
const
WCHAR
*
second_name
,
const
WCHAR
*
style
,
const
WCHAR
*
fullname
,
const
WCHAR
*
file
,
void
*
data_ptr
,
SIZE_T
data_size
,
UINT
index
,
FONTSIGNATURE
fs
,
...
...
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