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
7b291a09
Commit
7b291a09
authored
Oct 27, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Move the loading of filesystem fonts out of freetype.c.
The fonts Path value now expects DOS paths. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2c1a42bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
85 deletions
+58
-85
font.c
dlls/gdi32/font.c
+54
-14
freetype.c
dlls/gdi32/freetype.c
+3
-70
gdi_private.h
dlls/gdi32/gdi_private.h
+1
-1
No files found.
dlls/gdi32/font.c
View file @
7b291a09
...
...
@@ -359,36 +359,26 @@ CRITICAL_SECTION font_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
#define WINE_FONT_DIR "fonts"
#endif
void
get_font_dir
(
WCHAR
*
path
)
static
void
get_fonts_data_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
{
static
const
WCHAR
slashW
[]
=
{
'\\'
,
0
};
static
const
WCHAR
fontsW
[]
=
{
'\\'
,
'f'
,
'o'
,
'n'
,
't'
,
's'
,
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
);
const
char
fontdir
[]
=
"
\\
"
WINE_FONT_DIR
"
\\
"
;
MultiByteToWideChar
(
CP_ACP
,
0
,
fontdir
,
-
1
,
path
+
strlenW
(
path
),
MAX_PATH
-
strlenW
(
path
)
);
}
else
if
(
GetEnvironmentVariableW
(
winebuilddirW
,
path
,
MAX_PATH
))
{
strcatW
(
path
,
fontsW
);
}
strcatW
(
path
,
file
);
if
(
path
[
5
]
==
':'
)
memmove
(
path
,
path
+
4
,
(
strlenW
(
path
)
-
3
)
*
sizeof
(
WCHAR
)
);
else
path
[
1
]
=
'\\'
;
/* change \??\ to \\?\ */
}
static
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
);
}
static
void
get_fonts_win_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
{
static
const
WCHAR
fontsW
[]
=
{
'\\'
,
'f'
,
'o'
,
'n'
,
't'
,
's'
,
'\\'
,
0
};
...
...
@@ -5402,6 +5392,56 @@ void load_system_bitmap_fonts(void)
RegCloseKey
(
hkey
);
}
static
void
load_directory_fonts
(
WCHAR
*
path
,
UINT
flags
)
{
HANDLE
handle
;
WIN32_FIND_DATAW
data
;
WCHAR
*
p
;
p
=
path
+
strlenW
(
path
)
-
1
;
TRACE
(
"loading fonts from %s
\n
"
,
debugstr_w
(
path
)
);
handle
=
FindFirstFileW
(
path
,
&
data
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
return
;
do
{
if
(
data
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
continue
;
strcpyW
(
p
,
data
.
cFileName
);
font_funcs
->
add_font
(
path
,
flags
);
}
while
(
FindNextFileW
(
handle
,
&
data
));
FindClose
(
handle
);
}
void
load_file_system_fonts
(
void
)
{
static
const
WCHAR
pathW
[]
=
{
'P'
,
'a'
,
't'
,
'h'
,
0
};
static
const
WCHAR
slashstarW
[]
=
{
'\\'
,
'*'
,
0
};
static
const
WCHAR
starW
[]
=
{
'*'
,
0
};
WCHAR
*
ptr
,
*
next
,
path
[
MAX_PATH
],
value
[
1024
];
DWORD
len
=
ARRAY_SIZE
(
value
);
/* Windows directory */
get_fonts_win_dir_path
(
starW
,
path
);
load_directory_fonts
(
path
,
ADDFONT_ADD_TO_CACHE
);
/* Wine data directory */
get_fonts_data_dir_path
(
starW
,
path
);
load_directory_fonts
(
path
,
ADDFONT_ADD_TO_CACHE
|
ADDFONT_EXTERNAL_FONT
);
/* custom paths */
/* @@ Wine registry key: HKCU\Software\Wine\Fonts */
if
(
!
RegQueryValueExW
(
wine_fonts_key
,
pathW
,
NULL
,
NULL
,
(
BYTE
*
)
value
,
&
len
))
{
for
(
ptr
=
value
;
ptr
;
ptr
=
next
)
{
if
((
next
=
strchrW
(
ptr
,
';'
)))
*
next
++
=
0
;
if
(
next
&&
next
-
ptr
<
2
)
continue
;
lstrcpynW
(
path
,
ptr
,
MAX_PATH
-
2
);
strcatW
(
path
,
slashstarW
);
load_directory_fonts
(
path
,
ADDFONT_ADD_TO_CACHE
|
ADDFONT_EXTERNAL_FONT
);
}
}
}
void
load_registry_fonts
(
void
)
{
static
const
WCHAR
dot_fonW
[]
=
{
'.'
,
'f'
,
'o'
,
'n'
,
0
};
...
...
dlls/gdi32/freetype.c
View file @
7b291a09
...
...
@@ -329,7 +329,6 @@ static struct list font_list = LIST_INIT(font_list);
static
const
struct
font_backend_funcs
font_funcs
;
static
const
WCHAR
fontsW
[]
=
{
'\\'
,
'f'
,
'o'
,
'n'
,
't'
,
's'
,
'\0'
};
static
const
WCHAR
win9x_font_reg_key
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
...
...
@@ -2545,6 +2544,7 @@ skip_internal:
list_add_tail
(
&
system_links
,
&
system_font_link
->
entry
);
}
#ifdef __ANDROID__
static
BOOL
ReadFontDir
(
const
char
*
dirname
,
BOOL
external_fonts
)
{
DIR
*
dir
;
...
...
@@ -2585,16 +2585,7 @@ static BOOL ReadFontDir(const char *dirname, BOOL external_fonts)
closedir
(
dir
);
return
TRUE
;
}
static
void
read_font_dir
(
const
WCHAR
*
dirname
,
BOOL
external_fonts
)
{
char
*
unixname
=
wine_get_unix_file_name
(
dirname
);
if
(
unixname
)
{
ReadFontDir
(
unixname
,
external_fonts
);
HeapFree
(
GetProcessHeap
(),
0
,
unixname
);
}
}
#endif
#ifdef SONAME_LIBFONTCONFIG
...
...
@@ -3407,24 +3398,9 @@ sym_not_found:
static
void
init_font_list
(
void
)
{
static
const
WCHAR
pathW
[]
=
{
'P'
,
'a'
,
't'
,
'h'
,
0
};
HKEY
hkey
;
WCHAR
path
[
MAX_PATH
];
char
*
unixname
;
delete_external_font_keys
();
load_system_bitmap_fonts
();
/* load in the fonts from %WINDOWSDIR%\\Fonts first of all */
GetWindowsDirectoryW
(
path
,
ARRAY_SIZE
(
path
));
strcatW
(
path
,
fontsW
);
read_font_dir
(
path
,
FALSE
);
/* load the wine fonts */
get_font_dir
(
path
);
read_font_dir
(
path
,
TRUE
);
load_file_system_fonts
();
load_registry_fonts
();
#ifdef SONAME_LIBFONTCONFIG
...
...
@@ -3434,49 +3410,6 @@ static void init_font_list(void)
#elif defined(__ANDROID__)
ReadFontDir
(
"/system/fonts"
,
TRUE
);
#endif
/* then look in any directories that we've specified in the config file */
/* @@ Wine registry key: HKCU\Software\Wine\Fonts */
if
(
RegOpenKeyA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Fonts"
,
&
hkey
)
==
ERROR_SUCCESS
)
{
DWORD
len
;
LPWSTR
valueW
;
LPSTR
valueA
,
ptr
;
if
(
RegQueryValueExW
(
hkey
,
pathW
,
NULL
,
NULL
,
NULL
,
&
len
)
==
ERROR_SUCCESS
)
{
len
+=
sizeof
(
WCHAR
);
valueW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
RegQueryValueExW
(
hkey
,
pathW
,
NULL
,
NULL
,
(
LPBYTE
)
valueW
,
&
len
)
==
ERROR_SUCCESS
)
{
len
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
valueW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
valueA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
valueW
,
-
1
,
valueA
,
len
,
NULL
,
NULL
);
TRACE
(
"got font path %s
\n
"
,
debugstr_a
(
valueA
)
);
ptr
=
valueA
;
while
(
ptr
)
{
const
char
*
home
;
LPSTR
next
=
strchr
(
ptr
,
':'
);
if
(
next
)
*
next
++
=
0
;
if
(
ptr
[
0
]
==
'~'
&&
ptr
[
1
]
==
'/'
&&
(
home
=
getenv
(
"HOME"
))
&&
(
unixname
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
ptr
)
+
strlen
(
home
)
)))
{
strcpy
(
unixname
,
home
);
strcat
(
unixname
,
ptr
+
1
);
ReadFontDir
(
unixname
,
TRUE
);
HeapFree
(
GetProcessHeap
(),
0
,
unixname
);
}
else
ReadFontDir
(
ptr
,
TRUE
);
ptr
=
next
;
}
HeapFree
(
GetProcessHeap
(),
0
,
valueA
);
}
HeapFree
(
GetProcessHeap
(),
0
,
valueW
);
}
RegCloseKey
(
hkey
);
}
}
static
BOOL
move_to_front
(
const
WCHAR
*
name
)
...
...
dlls/gdi32/gdi_private.h
View file @
7b291a09
...
...
@@ -389,8 +389,8 @@ struct font_backend_funcs
void
(
CDECL
*
destroy_font
)(
struct
gdi_font
*
font
);
};
extern
void
get_font_dir
(
WCHAR
*
path
)
DECLSPEC_HIDDEN
;
extern
void
load_system_bitmap_fonts
(
void
)
DECLSPEC_HIDDEN
;
extern
void
load_file_system_fonts
(
void
)
DECLSPEC_HIDDEN
;
extern
void
load_registry_fonts
(
void
)
DECLSPEC_HIDDEN
;
extern
struct
gdi_font
*
alloc_gdi_font
(
const
WCHAR
*
file
,
void
*
data_ptr
,
SIZE_T
data_size
)
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