diff options
author | Christoph Lohmann <20h@r-36.net> | 2012-09-14 19:46:07 +0200 |
---|---|---|
committer | Christoph Lohmann <20h@r-36.net> | 2012-09-14 19:46:07 +0200 |
commit | dccba949b5aa3a61b48faa63a6d3fe563548e247 (patch) | |
tree | 91af38ed4e7352133703478c8778cb96c5e94392 | |
parent | 30e167c45700474b7fb13c721d6887e4a8435dcc (diff) | |
download | st-dccba949b5aa3a61b48faa63a6d3fe563548e247.tar.gz st-dccba949b5aa3a61b48faa63a6d3fe563548e247.tar.bz2 |
Implementing italic-bold. This will require an increase of the avgWdth.
-rw-r--r-- | config.def.h | 7 | ||||
-rw-r--r-- | st.c | 12 |
2 files changed, 13 insertions, 6 deletions
diff --git a/config.def.h b/config.def.h index 0aef8be..f0e5556 100644 --- a/config.def.h +++ b/config.def.h @@ -1,8 +1,9 @@ -#define FONT "-*-*-medium-r-*-*-*-120-75-75-*-60-*-*" -#define BOLDFONT "-*-*-bold-r-*-*-*-120-75-75-*-60-*-*" +#define FONT "-*-*-medium-r-*-*-*-120-75-75-*-70-*-*" +#define BOLDFONT "-*-*-bold-r-*-*-*-120-75-75-*-70-*-*" /* If italic is not availbel, fall back to bold. */ -#define ITALICFONT "-*-*-medium-o-*-*-*-120-75-75-*-60-*-*," BOLDFONT +#define ITALICFONT "-*-*-medium-o-*-*-*-120-75-75-*-70-*-*," BOLDFONT +#define ITALICBOLDFONT "-*-*-bold-o-*-*-*-120-75-75-*-70-*-*," BOLDFONT /* Space in pixels around the terminal buffer */ #define BORDER 2 @@ -240,7 +240,7 @@ typedef struct { short lbearing; short rbearing; XFontSet set; - } font, bfont, ifont; + } font, bfont, ifont, ibfont; } DC; static void die(const char*, ...); @@ -1945,13 +1945,15 @@ xgetfontinfo(XFontSet set, int *ascent, int *descent, short *lbearing, short *rb } void -initfonts(char *fontstr, char *bfontstr, char *ifontstr) { +initfonts(char *fontstr, char *bfontstr, char *ifontstr, char *ibfontstr) { if((dc.font.set = xinitfont(fontstr)) == NULL) die("Can't load font %s\n", fontstr); if((dc.bfont.set = xinitfont(bfontstr)) == NULL) die("Can't load bfont %s\n", bfontstr); if((dc.ifont.set = xinitfont(ifontstr)) == NULL) die("Can't load ifont %s\n", ifontstr); + if((dc.ibfont.set = xinitfont(ibfontstr)) == NULL) + die("Can't load ibfont %s\n", ibfontstr); xgetfontinfo(dc.font.set, &dc.font.ascent, &dc.font.descent, &dc.font.lbearing, &dc.font.rbearing); @@ -1959,6 +1961,8 @@ initfonts(char *fontstr, char *bfontstr, char *ifontstr) { &dc.bfont.lbearing, &dc.bfont.rbearing); xgetfontinfo(dc.ifont.set, &dc.ifont.ascent, &dc.ifont.descent, &dc.ifont.lbearing, &dc.ifont.rbearing); + xgetfontinfo(dc.ibfont.set, &dc.ibfont.ascent, &dc.ibfont.descent, + &dc.ibfont.lbearing, &dc.ibfont.rbearing); } void @@ -1973,7 +1977,7 @@ xinit(void) { xw.scr = XDefaultScreen(xw.dpy); /* font */ - initfonts(FONT, BOLDFONT, ITALICFONT); + initfonts(FONT, BOLDFONT, ITALICFONT, ITALICBOLDFONT); /* XXX: Assuming same size for bold font */ xw.cw = dc.font.rbearing - dc.font.lbearing; @@ -2068,6 +2072,8 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { if(base.mode & ATTR_ITALIC) fontset = dc.ifont.set; + if(base.mode & (ATTR_ITALIC|ATTR_ITALIC)) + fontset = dc.ibfont.set; XSetBackground(xw.dpy, dc.gc, dc.col[bg]); XSetForeground(xw.dpy, dc.gc, dc.col[fg]); |