aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2020-12-22 15:57:56 -0800
committerMike Crute <mike@crute.us>2023-04-25 20:45:27 -0700
commita9e2518e51378e844344eaf4c7f40cffea000b7a (patch)
treea712a34a56fb0e09bede9dd6244d23eaea794533
parent142f3fd3cfdeebe6105c462af8bb07930b49f23a (diff)
downloadst-patched-a9e2518e51378e844344eaf4c7f40cffea000b7a.tar.bz2
st-patched-a9e2518e51378e844344eaf4c7f40cffea000b7a.tar.xz
st-patched-a9e2518e51378e844344eaf4c7f40cffea000b7a.zip
Apply st-vertcenter-20180320-6ac8c8a
-rw-r--r--x.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/x.c b/x.c
index 04fd748..d000dcc 100644
--- a/x.c
+++ b/x.c
@@ -84,6 +84,7 @@ typedef struct {
84 int hborderpx, vborderpx; 84 int hborderpx, vborderpx;
85 int ch; /* char height */ 85 int ch; /* char height */
86 int cw; /* char width */ 86 int cw; /* char width */
87 int cyo; /* char y offset */
87 int mode; /* window state/mode flags */ 88 int mode; /* window state/mode flags */
88 int cursor; /* cursor style */ 89 int cursor; /* cursor style */
89} TermWindow; 90} TermWindow;
@@ -1036,6 +1037,7 @@ xloadfonts(const char *fontstr, double fontsize)
1036 /* Setting character width and height. */ 1037 /* Setting character width and height. */
1037 win.cw = ceilf(dc.font.width * cwscale); 1038 win.cw = ceilf(dc.font.width * cwscale);
1038 win.ch = ceilf(dc.font.height * chscale); 1039 win.ch = ceilf(dc.font.height * chscale);
1040 win.cyo = ceilf(dc.font.height * (chscale - 1) / 2);
1039 1041
1040 FcPatternDel(pattern, FC_SLANT); 1042 FcPatternDel(pattern, FC_SLANT);
1041 FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); 1043 FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
@@ -1260,7 +1262,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
1260 FcCharSet *fccharset; 1262 FcCharSet *fccharset;
1261 int i, f, numspecs = 0; 1263 int i, f, numspecs = 0;
1262 1264
1263 for (i = 0, xp = winx, yp = winy + font->ascent; i < len; ++i) { 1265 for (i = 0, xp = winx, yp = winy + font->ascent + win.cyo; i < len; ++i) {
1264 /* Fetch rune and mode for current glyph. */ 1266 /* Fetch rune and mode for current glyph. */
1265 rune = glyphs[i].u; 1267 rune = glyphs[i].u;
1266 mode = glyphs[i].mode; 1268 mode = glyphs[i].mode;
@@ -1285,7 +1287,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
1285 font = &dc.bfont; 1287 font = &dc.bfont;
1286 frcflags = FRC_BOLD; 1288 frcflags = FRC_BOLD;
1287 } 1289 }
1288 yp = winy + font->ascent; 1290 yp = winy + font->ascent + win.cyo;
1289 } 1291 }
1290 1292
1291 /* Lookup character index with default font. */ 1293 /* Lookup character index with default font. */
@@ -1498,12 +1500,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
1498 1500
1499 /* Render underline and strikethrough. */ 1501 /* Render underline and strikethrough. */
1500 if (base.mode & ATTR_UNDERLINE) { 1502 if (base.mode & ATTR_UNDERLINE) {
1501 XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1, 1503 XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent * chscale + 1,
1502 width, 1); 1504 width, 1);
1503 } 1505 }
1504 1506
1505 if (base.mode & ATTR_STRUCK) { 1507 if (base.mode & ATTR_STRUCK) {
1506 XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent * chscale / 3, 1508 XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 * dc.font.ascent * chscale / 3,
1507 width, 1); 1509 width, 1);
1508 } 1510 }
1509 1511