commit 381c2c157726f17137f0c065485d99e2a2a60ab2
Author: Doug Whiteley <[email protected]>
Date: Thu Dec 7 09:40:02 2017 +0000
Add new vertcenter patch version
diff --git a/st.suckless.org/patches/vertcenter/index.md
b/st.suckless.org/patches/vertcenter/index.md
index e8bcc0ca..2c872740 100644
--- a/st.suckless.org/patches/vertcenter/index.md
+++ b/st.suckless.org/patches/vertcenter/index.md
@@ -1,8 +1,6 @@
-vertcenter
-==========
+# vertcenter
-Description
------------
+## Description
Vertically center lines in the space available if you have set a larger
chscale in config.h.
@@ -15,14 +13,13 @@ After:
[](st-vertcenter-after.png)
-Download
---------
+## Download
* [st-vertcenter-0.7.diff](st-vertcenter-0.7.diff)
* [st-vertcenter-20160819-023225e.diff](st-vertcenter-20160819-023225e.diff)
* [st-vertcenter-20170601-5a10aca.diff](st-vertcenter-20170601-5a10aca.diff)
+ * [st-vertcenter-20171207-0ac685f.diff](st-vertcenter-20171207-0ac685f.diff)
-Authors
--------
+## Authors
* Doug Whiteley - <[email protected]>
diff --git
a/st.suckless.org/patches/vertcenter/st-vertcenter-20171207-0ac685f.diff
b/st.suckless.org/patches/vertcenter/st-vertcenter-20171207-0ac685f.diff
new file mode 100644
index 00000000..e5a87bf5
--- /dev/null
+++ b/st.suckless.org/patches/vertcenter/st-vertcenter-20171207-0ac685f.diff
@@ -0,0 +1,57 @@
+diff --git a/st.h b/st.h
+index 44d4938..a45202f 100644
+--- a/st.h
++++ b/st.h
+@@ -134,6 +134,7 @@ typedef struct {
+ int w, h; /* window width and height */
+ int ch; /* char height */
+ int cw; /* char width */
++ int cyo; /* char y offset */
+ char state; /* focus, redraw, visible */
+ int cursor; /* cursor style */
+ } TermWindow;
+diff --git a/x.c b/x.c
+index 191e5dc..063925a 100644
+--- a/x.c
++++ b/x.c
+@@ -826,6 +826,7 @@ xloadfonts(char *fontstr, double fontsize)
+ /* Setting character width and height. */
+ win.cw = ceilf(dc.font.width * cwscale);
+ win.ch = ceilf(dc.font.height * chscale);
++ win.cyo = ceilf(dc.font.height * (chscale - 1) / 2);
+
+ FcPatternDel(pattern, FC_SLANT);
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
+@@ -999,7 +1000,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph
*glyphs, int len, int x
+ FcCharSet *fccharset;
+ int i, f, numspecs = 0;
+
+- for (i = 0, xp = winx, yp = winy + font->ascent; i < len; ++i) {
++ for (i = 0, xp = winx, yp = winy + font->ascent + win.cyo; i < len;
++i) {
+ /* Fetch rune and mode for current glyph. */
+ rune = glyphs[i].u;
+ mode = glyphs[i].mode;
+@@ -1024,7 +1025,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph
*glyphs, int len, int x
+ font = &dc.bfont;
+ frcflags = FRC_BOLD;
+ }
+- yp = winy + font->ascent;
++ yp = winy + font->ascent + win.cyo;
+ }
+
+ /* Lookup character index with default font. */
+@@ -1238,12 +1239,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs,
Glyph base, int len, int x, i
+
+ /* Render underline and strikethrough. */
+ if (base.mode & ATTR_UNDERLINE) {
+- XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1,
++ XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent
+ 1,
+ width, 1);
+ }
+
+ if (base.mode & ATTR_STRUCK) {
+- XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3,
++ XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 *
dc.font.ascent / 3,
+ width, 1);
+ }
+