gdi32: Use NtGdiGetTextFaceW for GetTextFace.

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-20 10:41:32 +02:00 committed by Alexandre Julliard
parent e27c61be21
commit ff36618c96
3 changed files with 39 additions and 32 deletions

View File

@ -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;

View File

@ -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 );
}

View File

@ -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,