patch for underline and strikeout text in xrender

Dimitrie O. Paun dimi at intelliware.ca
Wed Aug 27 16:34:53 CDT 2003


On Wed, 27 Aug 2003 Dave_Belanger at cimmetry.com wrote:

+
+    /* check for underline or strike-through */
+       long lineWidth = tm.tmDescent / 4;
+
+       if (lf.lfUnderline) {
+           long linePos = tm.tmDescent / 2;
+
+               TSXSetForeground( gdi_display, physDev->gc, physDev->textPixel );
+               TSXSetLineAttributes( gdi_display, physDev->gc, lineWidth,
+                                                         LineSolid, CapProjecting, JoinBevel );
+       TSXDrawLine( gdi_display, physDev->drawable, physDev->gc,
+                                        physDev->org.x + x, physDev->org.y + y + linePos,
+                                        physDev->org.x + x + width, physDev->org.y + y + linePos );
+       }
+
+       if (lf.lfStrikeOut) {
+           long linePos = tm.tmAscent / 3.5;
+
+               TSXSetForeground( gdi_display, physDev->gc, physDev->textPixel );
+               TSXSetLineAttributes( gdi_display, physDev->gc, lineWidth,
+                                                         LineSolid, CapProjecting, JoinBevel );
+               TSXDrawLine( gdi_display, physDev->drawable, physDev->gc,
+                                        physDev->org.x + x, physDev->org.y + y - linePos,
+                                        physDev->org.x + x + width, physDev->org.y + y - linePos );
+      }

What about we simplify this a bit:

    if (lf.lfUnderline || lf.lfStrikeOut) {
        long linePos = (lf.lfUnderline ? tm.tmDescent / 2 : - tm.tmAscent / 3.5);

        TSXSetForeground( gdi_display, physDev->gc, physDev->textPixel );
        TSXSetLineAttributes( gdi_display, physDev->gc, lineWidth,
                              LineSolid, CapProjecting, JoinBevel );
        TSXDrawLine( gdi_display, physDev->drawable, physDev->gc,
                     physDev->org.x + x, physDev->org.y + y + linePos,
                     physDev->org.x + x + width, physDev->org.y + y + linePos );
    }



-- 
Dimi.




More information about the wine-devel mailing list