Jacek Caban : gdi32: Use NtGdiGetTextFaceW for GetTextFace.
Alexandre Julliard
julliard at winehq.org
Fri Aug 20 16:12:55 CDT 2021
Module: wine
Branch: master
Commit: ff36618c969d46e6203ce66d053224b11dc6ee4a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ff36618c969d46e6203ce66d053224b11dc6ee4a
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Aug 20 10:41:32 2021 +0200
gdi32: Use NtGdiGetTextFaceW for GetTextFace.
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 | 33 ++-------------------------------
dlls/gdi32/text.c | 36 ++++++++++++++++++++++++++++++++++++
include/ntgdi.h | 2 +-
3 files changed, 39 insertions(+), 32 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 4d6f11d5080..ba1da3b11a9 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -4743,38 +4743,9 @@ BOOL WINAPI NtGdiSetTextJustification( HDC hdc, INT extra, INT breaks )
/***********************************************************************
- * GetTextFaceA (GDI32.@)
+ * NtGdiGetTextFaceW (win32u.@)
*/
-INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name )
-{
- INT res = GetTextFaceW(hdc, 0, NULL);
- LPWSTR nameW = HeapAlloc( GetProcessHeap(), 0, res * 2 );
- GetTextFaceW( hdc, res, nameW );
-
- if (name)
- {
- if (count)
- {
- res = WideCharToMultiByte(CP_ACP, 0, nameW, -1, name, count, NULL, NULL);
- if (res == 0)
- res = count;
- name[count-1] = 0;
- /* GetTextFaceA does NOT include the nul byte in the return count. */
- res--;
- }
- else
- res = 0;
- }
- else
- res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, NULL, 0, NULL, NULL);
- HeapFree( GetProcessHeap(), 0, nameW );
- return res;
-}
-
-/***********************************************************************
- * GetTextFaceW (GDI32.@)
- */
-INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name )
+INT WINAPI NtGdiGetTextFaceW( HDC hdc, INT count, WCHAR *name, BOOL alias_name )
{
PHYSDEV dev;
INT ret;
diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c
index 82bf709fe19..d8cd4fb0dda 100644
--- a/dlls/gdi32/text.c
+++ b/dlls/gdi32/text.c
@@ -1052,3 +1052,39 @@ DWORD WINAPI GetCharacterPlacementA( HDC hdc, const char *str, INT count, INT ma
HeapFree( GetProcessHeap(), 0, resultsW.lpOutString );
return ret;
}
+
+/***********************************************************************
+ * GetTextFaceA (GDI32.@)
+ */
+INT WINAPI GetTextFaceA( HDC hdc, INT count, char *name )
+{
+ INT res = GetTextFaceW( hdc, 0, NULL );
+ WCHAR *nameW = HeapAlloc( GetProcessHeap(), 0, res * sizeof(WCHAR) );
+
+ GetTextFaceW( hdc, res, nameW );
+ if (name)
+ {
+ if (count)
+ {
+ res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, count, NULL, NULL );
+ if (res == 0) res = count;
+ name[count - 1] = 0;
+ /* GetTextFaceA does NOT include the nul byte in the return count. */
+ res--;
+ }
+ else
+ res = 0;
+ }
+ else
+ res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, NULL, 0, NULL, NULL );
+ HeapFree( GetProcessHeap(), 0, nameW );
+ return res;
+}
+
+/***********************************************************************
+ * GetTextFaceW (GDI32.@)
+ */
+INT WINAPI GetTextFaceW( HDC hdc, INT count, WCHAR *name )
+{
+ return NtGdiGetTextFaceW( hdc, count, name, FALSE );
+}
diff --git a/include/ntgdi.h b/include/ntgdi.h
index cfcbce43fed..fd552cfa26d 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -238,7 +238,7 @@ DWORD WINAPI NtGdiGetRegionData( HRGN hrgn, DWORD count, RGNDATA *data );
INT WINAPI NtGdiGetRgnBox( HRGN hrgn, RECT *rect );
UINT WINAPI NtGdiGetSystemPaletteUse( HDC hdc );
UINT WINAPI NtGdiGetTextCharsetInfo( HDC hdc, FONTSIGNATURE *fs, DWORD flags );
-INT WINAPI NtGdiGetTextFaceW( HDC hdc, INT count, WCHAR *name );
+INT WINAPI NtGdiGetTextFaceW( HDC hdc, INT count, WCHAR *name, BOOL alias_name );
BOOL WINAPI NtGdiGetTextMetricsW( HDC hdc, TEXTMETRICW *metrics );
BOOL WINAPI NtGdiGetTransform( HDC hdc, DWORD which, XFORM *xform );
BOOL WINAPI NtGdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
More information about the wine-cvs
mailing list