JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Render struck-out attribute
authorAnders Eurenius <aes@spotify.com>
Sat, 21 Jun 2014 18:32:34 +0000 (20:32 +0200)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Fri, 27 Jun 2014 12:07:22 +0000 (14:07 +0200)
Implement crossed-out text with an XftDrawRect call, similar to how
underline is implemented. The line is drawn at 2/3 of the font ascent,
which seems to work nicely in practice.

Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>

st.c

diff --git a/st.c b/st.c
index a69cc9e..3aa8539 100644 (file)
--- a/st.c
+++ b/st.c
@@ -3383,6 +3383,11 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
                                width, 1);
        }
 
+       if(base.mode & ATTR_STRUCK) {
+               XftDrawRect(xw.draw, fg, winx, winy + 2 * font->ascent / 3,
+                               width, 1);
+       }
+
        /* Reset clip to none. */
        XftDrawSetClip(xw.draw, 0);
 }