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
f3a75923
Commit
f3a75923
authored
Oct 26, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Move the fonts directory helper functions out of freetype.c.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
df335e34
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
53 deletions
+56
-53
Makefile.in
dlls/gdi32/Makefile.in
+1
-1
font.c
dlls/gdi32/font.c
+43
-0
freetype.c
dlls/gdi32/freetype.c
+8
-52
gdi_private.h
dlls/gdi32/gdi_private.h
+4
-0
No files found.
dlls/gdi32/Makefile.in
View file @
f3a75923
...
...
@@ -52,4 +52,4 @@ C_SRCS = \
RC_SRCS
=
gdi32.rc
f
reetype
_EXTRADEFS
=
-DWINE_FONT_DIR
=
\"
`
${
MAKEDEP
}
-R
${
datadir
}
/wine
${
fontdir
}
`
\"
f
ont
_EXTRADEFS
=
-DWINE_FONT_DIR
=
\"
`
${
MAKEDEP
}
-R
${
datadir
}
/wine
${
fontdir
}
`
\"
dlls/gdi32/font.c
View file @
f3a75923
...
...
@@ -350,6 +350,49 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
};
CRITICAL_SECTION
font_cs
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
#ifndef WINE_FONT_DIR
#define WINE_FONT_DIR "fonts"
#endif
void
get_font_dir
(
WCHAR
*
path
)
{
static
const
WCHAR
slashW
[]
=
{
'\\'
,
0
};
static
const
WCHAR
fontsW
[]
=
{
'\\'
,
'f'
,
'o'
,
'n'
,
't'
,
's'
,
0
};
static
const
WCHAR
winedatadirW
[]
=
{
'W'
,
'I'
,
'N'
,
'E'
,
'D'
,
'A'
,
'T'
,
'A'
,
'D'
,
'I'
,
'R'
,
0
};
static
const
WCHAR
winebuilddirW
[]
=
{
'W'
,
'I'
,
'N'
,
'E'
,
'B'
,
'U'
,
'I'
,
'L'
,
'D'
,
'D'
,
'I'
,
'R'
,
0
};
if
(
GetEnvironmentVariableW
(
winedatadirW
,
path
,
MAX_PATH
))
{
const
char
fontdir
[]
=
WINE_FONT_DIR
;
strcatW
(
path
,
slashW
);
MultiByteToWideChar
(
CP_ACP
,
0
,
fontdir
,
-
1
,
path
+
strlenW
(
path
),
MAX_PATH
-
strlenW
(
path
)
);
}
else
if
(
GetEnvironmentVariableW
(
winebuilddirW
,
path
,
MAX_PATH
))
{
strcatW
(
path
,
fontsW
);
}
if
(
path
[
5
]
==
':'
)
memmove
(
path
,
path
+
4
,
(
strlenW
(
path
)
-
3
)
*
sizeof
(
WCHAR
)
);
else
path
[
1
]
=
'\\'
;
/* change \??\ to \\?\ */
}
void
get_fonts_data_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
{
static
const
WCHAR
slashW
[]
=
{
'\\'
,
0
};
get_font_dir
(
path
);
strcatW
(
path
,
slashW
);
strcatW
(
path
,
file
);
}
void
get_fonts_win_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
{
static
const
WCHAR
fontsW
[]
=
{
'\\'
,
'f'
,
'o'
,
'n'
,
't'
,
's'
,
'\\'
,
0
};
GetWindowsDirectoryW
(
path
,
MAX_PATH
);
strcatW
(
path
,
fontsW
);
strcatW
(
path
,
file
);
}
/* realized font objects */
#define FIRST_FONT_HANDLE 1
...
...
dlls/gdi32/freetype.c
View file @
f3a75923
...
...
@@ -225,10 +225,6 @@ MAKE_FUNCPTR(FcPatternGetString);
#define GASP_GRIDFIT 0x01
#define GASP_DOGRAY 0x02
#ifndef WINE_FONT_DIR
#define WINE_FONT_DIR "fonts"
#endif
/* This is basically a copy of FT_Bitmap_Size with an extra element added */
typedef
struct
{
FT_Short
height
;
...
...
@@ -2858,46 +2854,6 @@ static void load_mac_fonts(void)
#endif
static
void
get_font_dir
(
WCHAR
*
path
)
{
static
const
WCHAR
slashW
[]
=
{
'\\'
,
0
};
static
const
WCHAR
fontsW
[]
=
{
'\\'
,
'f'
,
'o'
,
'n'
,
't'
,
's'
,
0
};
static
const
WCHAR
winedatadirW
[]
=
{
'W'
,
'I'
,
'N'
,
'E'
,
'D'
,
'A'
,
'T'
,
'A'
,
'D'
,
'I'
,
'R'
,
0
};
static
const
WCHAR
winebuilddirW
[]
=
{
'W'
,
'I'
,
'N'
,
'E'
,
'B'
,
'U'
,
'I'
,
'L'
,
'D'
,
'D'
,
'I'
,
'R'
,
0
};
if
(
GetEnvironmentVariableW
(
winedatadirW
,
path
,
MAX_PATH
))
{
const
char
fontdir
[]
=
WINE_FONT_DIR
;
strcatW
(
path
,
slashW
);
MultiByteToWideChar
(
CP_ACP
,
0
,
fontdir
,
-
1
,
path
+
strlenW
(
path
),
MAX_PATH
-
strlenW
(
path
)
);
}
else
if
(
GetEnvironmentVariableW
(
winebuilddirW
,
path
,
MAX_PATH
))
{
strcatW
(
path
,
fontsW
);
}
if
(
path
[
5
]
==
':'
)
memmove
(
path
,
path
+
4
,
(
strlenW
(
path
)
-
3
)
*
sizeof
(
WCHAR
)
);
else
path
[
1
]
=
'\\'
;
/* change \??\ to \\?\ */
}
static
void
get_data_dir_path
(
LPCWSTR
file
,
WCHAR
*
path
)
{
static
const
WCHAR
slashW
[]
=
{
'\\'
,
'\0'
};
get_font_dir
(
path
);
strcatW
(
path
,
slashW
);
strcatW
(
path
,
file
);
}
static
void
get_winfonts_dir_path
(
LPCWSTR
file
,
WCHAR
*
path
)
{
static
const
WCHAR
slashW
[]
=
{
'\\'
,
'\0'
};
GetWindowsDirectoryW
(
path
,
MAX_PATH
);
strcatW
(
path
,
fontsW
);
strcatW
(
path
,
slashW
);
strcatW
(
path
,
file
);
}
static
void
load_system_fonts
(
void
)
{
HKEY
hkey
;
...
...
@@ -2910,10 +2866,10 @@ static void load_system_fonts(void)
dlen
=
sizeof
(
data
);
if
(
RegQueryValueExW
(
hkey
,
*
value
,
0
,
&
type
,
(
void
*
)
data
,
&
dlen
)
==
ERROR_SUCCESS
&&
type
==
REG_SZ
)
{
get_
winfonts
_dir_path
(
data
,
pathW
);
get_
fonts_win
_dir_path
(
data
,
pathW
);
if
(
!
add_font_resource
(
pathW
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_TO_CACHE
))
{
get_data_dir_path
(
data
,
pathW
);
get_
fonts_
data_dir_path
(
data
,
pathW
);
add_font_resource
(
pathW
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_TO_CACHE
);
}
}
...
...
@@ -3110,12 +3066,12 @@ static INT CDECL freetype_AddFontResourceEx(LPCWSTR file, DWORD flags, PVOID pdv
if
(
!
ret
&&
!
strchrW
(
file
,
'\\'
))
{
/* Try in %WINDIR%/fonts, needed for Fotobuch Designer */
get_
winfonts
_dir_path
(
file
,
path
);
get_
fonts_win
_dir_path
(
file
,
path
);
ret
=
add_font_resource
(
path
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_RESOURCE
);
/* Try in datadir/fonts (or builddir/fonts), needed for Magic the Gathering Online */
if
(
!
ret
)
{
get_data_dir_path
(
file
,
path
);
get_
fonts_
data_dir_path
(
file
,
path
);
ret
=
add_font_resource
(
path
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_RESOURCE
);
}
}
...
...
@@ -3163,11 +3119,11 @@ static BOOL CDECL freetype_RemoveFontResourceEx(LPCWSTR file, DWORD flags, PVOID
if
(
!
ret
&&
!
strchrW
(
file
,
'\\'
))
{
get_
winfonts
_dir_path
(
file
,
path
);
get_
fonts_win
_dir_path
(
file
,
path
);
ret
=
remove_font_resource
(
path
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_RESOURCE
);
if
(
!
ret
)
{
get_data_dir_path
(
file
,
path
);
get_
fonts_
data_dir_path
(
file
,
path
);
ret
=
remove_font_resource
(
path
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_RESOURCE
);
}
}
...
...
@@ -3615,10 +3571,10 @@ static void init_font_list(void)
{
WCHAR
pathW
[
MAX_PATH
];
get_
winfonts
_dir_path
(
data
,
pathW
);
get_
fonts_win
_dir_path
(
data
,
pathW
);
if
(
!
add_font_resource
(
pathW
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_TO_CACHE
))
{
get_data_dir_path
(
data
,
pathW
);
get_
fonts_
data_dir_path
(
data
,
pathW
);
add_font_resource
(
pathW
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_TO_CACHE
);
}
}
...
...
dlls/gdi32/gdi_private.h
View file @
f3a75923
...
...
@@ -382,6 +382,10 @@ struct font_backend_funcs
void
(
CDECL
*
destroy_font
)(
struct
gdi_font
*
font
);
};
extern
void
get_font_dir
(
WCHAR
*
path
)
DECLSPEC_HIDDEN
;
extern
void
get_fonts_data_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
DECLSPEC_HIDDEN
;
extern
void
get_fonts_win_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
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
cache_gdi_font
(
struct
gdi_font
*
font
)
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