From c221571468bd315725ccb0b5ca2d2e65694949b9 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 27 Aug 2021 13:51:53 +0100 Subject: [PATCH] gdi32: Use NtGdiGetGlyphOutlineW for GetGlyphOutlineW. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/gdi32/font.c | 50 +++++++---------------------------------------- dlls/gdi32/text.c | 44 +++++++++++++++++++++++++++++++++++++++++ include/ntgdi.h | 3 +++ 3 files changed, 54 insertions(+), 43 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 59438939474..12d56de35d9 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -5646,61 +5646,25 @@ BOOL WINAPI NtGdiGetCharABCWidthsW( HDC hdc, UINT first, UINT last, WCHAR *chars /*********************************************************************** - * GetGlyphOutlineA (GDI32.@) + * NtGdiGetGlyphOutlineW (win32u.@) */ -DWORD WINAPI GetGlyphOutlineA( HDC hdc, UINT uChar, UINT fuFormat, - LPGLYPHMETRICS lpgm, DWORD cbBuffer, - LPVOID lpBuffer, const MAT2 *lpmat2 ) -{ - if (!lpmat2) return GDI_ERROR; - - if(!(fuFormat & GGO_GLYPH_INDEX)) { - UINT cp; - int len; - char mbchs[2]; - WCHAR wChar; - - cp = GdiGetCodePage(hdc); - if (IsDBCSLeadByteEx(cp, uChar >> 8)) { - len = 2; - mbchs[0] = (uChar & 0xff00) >> 8; - mbchs[1] = (uChar & 0xff); - } else { - len = 1; - mbchs[0] = (uChar & 0xff); - } - wChar = 0; - MultiByteToWideChar(cp, 0, mbchs, len, &wChar, 1); - uChar = wChar; - } - - return GetGlyphOutlineW(hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, - lpmat2); -} - -/*********************************************************************** - * GetGlyphOutlineW (GDI32.@) - */ -DWORD WINAPI GetGlyphOutlineW( HDC hdc, UINT uChar, UINT fuFormat, - LPGLYPHMETRICS lpgm, DWORD cbBuffer, - LPVOID lpBuffer, const MAT2 *lpmat2 ) +DWORD WINAPI NtGdiGetGlyphOutlineW( HDC hdc, UINT ch, UINT format, GLYPHMETRICS *metrics, + DWORD size, void *buffer, const MAT2 *mat2, + BOOL ignore_rotation ) { DC *dc; DWORD ret; PHYSDEV dev; - TRACE("(%p, %04x, %04x, %p, %d, %p, %p)\n", - hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 ); + TRACE( "(%p, %04x, %04x, %p, %d, %p, %p)\n", hdc, ch, format, metrics, size, buffer, mat2 ); - if (!lpmat2) return GDI_ERROR; + if (!mat2) return GDI_ERROR; dc = get_dc_ptr(hdc); if(!dc) return GDI_ERROR; - uChar &= 0xffff; - dev = GET_DC_PHYSDEV( dc, pGetGlyphOutline ); - ret = dev->funcs->pGetGlyphOutline( dev, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 ); + ret = dev->funcs->pGetGlyphOutline( dev, ch & 0xffff, format, metrics, size, buffer, mat2 ); release_dc_ptr( dc ); return ret; } diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c index beb9908f6ce..7e9b882bdb1 100644 --- a/dlls/gdi32/text.c +++ b/dlls/gdi32/text.c @@ -1742,3 +1742,47 @@ BOOL WINAPI GetCharABCWidthsI( HDC hdc, UINT first, UINT count, WORD *glyphs, AB NTGDI_GETCHARABCWIDTHS_INDICES | NTGDI_GETCHARABCWIDTHS_INT, buffer ); } + +/*********************************************************************** + * GetGlyphOutlineA (GDI32.@) + */ +DWORD WINAPI GetGlyphOutlineA( HDC hdc, UINT ch, UINT format, GLYPHMETRICS *metrics, DWORD size, + void *buffer, const MAT2 *mat2 ) +{ + if (!mat2) return GDI_ERROR; + + if (!(format & GGO_GLYPH_INDEX)) + { + UINT cp; + int len; + char mbchs[2]; + WCHAR wChar; + + cp = GdiGetCodePage( hdc ); + if (IsDBCSLeadByteEx( cp, ch >> 8 )) + { + len = 2; + mbchs[0] = (ch & 0xff00) >> 8; + mbchs[1] = (ch & 0xff); + } + else + { + len = 1; + mbchs[0] = ch & 0xff; + } + wChar = 0; + MultiByteToWideChar(cp, 0, mbchs, len, &wChar, 1 ); + ch = wChar; + } + + return GetGlyphOutlineW( hdc, ch, format, metrics, size, buffer, mat2 ); +} + +/*********************************************************************** + * GetGlyphOutlineW (GDI32.@) + */ +DWORD WINAPI GetGlyphOutlineW( HDC hdc, UINT ch, UINT format, GLYPHMETRICS *metrics, + DWORD size, void *buffer, const MAT2 *mat2 ) +{ + return NtGdiGetGlyphOutlineW( hdc, ch, format, metrics, size, buffer, mat2, FALSE ); +} diff --git a/include/ntgdi.h b/include/ntgdi.h index 39f478bd418..c8958cf83c9 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -240,6 +240,9 @@ BOOL WINAPI NtGdiGetDCDword( HDC hdc, UINT method, DWORD *result ); BOOL WINAPI NtGdiGetDCPoint( HDC hdc, UINT method, POINT *result ); INT WINAPI NtGdiGetDeviceCaps( HDC hdc, INT cap ); BOOL WINAPI NtGdiGetDeviceGammaRamp( HDC hdc, void *ptr ); +DWORD WINAPI NtGdiGetGlyphOutlineW( HDC hdc, UINT ch, UINT format, GLYPHMETRICS *metrics, + DWORD size, void *buffer, const MAT2 *mat2, + BOOL ignore_rotation ); BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *rect, const WCHAR *str, UINT count, const INT *dx, DWORD cp ); BOOL WINAPI NtGdiGetMiterLimit( HDC hdc, FLOAT *limit );