gdi32: Move resource functions wrappers to text.c.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-08-30 13:55:52 +02:00 committed by Alexandre Julliard
parent fab977f7b2
commit 34449789d3
2 changed files with 113 additions and 117 deletions

View File

@ -5570,51 +5570,6 @@ DWORD WINAPI NtGdiGetGlyphOutlineW( HDC hdc, UINT ch, UINT format, GLYPHMETRICS
}
/***********************************************************************
* CreateScalableFontResourceA (GDI32.@)
*/
BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden,
LPCSTR lpszResourceFile,
LPCSTR lpszFontFile,
LPCSTR lpszCurrentPath )
{
LPWSTR lpszResourceFileW = NULL;
LPWSTR lpszFontFileW = NULL;
LPWSTR lpszCurrentPathW = NULL;
int len;
BOOL ret;
if (lpszResourceFile)
{
len = MultiByteToWideChar(CP_ACP, 0, lpszResourceFile, -1, NULL, 0);
lpszResourceFileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpszResourceFile, -1, lpszResourceFileW, len);
}
if (lpszFontFile)
{
len = MultiByteToWideChar(CP_ACP, 0, lpszFontFile, -1, NULL, 0);
lpszFontFileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpszFontFile, -1, lpszFontFileW, len);
}
if (lpszCurrentPath)
{
len = MultiByteToWideChar(CP_ACP, 0, lpszCurrentPath, -1, NULL, 0);
lpszCurrentPathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpszCurrentPath, -1, lpszCurrentPathW, len);
}
ret = CreateScalableFontResourceW(fHidden, lpszResourceFileW,
lpszFontFileW, lpszCurrentPathW);
HeapFree(GetProcessHeap(), 0, lpszResourceFileW);
HeapFree(GetProcessHeap(), 0, lpszFontFileW);
HeapFree(GetProcessHeap(), 0, lpszCurrentPathW);
return ret;
}
#define NE_FFLAGS_LIBMODULE 0x8000
#define NE_OSFLAGS_WINDOWS 0x02
@ -5999,38 +5954,6 @@ DWORD WINAPI NtGdiGetGlyphIndicesW( HDC hdc, const WCHAR *str, INT count,
* *
***********************************************************************/
/***********************************************************************
* AddFontResourceA (GDI32.@)
*/
INT WINAPI AddFontResourceA( LPCSTR str )
{
return AddFontResourceExA( str, 0, NULL);
}
/***********************************************************************
* AddFontResourceW (GDI32.@)
*/
INT WINAPI AddFontResourceW( LPCWSTR str )
{
return AddFontResourceExW(str, 0, NULL);
}
/***********************************************************************
* AddFontResourceExA (GDI32.@)
*/
INT WINAPI AddFontResourceExA( LPCSTR str, DWORD fl, PVOID pdv )
{
DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
LPWSTR strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
INT ret;
MultiByteToWideChar(CP_ACP, 0, str, -1, strW, len);
ret = AddFontResourceExW(strW, fl, pdv);
HeapFree(GetProcessHeap(), 0, strW);
return ret;
}
static BOOL CALLBACK load_enumed_resource(HMODULE hModule, LPCWSTR type, LPWSTR name, LONG_PTR lParam)
{
HRSRC rsrc = FindResourceW(hModule, name, type);
@ -6485,22 +6408,6 @@ INT WINAPI AddFontResourceExW( LPCWSTR str, DWORD flags, PVOID pdv )
return ret;
}
/***********************************************************************
* RemoveFontResourceA (GDI32.@)
*/
BOOL WINAPI RemoveFontResourceA( LPCSTR str )
{
return RemoveFontResourceExA(str, 0, 0);
}
/***********************************************************************
* RemoveFontResourceW (GDI32.@)
*/
BOOL WINAPI RemoveFontResourceW( LPCWSTR str )
{
return RemoveFontResourceExW(str, 0, 0);
}
/***********************************************************************
* AddFontMemResourceEx (GDI32.@)
*/
@ -6558,21 +6465,6 @@ BOOL WINAPI RemoveFontMemResourceEx( HANDLE fh )
return TRUE;
}
/***********************************************************************
* RemoveFontResourceExA (GDI32.@)
*/
BOOL WINAPI RemoveFontResourceExA( LPCSTR str, DWORD fl, PVOID pdv )
{
DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
LPWSTR strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
INT ret;
MultiByteToWideChar(CP_ACP, 0, str, -1, strW, len);
ret = RemoveFontResourceExW(strW, fl, pdv);
HeapFree(GetProcessHeap(), 0, strW);
return ret;
}
/***********************************************************************
* RemoveFontResourceExW (GDI32.@)
*/
@ -6603,15 +6495,6 @@ BOOL WINAPI RemoveFontResourceExW( LPCWSTR str, DWORD flags, PVOID pdv )
return ret;
}
/***********************************************************************
* GetFontResourceInfoW (GDI32.@)
*/
BOOL WINAPI GetFontResourceInfoW( LPCWSTR str, LPDWORD size, PVOID buffer, DWORD type )
{
FIXME("%s %p(%d) %p %d\n", debugstr_w(str), size, size ? *size : 0, buffer, type);
return FALSE;
}
/***********************************************************************
* NtGdiGetFontUnicodeRanges (win32u.@)
*

View File

@ -2054,3 +2054,116 @@ INT WINAPI EnumFontsW( HDC hdc, const WCHAR *name, FONTENUMPROCW efproc, LPARAM
{
return EnumFontFamiliesW( hdc, name, efproc, data );
}
/***********************************************************************
* CreateScalableFontResourceA (GDI32.@)
*/
BOOL WINAPI CreateScalableFontResourceA( DWORD hidden, const char *resource_file,
const char *font_file, const char *current_path )
{
WCHAR *resource_fileW = NULL;
WCHAR *current_pathW = NULL;
WCHAR *font_fileW = NULL;
int len;
BOOL ret;
if (resource_file)
{
len = MultiByteToWideChar( CP_ACP, 0, resource_file, -1, NULL, 0 );
resource_fileW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, resource_file, -1, resource_fileW, len );
}
if (font_file)
{
len = MultiByteToWideChar( CP_ACP, 0, font_file, -1, NULL, 0 );
font_fileW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, font_file, -1, font_fileW, len );
}
if (current_path)
{
len = MultiByteToWideChar( CP_ACP, 0, current_path, -1, NULL, 0 );
current_pathW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, current_path, -1, current_pathW, len );
}
ret = CreateScalableFontResourceW( hidden, resource_fileW,
font_fileW, current_pathW );
HeapFree(GetProcessHeap(), 0, resource_fileW);
HeapFree(GetProcessHeap(), 0, font_fileW);
HeapFree(GetProcessHeap(), 0, current_pathW);
return ret;
}
/***********************************************************************
* AddFontResourceA (GDI32.@)
*/
INT WINAPI AddFontResourceA( const char *str )
{
return AddFontResourceExA( str, 0, NULL);
}
/***********************************************************************
* AddFontResourceW (GDI32.@)
*/
INT WINAPI AddFontResourceW( const WCHAR *str )
{
return AddFontResourceExW( str, 0, NULL );
}
/***********************************************************************
* AddFontResourceExA (GDI32.@)
*/
INT WINAPI AddFontResourceExA( const char *str, DWORD fl, void *pdv )
{
DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
LPWSTR strW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
INT ret;
MultiByteToWideChar( CP_ACP, 0, str, -1, strW, len );
ret = AddFontResourceExW( strW, fl, pdv );
HeapFree( GetProcessHeap(), 0, strW );
return ret;
}
/***********************************************************************
* RemoveFontResourceA (GDI32.@)
*/
BOOL WINAPI RemoveFontResourceA( const char *str )
{
return RemoveFontResourceExA( str, 0, 0 );
}
/***********************************************************************
* RemoveFontResourceW (GDI32.@)
*/
BOOL WINAPI RemoveFontResourceW( const WCHAR *str )
{
return RemoveFontResourceExW( str, 0, 0 );
}
/***********************************************************************
* RemoveFontResourceExA (GDI32.@)
*/
BOOL WINAPI RemoveFontResourceExA( const char *str, DWORD fl, void *pdv )
{
DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
LPWSTR strW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
INT ret;
MultiByteToWideChar( CP_ACP, 0, str, -1, strW, len );
ret = RemoveFontResourceExW( strW, fl, pdv );
HeapFree( GetProcessHeap(), 0, strW );
return ret;
}
/***********************************************************************
* GetFontResourceInfoW (GDI32.@)
*/
BOOL WINAPI GetFontResourceInfoW( const WCHAR *str, DWORD *size, void *buffer, DWORD type )
{
FIXME( "%s %p(%d) %p %d\n", debugstr_w(str), size, size ? *size : 0, buffer, type );
return FALSE;
}