Commit 9fe27a70 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiGetCharABCWidthsW for GetCharABCWidthsFloatA.

parent fb5a3ba5
...@@ -4813,60 +4813,6 @@ UINT WINAPI NtGdiGetOutlineTextMetricsInternalW( HDC hdc, UINT cbData, ...@@ -4813,60 +4813,6 @@ UINT WINAPI NtGdiGetOutlineTextMetricsInternalW( HDC hdc, UINT cbData,
return ret; return ret;
} }
static LPSTR FONT_GetCharsByRangeA(HDC hdc, UINT firstChar, UINT lastChar, PINT pByteLen)
{
INT i, count = lastChar - firstChar + 1;
UINT mbcp;
UINT c;
LPSTR str;
if (count <= 0)
return NULL;
mbcp = GdiGetCodePage(hdc);
switch (mbcp)
{
case 932:
case 936:
case 949:
case 950:
case 1361:
if (lastChar > 0xffff)
return NULL;
if ((firstChar ^ lastChar) > 0xff)
return NULL;
break;
default:
if (lastChar > 0xff)
return NULL;
mbcp = 0;
break;
}
str = HeapAlloc(GetProcessHeap(), 0, count * 2 + 1);
if (str == NULL)
return NULL;
for(i = 0, c = firstChar; c <= lastChar; i++, c++)
{
if (mbcp) {
if (c > 0xff)
str[i++] = (BYTE)(c >> 8);
if (c <= 0xff && IsDBCSLeadByteEx(mbcp, c))
str[i] = 0x1f; /* FIXME: use default character */
else
str[i] = (BYTE)c;
}
else
str[i] = (BYTE)c;
}
str[i] = '\0';
*pByteLen = i;
return str;
}
/*********************************************************************** /***********************************************************************
* NtGdiGetCharWidthW (win32u.@) * NtGdiGetCharWidthW (win32u.@)
*/ */
...@@ -6320,40 +6266,6 @@ DWORD WINAPI GetGlyphIndicesW(HDC hdc, LPCWSTR lpstr, INT count, ...@@ -6320,40 +6266,6 @@ DWORD WINAPI GetGlyphIndicesW(HDC hdc, LPCWSTR lpstr, INT count,
return ret; return ret;
} }
/*************************************************************************
* GetCharABCWidthsFloatA [GDI32.@]
*
* See GetCharABCWidthsFloatW.
*/
BOOL WINAPI GetCharABCWidthsFloatA( HDC hdc, UINT first, UINT last, LPABCFLOAT abcf )
{
INT i, wlen;
LPSTR str;
LPWSTR wstr;
BOOL ret = TRUE;
str = FONT_GetCharsByRangeA(hdc, first, last, &i);
if (str == NULL)
return FALSE;
wstr = FONT_mbtowc( hdc, str, i, &wlen, NULL );
for (i = 0; i < wlen; i++)
{
if (!GetCharABCWidthsFloatW( hdc, wstr[i], wstr[i], abcf ))
{
ret = FALSE;
break;
}
abcf++;
}
HeapFree( GetProcessHeap(), 0, str );
HeapFree( GetProcessHeap(), 0, wstr );
return ret;
}
/*********************************************************************** /***********************************************************************
* * * *
* Font Resource API * * Font Resource API *
......
...@@ -1718,6 +1718,21 @@ BOOL WINAPI GetCharABCWidthsFloatW( HDC hdc, UINT first, UINT last, ABCFLOAT *ab ...@@ -1718,6 +1718,21 @@ BOOL WINAPI GetCharABCWidthsFloatW( HDC hdc, UINT first, UINT last, ABCFLOAT *ab
} }
/*********************************************************************** /***********************************************************************
* GetCharABCWidthsFloatA (GDI32.@)
*/
BOOL WINAPI GetCharABCWidthsFloatA( HDC hdc, UINT first, UINT last, ABCFLOAT *abcf )
{
WCHAR *chars;
INT count;
BOOL ret;
if (!(chars = get_chars_by_range( hdc, first, last, &count ))) return FALSE;
ret = NtGdiGetCharABCWidthsW( hdc, 0, count, chars, 0, abcf );
HeapFree( GetProcessHeap(), 0, chars );
return ret;
}
/***********************************************************************
* GetCharABCWidthsI (GDI32.@) * GetCharABCWidthsI (GDI32.@)
*/ */
BOOL WINAPI GetCharABCWidthsI( HDC hdc, UINT first, UINT count, WORD *glyphs, ABC *buffer ) BOOL WINAPI GetCharABCWidthsI( HDC hdc, UINT first, UINT count, WORD *glyphs, ABC *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