st-vertcenter-20170601-5a10aca.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       st-vertcenter-20170601-5a10aca.diff (1573B)
       ---
            1 diff --git a/st.h b/st.h
            2 index 44d4938..a45202f 100644
            3 --- a/st.h
            4 +++ b/st.h
            5 @@ -134,6 +134,7 @@ typedef struct {
            6          int w, h; /* window width and height */
            7          int ch; /* char height */
            8          int cw; /* char width  */
            9 +        int cyo; /* char y offset */
           10          char state; /* focus, redraw, visible */
           11          int cursor; /* cursor style */
           12  } TermWindow;
           13 diff --git a/x.c b/x.c
           14 index fbfd350..1d98aa9 100644
           15 --- a/x.c
           16 +++ b/x.c
           17 @@ -826,6 +826,7 @@ xloadfonts(char *fontstr, double fontsize)
           18          /* Setting character width and height. */
           19          win.cw = ceilf(dc.font.width * cwscale);
           20          win.ch = ceilf(dc.font.height * chscale);
           21 +        win.cyo = ceilf(dc.font.height * (chscale -1) / 2);
           22  
           23          FcPatternDel(pattern, FC_SLANT);
           24          FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
           25 @@ -1024,7 +1025,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
           26                                  font = &dc.bfont;
           27                                  frcflags = FRC_BOLD;
           28                          }
           29 -                        yp = winy + font->ascent;
           30 +                        yp = winy + font->ascent + win.cyo;
           31                  }
           32  
           33                  /* Lookup character index with default font. */
           34 @@ -1235,12 +1236,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
           35  
           36          /* Render underline and strikethrough. */
           37          if (base.mode & ATTR_UNDERLINE) {
           38 -                XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1,
           39 +                XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent + 1,
           40                                  width, 1);
           41          }
           42  
           43          if (base.mode & ATTR_STRUCK) {
           44 -                XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3,
           45 +                XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 * dc.font.ascent / 3,
           46                                  width, 1);
           47          }
           48