Module: wine Branch: refs/heads/master Commit: 4d7655a84e0f0bec3a17e6dd38780731f8dc31fb URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=4d7655a84e0f0bec3a17e6dd...
Author: qingdoa daoo qingdao33122@yahoo.com Date: Sat May 13 07:52:59 2006 +0800
gdi: Duplicate extent value for the second byte of a DBCS char.
---
dlls/gdi/font.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi/font.c b/dlls/gdi/font.c index ada4966..d3fa6df 100644 --- a/dlls/gdi/font.c +++ b/dlls/gdi/font.c @@ -1144,10 +1144,28 @@ BOOL WINAPI GetTextExtentExPointA( HDC h { BOOL ret; INT wlen; - LPWSTR p = FONT_mbtowc(str, count, &wlen); - ret = GetTextExtentExPointW( hdc, p, wlen, maxExt, lpnFit, alpDx, size); + INT *walpDx = NULL; + LPWSTR p = NULL; + + if (alpDx && + NULL == (walpDx = HeapAlloc(GetProcessHeap(), 0, count * sizeof(INT)))) + return FALSE; + + p = FONT_mbtowc(str, count, &wlen); + ret = GetTextExtentExPointW( hdc, p, wlen, maxExt, lpnFit, walpDx, size); + if (walpDx) + { + INT n = lpnFit ? *lpnFit : wlen; + INT i, j; + for(i = 0, j = 0; i < n; i++, j++) + { + alpDx[j] = walpDx[i]; + if (IsDBCSLeadByte(str[j])) alpDx[++j] = walpDx[i]; + } + } if (lpnFit) *lpnFit = WideCharToMultiByte(CP_ACP,0,p,*lpnFit,NULL,0,NULL,NULL); HeapFree( GetProcessHeap(), 0, p ); + HeapFree( GetProcessHeap(), 0, walpDx ); return ret; }