From 7faae4c5d59396ee87191bcba01b3ac9488d1052 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 19 May 2003 18:48:37 +0000 Subject: [PATCH] Fixed some issues in EMFDRV_ExtTextOut. --- dlls/gdi/enhmfdrv/graphics.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/dlls/gdi/enhmfdrv/graphics.c b/dlls/gdi/enhmfdrv/graphics.c index dd27f0672f..ca5eab41a4 100644 --- a/dlls/gdi/enhmfdrv/graphics.c +++ b/dlls/gdi/enhmfdrv/graphics.c @@ -643,8 +643,7 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, BOOL ret; EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev; - nSize = sizeof(*pemr) + (count+1)/2 * 2 * sizeof(WCHAR) + - (lpDx ? count * sizeof(INT) : 0); + nSize = sizeof(*pemr) + ((count+1) & ~1) * sizeof(WCHAR) + count * sizeof(INT); TRACE("%s count %d nSize = %ld\n", debugstr_wn(str, count), count, nSize); pemr = HeapAlloc(GetProcessHeap(), 0, nSize); @@ -675,13 +674,18 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, pemr->emrtext.rcl.bottom = lprect->bottom; } - if(lpDx) { - pemr->emrtext.offDx = sizeof(*pemr) + (count+1)/2 * 2 * sizeof(WCHAR); + pemr->emrtext.offDx = pemr->emrtext.offString + count * sizeof(WCHAR); + if(lpDx) memcpy((char*)pemr + pemr->emrtext.offDx, lpDx, count * sizeof(INT)); - } else - pemr->emrtext.offDx = 0; /* FIXME: actually Windows fills out the array - using GetCharWidth in this case */ - + else + { + UINT i; + INT *dx = (INT *)((char*)pemr + pemr->emrtext.offDx); + for (i = 0; i < count; i++) + { + GetCharWidth32W(physDev->hdc, str[i], str[i], &dx[i]); + } + } ret = EMFDRV_WriteRecord( dev, &pemr->emr ); if(ret) -- 2.32.0.93.g670b81a890