Commit da4663d6 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Don't return full OUTLINETEXTMETRICW from __wine_get_file_outline_text_metric.

parent 3dbe180e
......@@ -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 );
......
......@@ -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;
......
......@@ -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)
......@@ -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 );
};
......
......@@ -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 )
......
......@@ -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_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment