Akihiro Sagawa : gdi32: Use the helper function in GetCharWidth32A to support DBCS.

Alexandre Julliard julliard at winehq.org
Mon Jan 17 10:59:49 CST 2011


Module: wine
Branch: master
Commit: da76ffa90efa3f171dd5640c09d09d4d115c0fe1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=da76ffa90efa3f171dd5640c09d09d4d115c0fe1

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Sun Jan 16 23:00:27 2011 +0900

gdi32: Use the helper function in GetCharWidth32A to support DBCS.

---

 dlls/gdi32/font.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 1489956..966d3dd 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -1615,18 +1615,16 @@ BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar,
 BOOL WINAPI GetCharWidth32A( HDC hdc, UINT firstChar, UINT lastChar,
                                LPINT buffer )
 {
-    INT i, wlen, count = (INT)(lastChar - firstChar + 1);
+    INT i, wlen;
     LPSTR str;
     LPWSTR wstr;
     BOOL ret = TRUE;
 
-    if(count <= 0) return FALSE;
-
-    str = HeapAlloc(GetProcessHeap(), 0, count);
-    for(i = 0; i < count; i++)
-	str[i] = (BYTE)(firstChar + i);
+    str = FONT_GetCharsByRangeA(firstChar, lastChar, &i);
+    if(str == NULL)
+        return FALSE;
 
-    wstr = FONT_mbtowc(hdc, str, count, &wlen, NULL);
+    wstr = FONT_mbtowc(hdc, str, i, &wlen, NULL);
 
     for(i = 0; i < wlen; i++)
     {




More information about the wine-cvs mailing list