Module: wine Branch: master Commit: 862ae1a634cbf49f54622050b9bc60c95f019065 URL: https://source.winehq.org/git/wine.git/?a=commit;h=862ae1a634cbf49f54622050b...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Sep 21 15:54:36 2021 +0200
gdi32: Remove workaround for old freetype versions.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdi32/font.c | 53 ++--------------------------------------------------- 1 file changed, 2 insertions(+), 51 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index f916ed97f01..11cec6b95ae 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -5554,24 +5554,6 @@ DWORD WINAPI NtGdiGetGlyphIndicesW( HDC hdc, const WCHAR *str, INT count, * * ***********************************************************************/
-static BOOL CALLBACK load_enumed_resource(HMODULE hModule, LPCWSTR type, LPWSTR name, LONG_PTR lParam) -{ - HRSRC rsrc = FindResourceW(hModule, name, type); - HGLOBAL hMem = LoadResource(hModule, rsrc); - LPVOID *pMem = LockResource(hMem); - int *num_total = (int *)lParam; - DWORD num_in_res; - - TRACE("Found resource %s - trying to load\n", wine_dbgstr_w(type)); - if (!NtGdiAddFontMemResourceEx( pMem, SizeofResource(hModule, rsrc), NULL, 0, &num_in_res )) - { - ERR("Failed to load PE font resource mod=%p ptr=%p\n", hModule, hMem); - return FALSE; - } - - *num_total += num_in_res; - return TRUE; -}
static int add_system_font_resource( const WCHAR *file, DWORD flags ) { @@ -5949,26 +5931,8 @@ void font_init(void) INT WINAPI NtGdiAddFontResourceW( const WCHAR *str, ULONG size, ULONG files, DWORD flags, DWORD tid, void *dv ) { - int ret; - if (!font_funcs) return 1; - if (!(ret = add_font_resource( str, flags ))) - { - /* FreeType <2.3.5 has problems reading resources wrapped in PE files. */ - HMODULE hModule = LoadLibraryExW(str, NULL, LOAD_LIBRARY_AS_DATAFILE); - if (hModule != NULL) - { - int num_resources = 0; - LPWSTR rt_font = (LPWSTR)((ULONG_PTR)8); /* we don't want to include winuser.h */ - - TRACE("WineEngAddFontResourceEx failed on PE file %s - trying to load resources manually\n", - wine_dbgstr_w(str)); - if (EnumResourceNamesW(hModule, rt_font, load_enumed_resource, (LONG_PTR)&num_resources)) - ret = num_resources; - FreeLibrary(hModule); - } - } - return ret; + return add_font_resource( str, flags ); }
/*********************************************************************** @@ -6035,21 +5999,8 @@ BOOL WINAPI NtGdiRemoveFontMemResourceEx( HANDLE handle ) BOOL WINAPI NtGdiRemoveFontResourceW( const WCHAR *str, ULONG size, ULONG files, DWORD flags, DWORD tid, void *dv ) { - int ret; - if (!font_funcs) return TRUE; - - if (!(ret = remove_font_resource( str, flags ))) - { - /* FreeType <2.3.5 has problems reading resources wrapped in PE files. */ - HMODULE hModule = LoadLibraryExW(str, NULL, LOAD_LIBRARY_AS_DATAFILE); - if (hModule != NULL) - { - WARN("Can't unload resources from PE file %s\n", wine_dbgstr_w(str)); - FreeLibrary(hModule); - } - } - return ret; + return remove_font_resource( str, flags ); }
/***********************************************************************