aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2020-05-13 15:44:34 -0700
committerMike Crute <mike@crute.us>2020-05-13 15:44:34 -0700
commitd1c63a31368190188f35253cfee4aec5788a4db3 (patch)
tree7c3fc9053b9461f470cfb71b4e707d69a42f7c0a
parent045a0fab4f80b57f4a982ae6bc5f33fe21d66111 (diff)
downloadst-patched-d1c63a31368190188f35253cfee4aec5788a4db3.tar.bz2
st-patched-d1c63a31368190188f35253cfee4aec5788a4db3.tar.xz
st-patched-d1c63a31368190188f35253cfee4aec5788a4db3.zip
apply vertcenter patch
-rw-r--r--x.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/x.c b/x.c
index 1dc44d6..758f521 100644
--- a/x.c
+++ b/x.c
@@ -83,6 +83,7 @@ typedef struct {
83 int w, h; /* window width and height */ 83 int w, h; /* window width and height */
84 int ch; /* char height */ 84 int ch; /* char height */
85 int cw; /* char width */ 85 int cw; /* char width */
86 int cyo; /* char y offset */
86 int mode; /* window state/mode flags */ 87 int mode; /* window state/mode flags */
87 int cursor; /* cursor style */ 88 int cursor; /* cursor style */
88} TermWindow; 89} TermWindow;
@@ -1000,6 +1001,7 @@ xloadfonts(char *fontstr, double fontsize)
1000 /* Setting character width and height. */ 1001 /* Setting character width and height. */
1001 win.cw = ceilf(dc.font.width * cwscale); 1002 win.cw = ceilf(dc.font.width * cwscale);
1002 win.ch = ceilf(dc.font.height * chscale); 1003 win.ch = ceilf(dc.font.height * chscale);
1004 win.cyo = ceilf(dc.font.height * (chscale - 1) / 2);
1003 1005
1004 FcPatternDel(pattern, FC_SLANT); 1006 FcPatternDel(pattern, FC_SLANT);
1005 FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); 1007 FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
@@ -1223,7 +1225,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
1223 FcCharSet *fccharset; 1225 FcCharSet *fccharset;
1224 int i, f, numspecs = 0; 1226 int i, f, numspecs = 0;
1225 1227
1226 for (i = 0, xp = winx, yp = winy + font->ascent; i < len; ++i) { 1228 for (i = 0, xp = winx, yp = winy + font->ascent + win.cyo; i < len; ++i) {
1227 /* Fetch rune and mode for current glyph. */ 1229 /* Fetch rune and mode for current glyph. */
1228 rune = glyphs[i].u; 1230 rune = glyphs[i].u;
1229 mode = glyphs[i].mode; 1231 mode = glyphs[i].mode;
@@ -1248,7 +1250,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
1248 font = &dc.bfont; 1250 font = &dc.bfont;
1249 frcflags = FRC_BOLD; 1251 frcflags = FRC_BOLD;
1250 } 1252 }
1251 yp = winy + font->ascent; 1253 yp = winy + font->ascent + win.cyo;
1252 } 1254 }
1253 1255
1254 /* Lookup character index with default font. */ 1256 /* Lookup character index with default font. */
@@ -1461,12 +1463,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
1461 1463
1462 /* Render underline and strikethrough. */ 1464 /* Render underline and strikethrough. */
1463 if (base.mode & ATTR_UNDERLINE) { 1465 if (base.mode & ATTR_UNDERLINE) {
1464 XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1, 1466 XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent + 1,
1465 width, 1); 1467 width, 1);
1466 } 1468 }
1467 1469
1468 if (base.mode & ATTR_STRUCK) { 1470 if (base.mode & ATTR_STRUCK) {
1469 XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3, 1471 XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 * dc.font.ascent / 3,
1470 width, 1); 1472 width, 1);
1471 } 1473 }
1472 1474