[PATCH v2 6/7] gdi32: Use NtGdiGetCharWidthW for GetCharWidthFloatA.
Huw Davies
huw at codeweavers.com
Thu Aug 26 07:45:17 CDT 2021
From: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/gdi32/font.c | 26 --------------------------
dlls/gdi32/text.c | 15 +++++++++++++++
2 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index cbf3f6fb555..4faaaacdfce 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -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 *
diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c
index b753dac7052..b31196252ad 100644
--- a/dlls/gdi32/text.c
+++ b/dlls/gdi32/text.c
@@ -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;
+}
--
2.23.0
More information about the wine-devel
mailing list