gdi32: Use NtGdiGetCharWidthW for GetCharWidthFloatA.

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-26 13:45:17 +01:00 committed by Alexandre Julliard
parent e5f5e7342d
commit 690a861b0a
2 changed files with 15 additions and 26 deletions

View File

@ -6443,32 +6443,6 @@ done:
return ret;
}
/*************************************************************************
* GetCharWidthFloatA [GDI32.@]
*/
BOOL WINAPI GetCharWidthFloatA( HDC hdc, UINT first, UINT last, float *buffer )
{
WCHAR *wstr;
int i, wlen;
char *str;
if (!(str = FONT_GetCharsByRangeA( hdc, first, last, &i )))
return FALSE;
wstr = FONT_mbtowc( hdc, str, i, &wlen, NULL );
heap_free(str);
for (i = 0; i < wlen; ++i)
{
if (!GetCharWidthFloatW( hdc, wstr[i], wstr[i], &buffer[i] ))
{
heap_free(wstr);
return FALSE;
}
}
heap_free(wstr);
return TRUE;
}
/***********************************************************************
* *
* Font Resource API *

View File

@ -1657,3 +1657,18 @@ BOOL WINAPI GetCharWidthFloatW( HDC hdc, UINT first, UINT last, float *buffer )
{
return NtGdiGetCharWidthW( hdc, first, last, NULL, 0, buffer );
}
/***********************************************************************
* GetCharWidthFloatA (GDI32.@)
*/
BOOL WINAPI GetCharWidthFloatA( HDC hdc, UINT first, UINT last, float *buffer )
{
WCHAR *chars;
INT count;
BOOL ret;
if (!(chars = get_chars_by_range( hdc, first, last, &count ))) return FALSE;
ret = NtGdiGetCharWidthW( hdc, 0, count, chars, 0, buffer );
HeapFree( GetProcessHeap(), 0, chars );
return ret;
}