gdi32: Move GetCharacterPlacementA to text.c.
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
cd60db086a
commit
e27c61be21
|
@ -6937,59 +6937,6 @@ DWORD WINAPI GetGlyphIndicesW(HDC hdc, LPCWSTR lpstr, INT count,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* GetCharacterPlacementA [GDI32.@]
|
||||
*
|
||||
* See GetCharacterPlacementW.
|
||||
*
|
||||
* NOTES:
|
||||
* the web browser control of ie4 calls this with dwFlags=0
|
||||
*/
|
||||
DWORD WINAPI
|
||||
GetCharacterPlacementA(HDC hdc, LPCSTR lpString, INT uCount,
|
||||
INT nMaxExtent, GCP_RESULTSA *lpResults,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
WCHAR *lpStringW;
|
||||
INT uCountW;
|
||||
GCP_RESULTSW resultsW;
|
||||
DWORD ret;
|
||||
UINT font_cp;
|
||||
|
||||
TRACE("%s, %d, %d, 0x%08x\n",
|
||||
debugstr_an(lpString, uCount), uCount, nMaxExtent, dwFlags);
|
||||
|
||||
lpStringW = FONT_mbtowc(hdc, lpString, uCount, &uCountW, &font_cp);
|
||||
|
||||
if (!lpResults)
|
||||
{
|
||||
ret = GetCharacterPlacementW(hdc, lpStringW, uCountW, nMaxExtent, NULL, dwFlags);
|
||||
HeapFree(GetProcessHeap(), 0, lpStringW);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* both structs are equal in size */
|
||||
memcpy(&resultsW, lpResults, sizeof(resultsW));
|
||||
|
||||
if(lpResults->lpOutString)
|
||||
resultsW.lpOutString = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*uCountW);
|
||||
|
||||
ret = GetCharacterPlacementW(hdc, lpStringW, uCountW, nMaxExtent, &resultsW, dwFlags);
|
||||
|
||||
lpResults->nGlyphs = resultsW.nGlyphs;
|
||||
lpResults->nMaxFit = resultsW.nMaxFit;
|
||||
|
||||
if(lpResults->lpOutString) {
|
||||
WideCharToMultiByte(font_cp, 0, resultsW.lpOutString, uCountW,
|
||||
lpResults->lpOutString, uCount, NULL, NULL );
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpStringW);
|
||||
HeapFree(GetProcessHeap(), 0, resultsW.lpOutString);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* GetCharABCWidthsFloatA [GDI32.@]
|
||||
*
|
||||
|
|
|
@ -1009,3 +1009,46 @@ DWORD WINAPI GetCharacterPlacementW( HDC hdc, const WCHAR *str, INT count, INT m
|
|||
HeapFree( GetProcessHeap(), 0, kern );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* GetCharacterPlacementA (GDI32.@)
|
||||
*/
|
||||
DWORD WINAPI GetCharacterPlacementA( HDC hdc, const char *str, INT count, INT max_extent,
|
||||
GCP_RESULTSA *result, DWORD flags )
|
||||
{
|
||||
GCP_RESULTSW resultsW;
|
||||
WCHAR *strW;
|
||||
INT countW;
|
||||
DWORD ret;
|
||||
UINT font_cp;
|
||||
|
||||
TRACE( "%s, %d, %d, 0x%08x\n", debugstr_an(str, count), count, max_extent, flags );
|
||||
|
||||
strW = text_mbtowc( hdc, str, count, &countW, &font_cp );
|
||||
|
||||
if (!result)
|
||||
{
|
||||
ret = GetCharacterPlacementW( hdc, strW, countW, max_extent, NULL, flags );
|
||||
HeapFree( GetProcessHeap(), 0, strW );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* both structs are equal in size */
|
||||
memcpy( &resultsW, result, sizeof(resultsW) );
|
||||
|
||||
if (result->lpOutString)
|
||||
resultsW.lpOutString = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR) * countW );
|
||||
|
||||
ret = GetCharacterPlacementW( hdc, strW, countW, max_extent, &resultsW, flags );
|
||||
|
||||
result->nGlyphs = resultsW.nGlyphs;
|
||||
result->nMaxFit = resultsW.nMaxFit;
|
||||
|
||||
if (result->lpOutString)
|
||||
WideCharToMultiByte( font_cp, 0, resultsW.lpOutString, countW,
|
||||
result->lpOutString, count, NULL, NULL );
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, strW );
|
||||
HeapFree( GetProcessHeap(), 0, resultsW.lpOutString );
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue