From da76ffa90efa3f171dd5640c09d09d4d115c0fe1 Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Sun, 16 Jan 2011 23:00:27 +0900 Subject: [PATCH] gdi32: Use the helper function in GetCharWidth32A to support DBCS. --- dlls/gdi32/font.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 1489956f8cb..966d3ddc2b7 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 = FONT_GetCharsByRangeA(firstChar, lastChar, &i); + if(str == NULL) + return FALSE; - str = HeapAlloc(GetProcessHeap(), 0, count); - for(i = 0; i < count; i++) - str[i] = (BYTE)(firstChar + i); - - wstr = FONT_mbtowc(hdc, str, count, &wlen, NULL); + wstr = FONT_mbtowc(hdc, str, i, &wlen, NULL); for(i = 0; i < wlen; i++) {