st-vertcenter-20160819-023225e.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       st-vertcenter-20160819-023225e.diff (1494B)
       ---
            1 diff --git a/st.c b/st.c
            2 index 2594c65..7285237 100644
            3 --- a/st.c
            4 +++ b/st.c
            5 @@ -268,6 +268,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  } XWindow;
           13 @@ -3359,6 +3360,7 @@ xloadfonts(char *fontstr, double fontsize)
           14          /* Setting character width and height. */
           15          xw.cw = ceilf(dc.font.width * cwscale);
           16          xw.ch = ceilf(dc.font.height * chscale);
           17 +        xw.cyo = ceilf(dc.font.height * (chscale - 1) / 2);
           18  
           19          FcPatternDel(pattern, FC_SLANT);
           20          FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
           21 @@ -3584,7 +3586,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
           22                                  font = &dc.bfont;
           23                                  frcflags = FRC_BOLD;
           24                          }
           25 -                        yp = winy + font->ascent;
           26 +                        yp = winy + font->ascent + xw.cyo;
           27                  }
           28  
           29                  /* Lookup character index with default font. */
           30 @@ -3796,12 +3798,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
           31  
           32          /* Render underline and strikethrough. */
           33          if (base.mode & ATTR_UNDERLINE) {
           34 -                XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1,
           35 +                XftDrawRect(xw.draw, fg, winx, winy + xw.cyo + dc.font.ascent + 1,
           36                                  width, 1);
           37          }
           38  
           39          if (base.mode & ATTR_STRUCK) {
           40 -                XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3,
           41 +                XftDrawRect(xw.draw, fg, winx, winy + xw.cyo + 2 * dc.font.ascent / 3,
           42                                  width, 1);
           43          }
           44