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

gdi32: Use NtGdiGetCharABCWidthsW for GetCharABCWidthsI.

parent 78a93513
......@@ -4886,7 +4886,9 @@ BOOL WINAPI NtGdiGetCharWidthW( HDC hdc, UINT first, UINT last, WCHAR *chars,
if (!(abc = HeapAlloc(GetProcessHeap(), 0, count * sizeof(ABC))))
return FALSE;
if (!GetCharABCWidthsI( hdc, first, last, chars, abc ))
if (!NtGdiGetCharABCWidthsW( hdc, first, last, chars,
NTGDI_GETCHARABCWIDTHS_INT | NTGDI_GETCHARABCWIDTHS_INDICES,
abc ))
{
HeapFree( GetProcessHeap(), 0, abc );
return FALSE;
......@@ -5641,18 +5643,26 @@ BOOL WINAPI NtGdiGetCharABCWidthsW( HDC hdc, UINT first, UINT last, WCHAR *chars
return FALSE;
}
if (!chars) count = last - first + 1;
/* 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_INDICES)
{
release_dc_ptr( dc );
return FALSE;
dev = GET_DC_PHYSDEV( dc, pGetCharABCWidthsI );
ret = dev->funcs->pGetCharABCWidthsI( dev, first, count, chars, buffer );
}
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))
{
release_dc_ptr( dc );
return FALSE;
}
if (!chars) count = last - first + 1;
dev = GET_DC_PHYSDEV( dc, pGetCharABCWidths );
ret = dev->funcs->pGetCharABCWidths( dev, first, count, chars, buffer );
}
dev = GET_DC_PHYSDEV( dc, pGetCharABCWidths );
ret = dev->funcs->pGetCharABCWidths( dev, first, count, chars, buffer );
if (ret)
{
ABC *abc = buffer;
......@@ -5670,58 +5680,6 @@ BOOL WINAPI NtGdiGetCharABCWidthsW( HDC hdc, UINT first, UINT last, WCHAR *chars
}
/******************************************************************************
* GetCharABCWidthsI [GDI32.@]
*
* Retrieves widths of characters in range.
*
* PARAMS
* hdc [I] Handle of device context
* firstChar [I] First glyphs in range to query
* count [I] Last glyphs in range to query
* pgi [i] Array of glyphs to query
* abc [O] Address of character-width structure
*
* NOTES
* Only works with TrueType fonts
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI GetCharABCWidthsI( HDC hdc, UINT firstChar, UINT count,
LPWORD pgi, LPABC abc)
{
DC *dc = get_dc_ptr(hdc);
PHYSDEV dev;
unsigned int i;
BOOL ret;
if (!dc) return FALSE;
if (!abc)
{
release_dc_ptr( dc );
return FALSE;
}
dev = GET_DC_PHYSDEV( dc, pGetCharABCWidthsI );
ret = dev->funcs->pGetCharABCWidthsI( dev, firstChar, count, pgi, abc );
if (ret)
{
/* convert device units to logical */
for( i = 0; i < count; i++, abc++ ) {
abc->abcA = width_to_LP(dc, abc->abcA);
abc->abcB = width_to_LP(dc, abc->abcB);
abc->abcC = width_to_LP(dc, abc->abcC);
}
}
release_dc_ptr( dc );
return ret;
}
/***********************************************************************
* GetGlyphOutlineA (GDI32.@)
*/
......
......@@ -1707,3 +1707,14 @@ BOOL WINAPI GetCharABCWidthsA( HDC hdc, UINT first, UINT last, ABC *abc )
HeapFree( GetProcessHeap(), 0, chars );
return ret;
}
/***********************************************************************
* GetCharABCWidthsI (GDI32.@)
*/
BOOL WINAPI GetCharABCWidthsI( HDC hdc, UINT first, UINT count, WORD *glyphs, ABC *buffer )
{
TRACE( "(%p, %d, %d, %p, %p)\n", hdc, first, count, glyphs, buffer );
return NtGdiGetCharABCWidthsW( hdc, first, count, glyphs,
NTGDI_GETCHARABCWIDTHS_INDICES | NTGDI_GETCHARABCWIDTHS_INT,
buffer );
}
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