gdi32: Move the loading of system fonts out of freetype.c.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-10-27 10:27:06 +01:00
parent 9908c5d3c4
commit 131d3b1f5d
3 changed files with 24 additions and 38 deletions

View File

@ -5375,6 +5375,28 @@ static BOOL remove_font_resource( LPCWSTR file, DWORD flags )
return ret;
}
void load_system_bitmap_fonts(void)
{
static const WCHAR keyW[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s',0};
static const WCHAR fontsW[] = {'F','O','N','T','S','.','F','O','N',0};
static const WCHAR oemfontW[] = {'O','E','M','F','O','N','T','.','F','O','N',0};
static const WCHAR fixedfonW[] = {'F','I','X','E','D','F','O','N','.','F','O','N',0};
static const WCHAR * const fonts[] = { fontsW, oemfontW, fixedfonW };
HKEY hkey;
WCHAR data[MAX_PATH];
DWORD i, dlen, type;
if (RegOpenKeyW( HKEY_CURRENT_CONFIG, keyW, &hkey )) return;
for (i = 0; i < ARRAY_SIZE(fonts); i++)
{
dlen = sizeof(data);
if (!RegQueryValueExW( hkey, fonts[i], 0, &type, (BYTE *)data, &dlen ) && type == REG_SZ)
add_system_font_resource( data, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE );
}
RegCloseKey( hkey );
}
/***********************************************************************
* AddFontResourceExW (GDI32.@)
*/

View File

@ -340,18 +340,6 @@ static const WCHAR winnt_font_reg_key[] = {'S','o','f','t','w','a','r','e','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'F','o','n','t','s','\0'};
static const WCHAR system_fonts_reg_key[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
static const WCHAR FixedSys_Value[] = {'F','I','X','E','D','F','O','N','.','F','O','N','\0'};
static const WCHAR System_Value[] = {'F','O','N','T','S','.','F','O','N','\0'};
static const WCHAR OEMFont_Value[] = {'O','E','M','F','O','N','T','.','F','O','N','\0'};
static const WCHAR * const SystemFontValues[] = {
System_Value,
OEMFont_Value,
FixedSys_Value,
NULL
};
static const WCHAR external_fonts_reg_key[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
'F','o','n','t','s','\\','E','x','t','e','r','n','a','l',' ','F','o','n','t','s','\0'};
@ -2861,30 +2849,6 @@ static void load_mac_fonts(void)
#endif
static void load_system_fonts(void)
{
HKEY hkey;
WCHAR data[MAX_PATH], pathW[MAX_PATH];
const WCHAR * const *value;
DWORD dlen, type;
if(RegOpenKeyW(HKEY_CURRENT_CONFIG, system_fonts_reg_key, &hkey) == ERROR_SUCCESS) {
for(value = SystemFontValues; *value; value++) {
dlen = sizeof(data);
if(RegQueryValueExW(hkey, *value, 0, &type, (void*)data, &dlen) == ERROR_SUCCESS &&
type == REG_SZ) {
get_fonts_win_dir_path( data, pathW );
if (!freetype_add_font( pathW, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE ))
{
get_fonts_data_dir_path( data, pathW );
freetype_add_font( pathW, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE );
}
}
}
RegCloseKey(hkey);
}
}
static WCHAR *get_full_path_name(const WCHAR *name)
{
WCHAR *full_path;
@ -3456,8 +3420,7 @@ static void init_font_list(void)
delete_external_font_keys();
/* load the system bitmap fonts */
load_system_fonts();
load_system_bitmap_fonts();
/* load in the fonts from %WINDOWSDIR%\\Fonts first of all */
GetWindowsDirectoryW(path, ARRAY_SIZE(path));

View File

@ -392,6 +392,7 @@ struct font_backend_funcs
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 void load_system_bitmap_fonts(void) 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;