Jacek Caban : gdi32: Move resource functions wrappers to text.c.
Alexandre Julliard
julliard at winehq.org
Mon Aug 30 15:53:53 CDT 2021
Module: wine
Branch: master
Commit: 34449789d312e8c4dd9401d4ee096ee1ea3c78bd
URL: https://source.winehq.org/git/wine.git/?a=commit;h=34449789d312e8c4dd9401d4ee096ee1ea3c78bd
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Aug 30 13:55:52 2021 +0200
gdi32: Move resource functions wrappers to text.c.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/font.c | 117 ------------------------------------------------------
dlls/gdi32/text.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 113 insertions(+), 117 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index b3321d5fbf7..f661dbd5da3 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -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.@)
*
diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c
index f41cf67a5db..093699acbed 100644
--- a/dlls/gdi32/text.c
+++ b/dlls/gdi32/text.c
@@ -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;
+}
More information about the wine-cvs
mailing list