gdi32: Use NtGdiGetCharABCWidthsW for GetCharABCWidthsFloatW.
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
ce9b1ddc1a
commit
fb5a3ba541
|
@ -5650,12 +5650,15 @@ BOOL WINAPI NtGdiGetCharABCWidthsW( HDC hdc, UINT first, UINT last, WCHAR *chars
|
|||
}
|
||||
else
|
||||
{
|
||||
/* unlike GetCharABCWidthsFloatW, this one is supposed to fail on non-scalable fonts */
|
||||
dev = GET_DC_PHYSDEV( dc, pGetTextMetrics );
|
||||
if (!dev->funcs->pGetTextMetrics( dev, &tm ) || !(tm.tmPitchAndFamily & TMPF_VECTOR))
|
||||
if (flags & NTGDI_GETCHARABCWIDTHS_INT)
|
||||
{
|
||||
release_dc_ptr( dc );
|
||||
return FALSE;
|
||||
/* unlike float variant, this one is supposed to fail on non-scalable fonts */
|
||||
dev = GET_DC_PHYSDEV( dc, pGetTextMetrics );
|
||||
if (!dev->funcs->pGetTextMetrics( dev, &tm ) || !(tm.tmPitchAndFamily & TMPF_VECTOR))
|
||||
{
|
||||
release_dc_ptr( dc );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!chars) count = last - first + 1;
|
||||
|
@ -5666,13 +5669,29 @@ BOOL WINAPI NtGdiGetCharABCWidthsW( HDC hdc, UINT first, UINT last, WCHAR *chars
|
|||
if (ret)
|
||||
{
|
||||
ABC *abc = buffer;
|
||||
/* convert device units to logical */
|
||||
for (i = 0; i < count; i++)
|
||||
if (flags & NTGDI_GETCHARABCWIDTHS_INT)
|
||||
{
|
||||
abc[i].abcA = width_to_LP( dc, abc[i].abcA );
|
||||
abc[i].abcB = width_to_LP( dc, abc[i].abcB );
|
||||
abc[i].abcC = width_to_LP( dc, abc[i].abcC );
|
||||
}
|
||||
/* convert device units to logical */
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
abc[i].abcA = width_to_LP( dc, abc[i].abcA );
|
||||
abc[i].abcB = width_to_LP( dc, abc[i].abcB );
|
||||
abc[i].abcC = width_to_LP( dc, abc[i].abcC );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* convert device units to logical */
|
||||
FLOAT scale = fabs( dc->xformVport2World.eM11 );
|
||||
ABCFLOAT *abcf = buffer;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
abcf[i].abcfA = abc[i].abcA * scale;
|
||||
abcf[i].abcfB = abc[i].abcB * scale;
|
||||
abcf[i].abcfC = abc[i].abcC * scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
release_dc_ptr( dc );
|
||||
|
@ -6335,56 +6354,6 @@ BOOL WINAPI GetCharABCWidthsFloatA( HDC hdc, UINT first, UINT last, LPABCFLOAT a
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* GetCharABCWidthsFloatW [GDI32.@]
|
||||
*
|
||||
* Retrieves widths of a range of characters.
|
||||
*
|
||||
* PARAMS
|
||||
* hdc [I] Handle to device context.
|
||||
* first [I] First character in range to query.
|
||||
* last [I] Last character in range to query.
|
||||
* abcf [O] Array of LPABCFLOAT structures.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: TRUE
|
||||
* Failure: FALSE
|
||||
*/
|
||||
BOOL WINAPI GetCharABCWidthsFloatW( HDC hdc, UINT first, UINT last, LPABCFLOAT abcf )
|
||||
{
|
||||
UINT i;
|
||||
ABC *abc;
|
||||
PHYSDEV dev;
|
||||
BOOL ret = FALSE;
|
||||
DC *dc = get_dc_ptr( hdc );
|
||||
|
||||
TRACE("%p, %d, %d, %p\n", hdc, first, last, abcf);
|
||||
|
||||
if (!dc) return FALSE;
|
||||
|
||||
if (!abcf) goto done;
|
||||
if (!(abc = HeapAlloc( GetProcessHeap(), 0, (last - first + 1) * sizeof(*abc) ))) goto done;
|
||||
|
||||
dev = GET_DC_PHYSDEV( dc, pGetCharABCWidths );
|
||||
ret = dev->funcs->pGetCharABCWidths( dev, first, last - first + 1, NULL, abc );
|
||||
if (ret)
|
||||
{
|
||||
/* convert device units to logical */
|
||||
FLOAT scale = fabs( dc->xformVport2World.eM11 );
|
||||
for (i = first; i <= last; i++, abcf++)
|
||||
{
|
||||
abcf->abcfA = abc[i - first].abcA * scale;
|
||||
abcf->abcfB = abc[i - first].abcB * scale;
|
||||
abcf->abcfC = abc[i - first].abcC * scale;
|
||||
}
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, abc );
|
||||
|
||||
done:
|
||||
release_dc_ptr( dc );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* *
|
||||
* Font Resource API *
|
||||
|
|
|
@ -1708,6 +1708,15 @@ BOOL WINAPI GetCharABCWidthsA( HDC hdc, UINT first, UINT last, ABC *abc )
|
|||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetCharABCWidthsFloatW (GDI32.@)
|
||||
*/
|
||||
BOOL WINAPI GetCharABCWidthsFloatW( HDC hdc, UINT first, UINT last, ABCFLOAT *abcf )
|
||||
{
|
||||
TRACE( "%p, %d, %d, %p\n", hdc, first, last, abcf );
|
||||
return NtGdiGetCharABCWidthsW( hdc, first, last, NULL, 0, abcf );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetCharABCWidthsI (GDI32.@)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue