mirror of
https://github.com/reactos/wine.git
synced 2025-02-04 02:56:31 +00:00
gdi32: If freetype fails try to load manually fonts wrapped as PE resources.
This commit is contained in:
parent
baee27c69c
commit
0eb910352c
@ -3185,12 +3185,48 @@ INT WINAPI AddFontResourceExA( LPCSTR str, DWORD fl, PVOID pdv )
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 (!AddFontMemResourceEx(pMem, SizeofResource(hModule, rsrc), NULL, &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;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* AddFontResourceExW (GDI32.@)
|
* AddFontResourceExW (GDI32.@)
|
||||||
*/
|
*/
|
||||||
INT WINAPI AddFontResourceExW( LPCWSTR str, DWORD fl, PVOID pdv )
|
INT WINAPI AddFontResourceExW( LPCWSTR str, DWORD fl, PVOID pdv )
|
||||||
{
|
{
|
||||||
return WineEngAddFontResourceEx(str, fl, pdv);
|
int ret = WineEngAddFontResourceEx(str, fl, pdv);
|
||||||
|
if (ret == 0)
|
||||||
|
{
|
||||||
|
/* Freetype <2.3.5 have 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("WineEndAddFontResourceEx failed on PE file %s - trying to load resources manualy\n",
|
||||||
|
wine_dbgstr_w(str));
|
||||||
|
if (EnumResourceNamesW(hModule, rt_font, load_enumed_resource, (LONG_PTR)&num_resources))
|
||||||
|
ret = num_resources;
|
||||||
|
FreeLibrary(hModule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user