gdi32: GetCharABCWidthsA should work for DBCS.

This commit is contained in:
Kusanagi Kouichi 2011-01-13 19:18:16 +09:00 committed by Alexandre Julliard
parent fcb4a1610e
commit 5c987fc574
2 changed files with 21 additions and 7 deletions

View File

@ -2296,18 +2296,33 @@ BOOL WINAPI GetAspectRatioFilterEx( HDC hdc, LPSIZE pAspectRatio )
BOOL WINAPI GetCharABCWidthsA(HDC hdc, UINT firstChar, UINT lastChar,
LPABC abc )
{
INT i, wlen, count = (INT)(lastChar - firstChar + 1);
INT i, wlen;
UINT c;
LPSTR str;
LPWSTR wstr;
BOOL ret = TRUE;
if(count <= 0) return FALSE;
if (lastChar < firstChar)
return FALSE;
str = HeapAlloc(GetProcessHeap(), 0, count);
for(i = 0; i < count; i++)
str[i] = (BYTE)(firstChar + i);
str = HeapAlloc(GetProcessHeap(), 0, (lastChar - firstChar + 1) * 2 + 1);
if (str == NULL)
return FALSE;
wstr = FONT_mbtowc(hdc, str, count, &wlen, NULL);
for(i = 0, c = firstChar; c <= lastChar; i++, c++)
{
if (c > 0xff)
str[i++] = (BYTE)(c >> 8);
str[i] = (BYTE)c;
}
str[i] = '\0';
wstr = FONT_mbtowc(hdc, str, -1, &wlen, NULL);
if (wstr == NULL)
{
HeapFree(GetProcessHeap(), 0, str);
return FALSE;
}
for(i = 0; i < wlen; i++)
{

View File

@ -973,7 +973,6 @@ static void test_GetCharABCWidths(void)
memset(a, 0, sizeof a);
memset(w, 0, sizeof w);
hfont = SelectObject(hdc, hfont);
todo_wine
ok(pGetCharABCWidthsA(hdc, c[i].a, c[i].a + 1, a) &&
pGetCharABCWidthsW(hdc, c[i].w, c[i].w + 1, w) &&
memcmp(a, w, sizeof a) == 0,