gdi32: Move the font list initialisation to a separate function.
This commit is contained in:
parent
ab1373d847
commit
63070bdf89
|
@ -2745,12 +2745,7 @@ sym_not_found:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************
|
static void init_font_list(void)
|
||||||
* WineEngInit
|
|
||||||
*
|
|
||||||
* Initialize FreeType library and create a list of available faces
|
|
||||||
*/
|
|
||||||
BOOL WineEngInit(void)
|
|
||||||
{
|
{
|
||||||
static const WCHAR dot_fonW[] = {'.','f','o','n','\0'};
|
static const WCHAR dot_fonW[] = {'.','f','o','n','\0'};
|
||||||
static const WCHAR pathW[] = {'P','a','t','h',0};
|
static const WCHAR pathW[] = {'P','a','t','h',0};
|
||||||
|
@ -2758,22 +2753,8 @@ BOOL WineEngInit(void)
|
||||||
DWORD valuelen, datalen, i = 0, type, dlen, vlen;
|
DWORD valuelen, datalen, i = 0, type, dlen, vlen;
|
||||||
WCHAR windowsdir[MAX_PATH];
|
WCHAR windowsdir[MAX_PATH];
|
||||||
char *unixname;
|
char *unixname;
|
||||||
HANDLE font_mutex;
|
|
||||||
const char *data_dir;
|
const char *data_dir;
|
||||||
|
|
||||||
TRACE("\n");
|
|
||||||
|
|
||||||
/* update locale dependent font info in registry */
|
|
||||||
update_font_info();
|
|
||||||
|
|
||||||
if(!init_freetype()) return FALSE;
|
|
||||||
|
|
||||||
if((font_mutex = CreateMutexW(NULL, FALSE, font_mutex_nameW)) == NULL) {
|
|
||||||
ERR("Failed to create font mutex\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
WaitForSingleObject(font_mutex, INFINITE);
|
|
||||||
|
|
||||||
delete_external_font_keys();
|
delete_external_font_keys();
|
||||||
|
|
||||||
/* load the system bitmap fonts */
|
/* load the system bitmap fonts */
|
||||||
|
@ -2791,7 +2772,8 @@ BOOL WineEngInit(void)
|
||||||
/* load the system truetype fonts */
|
/* load the system truetype fonts */
|
||||||
data_dir = wine_get_data_dir();
|
data_dir = wine_get_data_dir();
|
||||||
if (!data_dir) data_dir = wine_get_build_dir();
|
if (!data_dir) data_dir = wine_get_build_dir();
|
||||||
if (data_dir && (unixname = HeapAlloc(GetProcessHeap(), 0, strlen(data_dir) + sizeof("/fonts/")))) {
|
if (data_dir && (unixname = HeapAlloc(GetProcessHeap(), 0, strlen(data_dir) + sizeof("/fonts/"))))
|
||||||
|
{
|
||||||
strcpy(unixname, data_dir);
|
strcpy(unixname, data_dir);
|
||||||
strcat(unixname, "/fonts/");
|
strcat(unixname, "/fonts/");
|
||||||
ReadFontDir(unixname, TRUE);
|
ReadFontDir(unixname, TRUE);
|
||||||
|
@ -2804,20 +2786,22 @@ BOOL WineEngInit(void)
|
||||||
will skip these. */
|
will skip these. */
|
||||||
if(RegOpenKeyW(HKEY_LOCAL_MACHINE,
|
if(RegOpenKeyW(HKEY_LOCAL_MACHINE,
|
||||||
is_win9x() ? win9x_font_reg_key : winnt_font_reg_key,
|
is_win9x() ? win9x_font_reg_key : winnt_font_reg_key,
|
||||||
&hkey) == ERROR_SUCCESS) {
|
&hkey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
LPWSTR data, valueW;
|
LPWSTR data, valueW;
|
||||||
RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
&valuelen, &datalen, NULL, NULL);
|
&valuelen, &datalen, NULL, NULL);
|
||||||
|
|
||||||
valuelen++; /* returned value doesn't include room for '\0' */
|
valuelen++; /* returned value doesn't include room for '\0' */
|
||||||
valueW = HeapAlloc(GetProcessHeap(), 0, valuelen * sizeof(WCHAR));
|
valueW = HeapAlloc(GetProcessHeap(), 0, valuelen * sizeof(WCHAR));
|
||||||
data = HeapAlloc(GetProcessHeap(), 0, datalen * sizeof(WCHAR));
|
data = HeapAlloc(GetProcessHeap(), 0, datalen * sizeof(WCHAR));
|
||||||
if (valueW && data)
|
if (valueW && data)
|
||||||
{
|
{
|
||||||
dlen = datalen * sizeof(WCHAR);
|
dlen = datalen * sizeof(WCHAR);
|
||||||
vlen = valuelen;
|
vlen = valuelen;
|
||||||
while(RegEnumValueW(hkey, i++, valueW, &vlen, NULL, &type, (LPBYTE)data,
|
while(RegEnumValueW(hkey, i++, valueW, &vlen, NULL, &type, (LPBYTE)data,
|
||||||
&dlen) == ERROR_SUCCESS) {
|
&dlen) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
if(data[0] && (data[1] == ':'))
|
if(data[0] && (data[1] == ':'))
|
||||||
{
|
{
|
||||||
if((unixname = wine_get_unix_file_name(data)))
|
if((unixname = wine_get_unix_file_name(data)))
|
||||||
|
@ -2848,7 +2832,7 @@ BOOL WineEngInit(void)
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, data);
|
HeapFree(GetProcessHeap(), 0, data);
|
||||||
HeapFree(GetProcessHeap(), 0, valueW);
|
HeapFree(GetProcessHeap(), 0, valueW);
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_fontconfig_fonts();
|
load_fontconfig_fonts();
|
||||||
|
@ -2885,6 +2869,30 @@ BOOL WineEngInit(void)
|
||||||
}
|
}
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************
|
||||||
|
* WineEngInit
|
||||||
|
*
|
||||||
|
* Initialize FreeType library and create a list of available faces
|
||||||
|
*/
|
||||||
|
BOOL WineEngInit(void)
|
||||||
|
{
|
||||||
|
HANDLE font_mutex;
|
||||||
|
|
||||||
|
/* update locale dependent font info in registry */
|
||||||
|
update_font_info();
|
||||||
|
|
||||||
|
if(!init_freetype()) return FALSE;
|
||||||
|
|
||||||
|
if((font_mutex = CreateMutexW(NULL, FALSE, font_mutex_nameW)) == NULL)
|
||||||
|
{
|
||||||
|
ERR("Failed to create font mutex\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
WaitForSingleObject(font_mutex, INFINITE);
|
||||||
|
|
||||||
|
init_font_list();
|
||||||
|
|
||||||
DumpFontList();
|
DumpFontList();
|
||||||
LoadSubstList();
|
LoadSubstList();
|
||||||
|
|
Loading…
Reference in New Issue