From 9973af57e959784e981f6db5e755bef9056a9c4f Mon Sep 17 00:00:00 2001 From: Dave Belanger Date: Sat, 11 Oct 2003 05:24:22 +0000 Subject: [PATCH] Implementation of underline and strikeout text in xrender. --- dlls/gdi/freetype.c | 2 +- dlls/x11drv/xrender.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/dlls/gdi/freetype.c b/dlls/gdi/freetype.c index 23d6866db76..db90139a127 100644 --- a/dlls/gdi/freetype.c +++ b/dlls/gdi/freetype.c @@ -2225,7 +2225,7 @@ UINT WineEngGetOutlineTextMetrics(GdiFont font, UINT cbSize, strcatW((WCHAR*)cp, style_nameW); ret = needed; - if(needed <= cbSize) + if(potm && needed <= cbSize) memcpy(potm, font->potm, font->potm->otmSize); end: diff --git a/dlls/x11drv/xrender.c b/dlls/x11drv/xrender.c index 05bbe2b5e53..2082f8ec84a 100644 --- a/dlls/x11drv/xrender.c +++ b/dlls/x11drv/xrender.c @@ -1234,6 +1234,43 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag } wine_tsx11_unlock(); + if (lf.lfUnderline || lf.lfStrikeOut) { + int linePos; + unsigned int lineWidth; + UINT nMetricsSize = GetOutlineTextMetricsW(hdc, 0, NULL); + OUTLINETEXTMETRICW* otm = HeapAlloc(GetProcessHeap(), 0, nMetricsSize); + if (!otm) goto done; + + GetOutlineTextMetricsW(hdc, nMetricsSize, otm); + + wine_tsx11_lock(); + XSetForeground( gdi_display, physDev->gc, physDev->textPixel ); + + if (lf.lfUnderline) { + linePos = INTERNAL_YWSTODS(dc, otm->otmsUnderscorePosition); + lineWidth = INTERNAL_YWSTODS(dc, otm->otmsUnderscoreSize); + + XSetLineAttributes( gdi_display, physDev->gc, lineWidth, + LineSolid, CapProjecting, JoinBevel ); + XDrawLine( 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) { + linePos = INTERNAL_YWSTODS(dc, otm->otmsStrikeoutPosition); + lineWidth = INTERNAL_YWSTODS(dc, otm->otmsStrikeoutSize); + + XSetLineAttributes( gdi_display, physDev->gc, lineWidth, + LineSolid, CapProjecting, JoinBevel ); + XDrawLine( 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 ); + } + wine_tsx11_unlock(); + HeapFree(GetProcessHeap(), 0, otm); + } + } else { INT offset = 0, xoff = 0, yoff = 0; wine_tsx11_lock();