mirror of
https://github.com/LukeSmithxyz/st.git
synced 2024-11-22 15:25:58 +01:00
vertically center lines in space available
This commit is contained in:
parent
10bf3c8507
commit
e0a07a9392
1 changed files with 5 additions and 3 deletions
8
st.c
8
st.c
|
@ -281,6 +281,7 @@ typedef struct {
|
||||||
int w, h; /* window width and height */
|
int w, h; /* window width and height */
|
||||||
int ch; /* char height */
|
int ch; /* char height */
|
||||||
int cw; /* char width */
|
int cw; /* char width */
|
||||||
|
int cyo; /* char y offset */
|
||||||
char state; /* focus, redraw, visible */
|
char state; /* focus, redraw, visible */
|
||||||
int cursor; /* cursor style */
|
int cursor; /* cursor style */
|
||||||
} XWindow;
|
} XWindow;
|
||||||
|
@ -3583,6 +3584,7 @@ xloadfonts(char *fontstr, double fontsize)
|
||||||
/* Setting character width and height. */
|
/* Setting character width and height. */
|
||||||
xw.cw = ceilf(dc.font.width * cwscale);
|
xw.cw = ceilf(dc.font.width * cwscale);
|
||||||
xw.ch = ceilf(dc.font.height * chscale);
|
xw.ch = ceilf(dc.font.height * chscale);
|
||||||
|
xw.cyo = ceilf(dc.font.height * (chscale - 1) / 2);
|
||||||
|
|
||||||
FcPatternDel(pattern, FC_SLANT);
|
FcPatternDel(pattern, FC_SLANT);
|
||||||
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
|
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
|
||||||
|
@ -3808,7 +3810,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
||||||
font = &dc.bfont;
|
font = &dc.bfont;
|
||||||
frcflags = FRC_BOLD;
|
frcflags = FRC_BOLD;
|
||||||
}
|
}
|
||||||
yp = winy + font->ascent;
|
yp = winy + font->ascent + xw.cyo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup character index with default font. */
|
/* Lookup character index with default font. */
|
||||||
|
@ -4019,12 +4021,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
|
||||||
|
|
||||||
/* Render underline and strikethrough. */
|
/* Render underline and strikethrough. */
|
||||||
if (base.mode & ATTR_UNDERLINE) {
|
if (base.mode & ATTR_UNDERLINE) {
|
||||||
XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1,
|
XftDrawRect(xw.draw, fg, winx, winy + xw.cyo + dc.font.ascent + 1,
|
||||||
width, 1);
|
width, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (base.mode & ATTR_STRUCK) {
|
if (base.mode & ATTR_STRUCK) {
|
||||||
XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3,
|
XftDrawRect(xw.draw, fg, winx, winy + xw.cyo + 2 * dc.font.ascent / 3,
|
||||||
width, 1);
|
width, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue