And load system fonts outside of the global font mutex. We now only use the mutex to protect the registry fonts initialization.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/gdi32/font.c | 26 ++++++++++++++++---------- dlls/gdi32/freetype.c | 6 +++--- 2 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 4cc072bd785..9fa0f45ec4b 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -7758,7 +7758,7 @@ static void load_system_bitmap_fonts(void) { 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 ); + add_system_font_resource( data, ADDFONT_ALLOW_BITMAP ); } RegCloseKey( hkey ); } @@ -7789,11 +7789,11 @@ static void load_file_system_fonts(void)
/* Windows directory */ get_fonts_win_dir_path( L"*", path ); - load_directory_fonts( path, ADDFONT_ADD_TO_CACHE ); + load_directory_fonts( path, 0 );
/* Wine data directory */ get_fonts_data_dir_path( L"*", path ); - load_directory_fonts( path, ADDFONT_ADD_TO_CACHE | ADDFONT_EXTERNAL_FONT ); + load_directory_fonts( path, ADDFONT_EXTERNAL_FONT );
/* custom paths */ /* @@ Wine registry key: HKCU\Software\Wine\Fonts */ @@ -7805,7 +7805,7 @@ static void load_file_system_fonts(void) if (next && next - ptr < 2) continue; lstrcpynW( path, ptr, MAX_PATH - 2 ); lstrcatW( path, L"\*" ); - load_directory_fonts( path, ADDFONT_ADD_TO_CACHE | ADDFONT_EXTERNAL_FONT ); + load_directory_fonts( path, ADDFONT_EXTERNAL_FONT ); } } } @@ -7926,9 +7926,9 @@ static void load_registry_fonts(void)
dlen /= sizeof(WCHAR); if (data[0] && data[1] == ':') - add_font_resource( data, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE ); + add_font_resource( data, ADDFONT_ALLOW_BITMAP ); else if (dlen >= 6 && !wcsicmp( data + dlen - 5, L".fon" )) - add_system_font_resource( data, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE ); + add_system_font_resource( data, ADDFONT_ALLOW_BITMAP ); next: vlen = ARRAY_SIZE(value); dlen = sizeof(data); @@ -7954,6 +7954,10 @@ void font_init(void) update_codepage(); if (__wine_init_unix_lib( gdi32_module, DLL_PROCESS_ATTACH, &callback_funcs, &font_funcs )) return;
+ load_system_bitmap_fonts(); + load_file_system_fonts(); + font_funcs->load_fonts(); + if (!(mutex = CreateMutexW( NULL, FALSE, L"__WINE_FONT_MUTEX__" ))) return; WaitForSingleObject( mutex, INFINITE );
@@ -7962,16 +7966,18 @@ void font_init(void)
if (disposition == REG_CREATED_NEW_KEY) { - load_system_bitmap_fonts(); - load_file_system_fonts(); - font_funcs->load_fonts(); load_registry_fonts(); update_external_font_keys(); } - else load_font_list_from_cache();
ReleaseMutex( mutex );
+ if (disposition != REG_CREATED_NEW_KEY) + { + load_registry_fonts(); + load_font_list_from_cache(); + } + reorder_font_list(); load_gdi_font_subst(); load_gdi_font_replacements(); diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index e7684728c9c..1ee02795bed 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -1303,7 +1303,7 @@ static BOOL ReadFontDir(const char *dirname, BOOL external_fonts) ReadFontDir(path, external_fonts); else { - DWORD addfont_flags = ADDFONT_ADD_TO_CACHE; + DWORD addfont_flags = 0; if(external_fonts) addfont_flags |= ADDFONT_EXTERNAL_FONT; AddFontToList(NULL, path, NULL, 0, addfont_flags); } @@ -1523,7 +1523,7 @@ static void load_fontconfig_fonts( void ) if (!(done_set = pFcStrSetCreate())) goto done; if (!(dir_list = pFcConfigGetFontDirs( config ))) goto done;
- fontconfig_add_fonts_from_dir_list( config, dir_list, done_set, ADDFONT_EXTERNAL_FONT | ADDFONT_ADD_TO_CACHE ); + fontconfig_add_fonts_from_dir_list( config, dir_list, done_set, ADDFONT_EXTERNAL_FONT );
done: if (dir_list) pFcStrListDone( dir_list ); @@ -1543,7 +1543,7 @@ static void load_mac_font_callback(const void *value, void *context) if (path && CFStringGetFileSystemRepresentation(pathStr, path, len)) { TRACE("font file %s\n", path); - AddFontToList(NULL, path, NULL, 0, ADDFONT_EXTERNAL_FONT | ADDFONT_ADD_TO_CACHE); + AddFontToList(NULL, path, NULL, 0, ADDFONT_EXTERNAL_FONT); } RtlFreeHeap(GetProcessHeap(), 0, path); }