user32: use charset of currently selected font in DrawTextExA (bug 7861)

Marcin Grześkowiak mgrzeskowiak at tlen.pl
Mon Mar 26 15:58:20 CDT 2007


-------------- next part --------------
>From 1a65d4c49cc7ca8863875a7b257ae617fd394b45 Mon Sep 17 00:00:00 2001
From: Marcin Grzeskowiak <mgrzeskowiak at tlen.pl>
Date: Mon, 26 Mar 2007 22:30:12 +0200
Subject: user32: use charset of currently selected font in DrawTextExA (bug 7861)
---
 dlls/user32/text.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

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



More information about the wine-patches mailing list