Commit b5ee7aee authored by Marcin Grześkowiak's avatar Marcin Grześkowiak Committed by Alexandre Julliard

user32: Use charset of currently selected font in DrawTextExA.

parent 09e7791c
...@@ -1030,6 +1030,7 @@ INT WINAPI DrawTextExA( HDC hdc, LPSTR str, INT count, ...@@ -1030,6 +1030,7 @@ INT WINAPI DrawTextExA( HDC hdc, LPSTR str, INT count,
DWORD wcount; DWORD wcount;
DWORD wmax; DWORD wmax;
DWORD amax; DWORD amax;
UINT cp;
if (!count) return 0; if (!count) return 0;
if( !str || ((count == -1) && !(count = strlen(str)))) if( !str || ((count == -1) && !(count = strlen(str))))
...@@ -1041,7 +1042,8 @@ INT WINAPI DrawTextExA( HDC hdc, LPSTR str, INT count, ...@@ -1041,7 +1042,8 @@ INT WINAPI DrawTextExA( HDC hdc, LPSTR str, INT count,
} }
return 0; return 0;
} }
wcount = MultiByteToWideChar( CP_ACP, 0, str, count, NULL, 0 ); cp = GdiGetCodePage( hdc );
wcount = MultiByteToWideChar( cp, 0, str, count, NULL, 0 );
wmax = wcount; wmax = wcount;
amax = count; amax = count;
if (flags & DT_MODIFYSTRING) if (flags & DT_MODIFYSTRING)
...@@ -1052,7 +1054,7 @@ INT WINAPI DrawTextExA( HDC hdc, LPSTR str, INT count, ...@@ -1052,7 +1054,7 @@ INT WINAPI DrawTextExA( HDC hdc, LPSTR str, INT count,
wstr = HeapAlloc(GetProcessHeap(), 0, wmax * sizeof(WCHAR)); wstr = HeapAlloc(GetProcessHeap(), 0, wmax * sizeof(WCHAR));
if (wstr) if (wstr)
{ {
MultiByteToWideChar( CP_ACP, 0, str, count, wstr, wcount ); MultiByteToWideChar( cp, 0, str, count, wstr, wcount );
if (flags & DT_MODIFYSTRING) if (flags & DT_MODIFYSTRING)
for (i=4, p=wstr+wcount; i--; p++) *p=0xFFFE; for (i=4, p=wstr+wcount; i--; p++) *p=0xFFFE;
/* Initialise the extra characters so that we can see which ones /* Initialise the extra characters so that we can see which ones
...@@ -1066,7 +1068,7 @@ INT WINAPI DrawTextExA( HDC hdc, LPSTR str, INT count, ...@@ -1066,7 +1068,7 @@ INT WINAPI DrawTextExA( HDC hdc, LPSTR str, INT count,
* and so we need to measure it ourselves. * and so we need to measure it ourselves.
*/ */
for (i=4, p=wstr+wcount; i-- && *p != 0xFFFE; p++) wcount++; for (i=4, p=wstr+wcount; i-- && *p != 0xFFFE; p++) wcount++;
WideCharToMultiByte( CP_ACP, 0, wstr, wcount, str, amax, NULL, NULL ); WideCharToMultiByte( cp, 0, wstr, wcount, str, amax, NULL, NULL );
} }
HeapFree(GetProcessHeap(), 0, wstr); HeapFree(GetProcessHeap(), 0, wstr);
} }
......
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