# st

Unnamed repository; edit this file 'description' to name the repository.

| Log | Files | Refs | README | LICENSE

    commit c60e94b7845807ed63cee6e8d5b8bd8e204afdc1
    parent aa4f40148f6d73a82b01bcd2a161e7bbd1559828
    Author: c0dev0id <sh+github@codevoid.de>
    Date:   Sat, 31 Jul 2021 20:00:20 +0200

    sdk-vertcenter

    Diffstat:
    Mx.c | 10++++++----

    1 file changed, 6 insertions(+), 4 deletions(-)
    diff --git a/x.c b/x.c
    @@ -83,6 +83,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;
    @@ -1008,6 +1009,7 @@ xloadfonts(const 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);
    @@ -1234,7 +1236,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;
    @@ -1259,7 +1261,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;
     		}

     		if (mode & ATTR_BOXDRAW) {
    @@ -1481,12 +1483,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);
     	}