psdrv rotated text fix

Huw D M Davies h.davies1 at physics.ox.ac.uk
Sat Feb 3 04:45:37 CST 2001


	Huw D M Davies <hdavies at codeweavers.com>
	Fix for rotated text when lpDx is specified.
	Better handling of cumulative rounding errors.
-- 
   Dr. Huw D M Davies              | Clarendon Laboratory
   h.davies1 at physics.ox.ac.uk      | Parks Road
   Tel: +44 1865 272390            | Oxford OX1 3PU
   Fax: +44 1865 272400            | UK
-------------- next part --------------
Index: dlls/wineps/text.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/text.c,v
retrieving revision 1.5
diff -u -r1.5 text.c
--- dlls/wineps/text.c	2001/01/26 20:38:11	1.5
+++ dlls/wineps/text.c	2001/02/03 10:32:05
@@ -161,15 +161,17 @@
     if(!lpDx)
         PSDRV_WriteShow(dc, strbuf, lstrlenW(strbuf));
     else {
-        INT i, dx, dy;
-	INT newx = x, newy = y;
+        INT i;
+	float dx = 0.0, dy = 0.0;
+	float cos_theta = cos(physDev->font.escapement * M_PI / 1800.0);
+	float sin_theta = sin(physDev->font.escapement * M_PI / 1800.0);
         for(i = 0; i < count-1; i++) {
+	    TRACE("lpDx[%d] = %d\n", i, lpDx[i]);
 	    PSDRV_WriteShow(dc, &strbuf[i], 1);
-	    dx = lpDx[i] * cos(physDev->font.escapement);
-	    dy = lpDx[i] * sin(physDev->font.escapement);
-	    newx += INTERNAL_XWSTODS(dc, dx);
-	    newy += INTERNAL_YWSTODS(dc, dy);
-	    PSDRV_WriteMoveTo(dc, newx, newy);
+	    dx += lpDx[i] * cos_theta;
+	    dy -= lpDx[i] * sin_theta;
+	    PSDRV_WriteMoveTo(dc, x + INTERNAL_XWSTODS(dc, dx),
+			      y + INTERNAL_YWSTODS(dc, dy));
 	}
 	PSDRV_WriteShow(dc, &strbuf[i], 1);
     }


More information about the wine-patches mailing list