non-MM_TEXT mapping modes, TA_TOP and two small thinkos

Krzysztof Foltman kfoltman at portal.onet.pl
Thu Apr 29 07:33:16 CDT 2004


The following program aligns the text incorrectly in WINE (and correctly 
in Windows). It's related to ascent/descent values becoming negative 
after coordinate mapping.

http://foltman.com/alignbug.c

The same thing is present in the PostScript printer driver.

The most common symptom of these bugs are incorrect mixed text/graphics 
printouts (wineps problem) and print previews (xrender problem). Which 
is easy to explain, the non-MM_TEXT modes seem to be mostly used for 
printing.

Attached patches seem to fix the problem in both places. I don't feel 
competent enough to tell if they are the only places where the problem 
exists.

Krzysztof

-------------- next part --------------
Index: dlls/x11drv/xrender.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/xrender.c,v
retrieving revision 1.36
diff -u -r1.36 xrender.c
--- dlls/x11drv/xrender.c	4 Mar 2004 03:55:52 -0000	1.36
+++ dlls/x11drv/xrender.c	29 Apr 2004 12:29:07 -0000
@@ -1083,8 +1083,8 @@
 
     GetTextMetricsW(hdc, &tm);
 
-    tm.tmAscent = X11DRV_YWStoDS(physDev, tm.tmAscent);
-    tm.tmDescent = X11DRV_YWStoDS(physDev, tm.tmDescent);
+    tm.tmAscent = abs(X11DRV_YWStoDS(physDev, tm.tmAscent));
+    tm.tmDescent = abs(X11DRV_YWStoDS(physDev, tm.tmDescent));
     switch( align & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
     case TA_LEFT:
         if (align & TA_UPDATECP) {
-------------- next part --------------
Index: dlls/wineps/text.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/text.c,v
retrieving revision 1.21
diff -u -r1.21 text.c
--- dlls/wineps/text.c	4 Mar 2004 01:42:57 -0000	1.21
+++ dlls/wineps/text.c	29 Apr 2004 12:28:39 -0000
@@ -176,8 +176,8 @@
     sz.cy = PSDRV_YWStoDS(physDev, sz.cy);
 
     GetTextMetricsW(physDev->hdc, &tm);
-    ascent = PSDRV_YWStoDS(physDev, tm.tmAscent);
-    descent = PSDRV_YWStoDS(physDev, tm.tmDescent);
+    ascent = abs(PSDRV_YWStoDS(physDev, tm.tmAscent));
+    descent = abs(PSDRV_YWStoDS(physDev, tm.tmDescent));
 
     TRACE("textAlign = %x\n", align);
     switch(align & (TA_LEFT | TA_CENTER | TA_RIGHT) ) {


More information about the wine-patches mailing list