[wiki] [sites] Add vertcenter st patch || Doug Whiteley

From: <git_AT_suckless.org>
Date: Fri, 19 Aug 2016 11:59:52 +0200

commit ead8e31902cab38938cc5367ef12c03c52371c11
Author: Doug Whiteley <dougwhiteley_AT_gmail.com>
Date: Fri Aug 19 10:59:42 2016 +0100

    Add vertcenter st patch

diff --git a/st.suckless.org/patches/st-vertcenter-0.7.diff b/st.suckless.org/patches/st-vertcenter-0.7.diff
new file mode 100644
index 0000000..7c865b2
--- /dev/null
+++ b/st.suckless.org/patches/st-vertcenter-0.7.diff
_AT_@ -0,0 +1,42 @@
+--- a/st.c
++++ b/st.c
+_AT_@ -268,6 +268,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 */
+ } XWindow;
+_AT_@ -3359,6 +3360,7 @@ xloadfonts(char *fontstr, double fontsize)
+ /* Setting character width and height. */
+ xw.cw = ceilf(dc.font.width * cwscale);
+ xw.ch = ceilf(dc.font.height * chscale);
++ xw.cyo = ceilf(dc.font.height * (chscale - 1) / 2);
+
+ FcPatternDel(pattern, FC_SLANT);
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
+_AT_@ -3584,7 +3586,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 + xw.cyo;
+ }
+
+ /* Lookup character index with default font. */
+_AT_@ -3796,12 +3798,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 + xw.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 + xw.cyo + 2 * dc.font.ascent / 3,
+ width, 1);
+ }
+
diff --git a/st.suckless.org/patches/st-vertcenter-20160819-023225e.diff b/st.suckless.org/patches/st-vertcenter-20160819-023225e.diff
new file mode 100644
index 0000000..e3fca96
--- /dev/null
+++ b/st.suckless.org/patches/st-vertcenter-20160819-023225e.diff
_AT_@ -0,0 +1,44 @@
+diff --git a/st.c b/st.c
+index 2594c65..7285237 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -268,6 +268,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 */
+ } XWindow;
+_AT_@ -3359,6 +3360,7 @@ xloadfonts(char *fontstr, double fontsize)
+ /* Setting character width and height. */
+ xw.cw = ceilf(dc.font.width * cwscale);
+ xw.ch = ceilf(dc.font.height * chscale);
++ xw.cyo = ceilf(dc.font.height * (chscale - 1) / 2);
+
+ FcPatternDel(pattern, FC_SLANT);
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
+_AT_@ -3584,7 +3586,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 + xw.cyo;
+ }
+
+ /* Lookup character index with default font. */
+_AT_@ -3796,12 +3798,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 + xw.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 + xw.cyo + 2 * dc.font.ascent / 3,
+ width, 1);
+ }
+
diff --git a/st.suckless.org/patches/st-vertcenter-after-s.png b/st.suckless.org/patches/st-vertcenter-after-s.png
new file mode 100644
index 0000000..f894e2f
Binary files /dev/null and b/st.suckless.org/patches/st-vertcenter-after-s.png differ
diff --git a/st.suckless.org/patches/st-vertcenter-after.png b/st.suckless.org/patches/st-vertcenter-after.png
new file mode 100644
index 0000000..f5d0a54
Binary files /dev/null and b/st.suckless.org/patches/st-vertcenter-after.png differ
diff --git a/st.suckless.org/patches/st-vertcenter-before-s.png b/st.suckless.org/patches/st-vertcenter-before-s.png
new file mode 100644
index 0000000..7899569
Binary files /dev/null and b/st.suckless.org/patches/st-vertcenter-before-s.png differ
diff --git a/st.suckless.org/patches/st-vertcenter-before.png b/st.suckless.org/patches/st-vertcenter-before.png
new file mode 100644
index 0000000..3e67a71
Binary files /dev/null and b/st.suckless.org/patches/st-vertcenter-before.png differ
diff --git a/st.suckless.org/patches/vertcenter.md b/st.suckless.org/patches/vertcenter.md
new file mode 100644
index 0000000..45e6d98
--- /dev/null
+++ b/st.suckless.org/patches/vertcenter.md
_AT_@ -0,0 +1,25 @@
+vertcenter
+==========
+
+Description
+-----------
+
+Vertically center lines in the space available if you have set a larger
+chscale in config.h.
+
+Before:
+->[![Before](st-vertcenter-before-s.png)](st-vertcenter-before.png)<-
+
+After:
+->[![After](st-vertcenter-after-s.png)](st-vertcenter-after.png)<-
+
+Download
+--------
+
+ * [st-vertcenter-0.7.diff](st-vertcenter-0.7.diff)
+ * [st-vertcenter-20160819-023225e.diff](st-vertcenter-20160819-023225e.diff)
+
+Authors
+-------
+
+ * Doug Whiteley - <dougwhiteley_AT_gmail.com>
Received on Fri Aug 19 2016 - 11:59:52 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 19 2016 - 12:00:18 CEST