gdi32: Use NtGdiGetTextMetricsW for GetTextMetrics.
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:
parent
c0486678eb
commit
6caf861a63
|
@ -4820,21 +4820,9 @@ BOOL WINAPI NtGdiGetTextExtentExW( HDC hdc, const WCHAR *str, INT count, INT max
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetTextMetricsA (GDI32.@)
|
* NtGdiGetTextMetricsW (win32u.@)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI GetTextMetricsA( HDC hdc, TEXTMETRICA *metrics )
|
BOOL WINAPI NtGdiGetTextMetricsW( HDC hdc, TEXTMETRICW *metrics, ULONG flags )
|
||||||
{
|
|
||||||
TEXTMETRICW tm32;
|
|
||||||
|
|
||||||
if (!GetTextMetricsW( hdc, &tm32 )) return FALSE;
|
|
||||||
FONT_TextMetricWToA( &tm32, metrics );
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* GetTextMetricsW (GDI32.@)
|
|
||||||
*/
|
|
||||||
BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
|
|
||||||
{
|
{
|
||||||
PHYSDEV physdev;
|
PHYSDEV physdev;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
|
@ -699,6 +699,44 @@ static WCHAR *text_mbtowc( HDC hdc, const char *str, INT count, INT *plenW, UINT
|
||||||
return strW;
|
return strW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void text_metric_WtoA( const TEXTMETRICW *tmW, TEXTMETRICA *tmA )
|
||||||
|
{
|
||||||
|
tmA->tmHeight = tmW->tmHeight;
|
||||||
|
tmA->tmAscent = tmW->tmAscent;
|
||||||
|
tmA->tmDescent = tmW->tmDescent;
|
||||||
|
tmA->tmInternalLeading = tmW->tmInternalLeading;
|
||||||
|
tmA->tmExternalLeading = tmW->tmExternalLeading;
|
||||||
|
tmA->tmAveCharWidth = tmW->tmAveCharWidth;
|
||||||
|
tmA->tmMaxCharWidth = tmW->tmMaxCharWidth;
|
||||||
|
tmA->tmWeight = tmW->tmWeight;
|
||||||
|
tmA->tmOverhang = tmW->tmOverhang;
|
||||||
|
tmA->tmDigitizedAspectX = tmW->tmDigitizedAspectX;
|
||||||
|
tmA->tmDigitizedAspectY = tmW->tmDigitizedAspectY;
|
||||||
|
tmA->tmFirstChar = min( tmW->tmFirstChar, 255 );
|
||||||
|
if (tmW->tmCharSet == SYMBOL_CHARSET)
|
||||||
|
{
|
||||||
|
tmA->tmFirstChar = 0x1e;
|
||||||
|
tmA->tmLastChar = 0xff; /* win9x behaviour - we need the OS2 table data to calculate correctly */
|
||||||
|
}
|
||||||
|
else if (tmW->tmPitchAndFamily & TMPF_TRUETYPE)
|
||||||
|
{
|
||||||
|
tmA->tmFirstChar = tmW->tmDefaultChar - 1;
|
||||||
|
tmA->tmLastChar = min( tmW->tmLastChar, 0xff );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmA->tmFirstChar = min( tmW->tmFirstChar, 0xff );
|
||||||
|
tmA->tmLastChar = min( tmW->tmLastChar, 0xff );
|
||||||
|
}
|
||||||
|
tmA->tmDefaultChar = tmW->tmDefaultChar;
|
||||||
|
tmA->tmBreakChar = tmW->tmBreakChar;
|
||||||
|
tmA->tmItalic = tmW->tmItalic;
|
||||||
|
tmA->tmUnderlined = tmW->tmUnderlined;
|
||||||
|
tmA->tmStruckOut = tmW->tmStruckOut;
|
||||||
|
tmA->tmPitchAndFamily = tmW->tmPitchAndFamily;
|
||||||
|
tmA->tmCharSet = tmW->tmCharSet;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ExtTextOutW (GDI32.@)
|
* ExtTextOutW (GDI32.@)
|
||||||
*/
|
*/
|
||||||
|
@ -1183,3 +1221,23 @@ BOOL WINAPI GetTextExtentPointW( HDC hdc, const WCHAR *str, INT count, SIZE *siz
|
||||||
{
|
{
|
||||||
return GetTextExtentPoint32W( hdc, str, count, size );
|
return GetTextExtentPoint32W( hdc, str, count, size );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* GetTextMetricsW (GDI32.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
|
||||||
|
{
|
||||||
|
return NtGdiGetTextMetricsW( hdc, metrics, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* GetTextMetricsA (GDI32.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI GetTextMetricsA( HDC hdc, TEXTMETRICA *metrics )
|
||||||
|
{
|
||||||
|
TEXTMETRICW tm32;
|
||||||
|
|
||||||
|
if (!GetTextMetricsW( hdc, &tm32 )) return FALSE;
|
||||||
|
text_metric_WtoA( &tm32, metrics );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue