all repos — dotfiles @ 5de32a513f82634a6205d004292b72f49c739da8

my *nix dotfiles

st/patches/st-vertcenter-20180320-6ac8c8a.diff (view raw)

 1--- a/x.c	Tue Mar 20 00:28:57 2018
 2+++ b/x.c	Tue Mar 20 00:29:02 2018
 3@@ -80,6 +80,7 @@
 4 	int w, h; /* window width and height */
 5 	int ch; /* char height */
 6 	int cw; /* char width  */
 7+	int cyo; /* char y offset */
 8 	int mode; /* window state/mode flags */
 9 	int cursor; /* cursor style */
10 } TermWindow;
11@@ -949,6 +950,7 @@
12 	/* Setting character width and height. */
13 	win.cw = ceilf(dc.font.width * cwscale);
14 	win.ch = ceilf(dc.font.height * chscale);
15+	win.cyo = ceilf(dc.font.height * (chscale - 1) / 2);
16 
17 	FcPatternDel(pattern, FC_SLANT);
18 	FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
19@@ -1130,7 +1132,7 @@
20 	FcCharSet *fccharset;
21 	int i, f, numspecs = 0;
22 
23-	for (i = 0, xp = winx, yp = winy + font->ascent; i < len; ++i) {
24+	for (i = 0, xp = winx, yp = winy + font->ascent + win.cyo; i < len; ++i) {
25 		/* Fetch rune and mode for current glyph. */
26 		rune = glyphs[i].u;
27 		mode = glyphs[i].mode;
28@@ -1155,7 +1157,7 @@
29 				font = &dc.bfont;
30 				frcflags = FRC_BOLD;
31 			}
32-			yp = winy + font->ascent;
33+			yp = winy + font->ascent + win.cyo;
34 		}
35 
36 		/* Lookup character index with default font. */
37@@ -1371,12 +1373,12 @@
38 
39 	/* Render underline and strikethrough. */
40 	if (base.mode & ATTR_UNDERLINE) {
41-		XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1,
42+		XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent + 1,
43 				width, 1);
44 	}
45 
46 	if (base.mode & ATTR_STRUCK) {
47-		XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3,
48+		XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 * dc.font.ascent / 3,
49 				width, 1);
50 	}
51