aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2020-12-29 10:16:49 +0100
committerlonkaars <l.leblansch@gmail.com>2020-12-29 10:16:49 +0100
commitad59b2a0bdde0de49bdb8b7e962e85f306847ca6 (patch)
tree2b150c5c902de6317dd80b7012c4fb9e10e02380
parenta3cd89812b36b1ac5fcd957c28eb2736a42c71ae (diff)
vertcenter + spacing
-rw-r--r--config.def.h4
-rwxr-xr-xstbin106800 -> 106800 bytes
-rw-r--r--x.c10
3 files changed, 8 insertions, 6 deletions
diff --git a/config.def.h b/config.def.h
index d9c48cd..f14eae0 100644
--- a/config.def.h
+++ b/config.def.h
@@ -26,8 +26,8 @@ char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
char *vtiden = "\033[?6c";
/* Kerning / character bounding-box multipliers */
-static float cwscale = 1.0;
-static float chscale = 1.0;
+static float cwscale = 0.95;
+static float chscale = 1.15;
/*
* word delimiter string
diff --git a/st b/st
index d6fb7ec..ad43304 100755
--- a/st
+++ b/st
Binary files differ
diff --git a/x.c b/x.c
index 56726f0..1b4747e 100644
--- a/x.c
+++ b/x.c
@@ -98,6 +98,7 @@ typedef struct {
int w, h; /* window width and height */
int ch; /* char height */
int cw; /* char width */
+ int cyo; /* char y offset */
int mode; /* window state/mode flags */
int cursor; /* cursor style */
} TermWindow;
@@ -1025,6 +1026,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);
@@ -1257,7 +1259,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;
@@ -1282,7 +1284,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. */
@@ -1498,12 +1500,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);
}