Module: wine Branch: master Commit: da4663d6402bd9f0b23ecd31700a654b034074b0 URL: https://gitlab.winehq.org/wine/wine/-/commit/da4663d6402bd9f0b23ecd31700a654...
Author: Jacek Caban jacek@codeweavers.com Date: Sat May 27 18:27:42 2023 +0200
win32u: Don't return full OUTLINETEXTMETRICW from __wine_get_file_outline_text_metric.
---
dlls/gdi32/text.c | 46 ++++++++++++++++++++++---------------------- dlls/win32u/font.c | 7 +++++-- dlls/win32u/win32u.spec | 2 +- dlls/win32u/win32u_private.h | 3 ++- dlls/win32u/wrappers.c | 5 +++-- include/ntgdi.h | 4 ++-- 6 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c index 3dd50491e08..2ebfea586e4 100644 --- a/dlls/gdi32/text.c +++ b/dlls/gdi32/text.c @@ -2669,10 +2669,11 @@ static BOOL create_fot( const WCHAR *resource, const WCHAR *font_file, const str BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, const WCHAR *resource_file, const WCHAR *font_file, const WCHAR *font_path ) { + WCHAR path[MAX_PATH], face_name[128]; struct fontdir fontdir = { 0 }; UNICODE_STRING nt_name; - OUTLINETEXTMETRICW otm; - WCHAR path[MAX_PATH]; + TEXTMETRICW otm; + UINT em_square; BOOL ret;
TRACE("(%ld, %s, %s, %s)\n", hidden, debugstr_w(resource_file), @@ -2689,10 +2690,10 @@ BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, const WCHAR *resource_fil if (!RtlDosPathNameToNtPathName_U( path, &nt_name, NULL, NULL )) goto done; } else if (!RtlDosPathNameToNtPathName_U( font_file, &nt_name, NULL, NULL )) goto done; - ret = __wine_get_file_outline_text_metric( nt_name.Buffer, &otm ); + ret = __wine_get_file_outline_text_metric( nt_name.Buffer, &otm, &em_square, face_name ); RtlFreeUnicodeString( &nt_name ); if (!ret) goto done; - if (!(otm.otmTextMetrics.tmPitchAndFamily & TMPF_TRUETYPE)) goto done; + if (!(otm.tmPitchAndFamily & TMPF_TRUETYPE)) goto done;
fontdir.num_of_resources = 1; fontdir.res_id = 0; @@ -2700,32 +2701,31 @@ BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, const WCHAR *resource_fil fontdir.dfSize = sizeof(fontdir); strcpy( fontdir.dfCopyright, "Wine fontdir" ); fontdir.dfType = 0x4003; /* 0x0080 set if private */ - fontdir.dfPoints = otm.otmEMSquare; + fontdir.dfPoints = em_square; fontdir.dfVertRes = 72; fontdir.dfHorizRes = 72; - fontdir.dfAscent = otm.otmTextMetrics.tmAscent; - fontdir.dfInternalLeading = otm.otmTextMetrics.tmInternalLeading; - fontdir.dfExternalLeading = otm.otmTextMetrics.tmExternalLeading; - fontdir.dfItalic = otm.otmTextMetrics.tmItalic; - fontdir.dfUnderline = otm.otmTextMetrics.tmUnderlined; - fontdir.dfStrikeOut = otm.otmTextMetrics.tmStruckOut; - fontdir.dfWeight = otm.otmTextMetrics.tmWeight; - fontdir.dfCharSet = otm.otmTextMetrics.tmCharSet; + fontdir.dfAscent = otm.tmAscent; + fontdir.dfInternalLeading = otm.tmInternalLeading; + fontdir.dfExternalLeading = otm.tmExternalLeading; + fontdir.dfItalic = otm.tmItalic; + fontdir.dfUnderline = otm.tmUnderlined; + fontdir.dfStrikeOut = otm.tmStruckOut; + fontdir.dfWeight = otm.tmWeight; + fontdir.dfCharSet = otm.tmCharSet; fontdir.dfPixWidth = 0; - fontdir.dfPixHeight = otm.otmTextMetrics.tmHeight; - fontdir.dfPitchAndFamily = otm.otmTextMetrics.tmPitchAndFamily; - fontdir.dfAvgWidth = otm.otmTextMetrics.tmAveCharWidth; - fontdir.dfMaxWidth = otm.otmTextMetrics.tmMaxCharWidth; - fontdir.dfFirstChar = otm.otmTextMetrics.tmFirstChar; - fontdir.dfLastChar = otm.otmTextMetrics.tmLastChar; - fontdir.dfDefaultChar = otm.otmTextMetrics.tmDefaultChar; - fontdir.dfBreakChar = otm.otmTextMetrics.tmBreakChar; + fontdir.dfPixHeight = otm.tmHeight; + fontdir.dfPitchAndFamily = otm.tmPitchAndFamily; + fontdir.dfAvgWidth = otm.tmAveCharWidth; + fontdir.dfMaxWidth = otm.tmMaxCharWidth; + fontdir.dfFirstChar = otm.tmFirstChar; + fontdir.dfLastChar = otm.tmLastChar; + fontdir.dfDefaultChar = otm.tmDefaultChar; + fontdir.dfBreakChar = otm.tmBreakChar; fontdir.dfWidthBytes = 0; fontdir.dfDevice = 0; fontdir.dfFace = FIELD_OFFSET( struct fontdir, szFaceName ); fontdir.dfReserved = 0; - WideCharToMultiByte( CP_ACP, 0, (WCHAR *)otm.otmpFamilyName, -1, - fontdir.szFaceName, LF_FACESIZE, NULL, NULL ); + WideCharToMultiByte( CP_ACP, 0, face_name, -1, fontdir.szFaceName, LF_FACESIZE, NULL, NULL );
if (hidden) fontdir.dfType |= 0x80; return create_fot( resource_file, font_file, &fontdir ); diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index cdac88836b9..c8187e9d07b 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -6341,7 +6341,8 @@ DWORD WINAPI NtGdiGetGlyphOutline( HDC hdc, UINT ch, UINT format, GLYPHMETRICS * /********************************************************************** * __wine_get_file_outline_text_metric (win32u.@) */ -BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTMETRICW *otm ) +BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ) { struct gdi_font *font = NULL;
@@ -6351,7 +6352,9 @@ BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTME font->lf.lfHeight = 100; if (!font_funcs->load_font( font )) goto done; if (!font_funcs->set_outline_text_metrics( font )) goto done; - *otm = font->otm; + *otm = font->otm.otmTextMetrics; + *em_square = font->otm.otmEMSquare; + wcscpy( face_name, (const WCHAR *)font->otm.otmpFamilyName ); free_gdi_font( font ); return TRUE;
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index c90505e7d17..178329d6858 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1325,4 +1325,4 @@
# gdi32 @ cdecl __wine_get_icm_profile(long long ptr ptr) -@ cdecl __wine_get_file_outline_text_metric(wstr ptr) +@ stdcall __wine_get_file_outline_text_metric(wstr ptr ptr ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 3b181fe3121..e7e77bf2427 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -35,7 +35,8 @@ struct unix_funcs { /* Wine-specific functions */ - BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm ); + BOOL (WINAPI *get_file_outline_text_metric)( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ); BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); }; diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 9e013c64b59..23dccd55bf1 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -30,10 +30,11 @@ BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCH return unix_funcs->get_icm_profile( hdc, allow_default, size, filename ); }
-BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTMETRICW *otm ) +BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name ) { if (!unix_funcs) return FALSE; - return unix_funcs->get_file_outline_text_metric( path, otm ); + return unix_funcs->get_file_outline_text_metric( path, otm, em_square, face_name ); }
BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ) diff --git a/include/ntgdi.h b/include/ntgdi.h index e1c5008e4e9..1ac8e0110e2 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -485,7 +485,7 @@ NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER /* Wine extensions */ extern BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); -extern BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, - OUTLINETEXTMETRICW *otm ); +BOOL WINAPI __wine_get_file_outline_text_metric( const WCHAR *path, TEXTMETRICW *otm, + UINT *em_square, WCHAR *face_name );
#endif /* _NTGDI_ */