From fb0b76b0ffb26febdfb0924d8666ee740dcc4905 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Mon, 14 Mar 2022 09:45:12 +0100 Subject: [PATCH] make underlines and strikethroughs respect `chscale` Ref. https://git.suckless.org/st/commit/2aefa348baf4b702fdce98eb105bcba175d8283f.html --- README.md | 2 +- x.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0b7549a..3bfed65 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.8.5 (e823e23, 2022-02-17) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. +Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.8.5 (2aefa34, 2022-03-13) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/st-flexipatch/blob/master/patches.def.h): ```c diff --git a/x.c b/x.c index 5a8b945..e8bbf53 100644 --- a/x.c +++ b/x.c @@ -2012,9 +2012,8 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i // Underline Style if (base.ustyle != 3) { - //XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1, width, 1); XFillRectangle(xw.dpy, XftDrawDrawable(xw.draw), ugc, winx, - winy + dc.font.ascent + 1, width, wlw); + winy + dc.font.ascent * chscale + 1, width, wlw); } else if (base.ustyle == 3) { int ww = win.cw;//width; int wh = dc.font.descent - wlw/2 - 1;//r.height/7; @@ -2326,20 +2325,20 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i XFreeGC(xw.dpy, ugc); #elif VERTCENTER_PATCH - XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent + 1, + XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent * chscale + 1, width, 1); #else - XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1, + XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1, width, 1); #endif // UNDERCURL_PATCH | VERTCENTER_PATCH } if (base.mode & ATTR_STRUCK) { #if VERTCENTER_PATCH - XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 * dc.font.ascent / 3, + XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 * dc.font.ascent * chscale / 3, width, 1); #else - XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3, + XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent * chscale / 3, width, 1); #endif // VERTCENTER_PATCH }