aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h7
-rw-r--r--st.c12
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 @@
1 1
2#define FONT "-*-*-medium-r-*-*-*-120-75-75-*-60-*-*" 2#define FONT "-*-*-medium-r-*-*-*-120-75-75-*-70-*-*"
3#define BOLDFONT "-*-*-bold-r-*-*-*-120-75-75-*-60-*-*" 3#define BOLDFONT "-*-*-bold-r-*-*-*-120-75-75-*-70-*-*"
4/* If italic is not availbel, fall back to bold. */ 4/* If italic is not availbel, fall back to bold. */
5#define ITALICFONT "-*-*-medium-o-*-*-*-120-75-75-*-60-*-*," BOLDFONT 5#define ITALICFONT "-*-*-medium-o-*-*-*-120-75-75-*-70-*-*," BOLDFONT
6#define ITALICBOLDFONT "-*-*-bold-o-*-*-*-120-75-75-*-70-*-*," BOLDFONT
6 7
7/* Space in pixels around the terminal buffer */ 8/* Space in pixels around the terminal buffer */
8#define BORDER 2 9#define BORDER 2
diff --git a/st.c b/st.c
index da895c6..2e1ac67 100644
--- a/st.c
+++ b/st.c
@@ -240,7 +240,7 @@ typedef struct {
240 short lbearing; 240 short lbearing;
241 short rbearing; 241 short rbearing;
242 XFontSet set; 242 XFontSet set;
243 } font, bfont, ifont; 243 } font, bfont, ifont, ibfont;
244} DC; 244} DC;
245 245
246static void die(const char*, ...); 246static void die(const char*, ...);
@@ -1945,13 +1945,15 @@ xgetfontinfo(XFontSet set, int *ascent, int *descent, short *lbearing, short *rb
1945} 1945}
1946 1946
1947void 1947void
1948initfonts(char *fontstr, char *bfontstr, char *ifontstr) { 1948initfonts(char *fontstr, char *bfontstr, char *ifontstr, char *ibfontstr) {
1949 if((dc.font.set = xinitfont(fontstr)) == NULL) 1949 if((dc.font.set = xinitfont(fontstr)) == NULL)
1950 die("Can't load font %s\n", fontstr); 1950 die("Can't load font %s\n", fontstr);
1951 if((dc.bfont.set = xinitfont(bfontstr)) == NULL) 1951 if((dc.bfont.set = xinitfont(bfontstr)) == NULL)
1952 die("Can't load bfont %s\n", bfontstr); 1952 die("Can't load bfont %s\n", bfontstr);
1953 if((dc.ifont.set = xinitfont(ifontstr)) == NULL) 1953 if((dc.ifont.set = xinitfont(ifontstr)) == NULL)
1954 die("Can't load ifont %s\n", ifontstr); 1954 die("Can't load ifont %s\n", ifontstr);
1955 if((dc.ibfont.set = xinitfont(ibfontstr)) == NULL)
1956 die("Can't load ibfont %s\n", ibfontstr);
1955 1957
1956 xgetfontinfo(dc.font.set, &dc.font.ascent, &dc.font.descent, 1958 xgetfontinfo(dc.font.set, &dc.font.ascent, &dc.font.descent,
1957 &dc.font.lbearing, &dc.font.rbearing); 1959 &dc.font.lbearing, &dc.font.rbearing);
@@ -1959,6 +1961,8 @@ initfonts(char *fontstr, char *bfontstr, char *ifontstr) {
1959 &dc.bfont.lbearing, &dc.bfont.rbearing); 1961 &dc.bfont.lbearing, &dc.bfont.rbearing);
1960 xgetfontinfo(dc.ifont.set, &dc.ifont.ascent, &dc.ifont.descent, 1962 xgetfontinfo(dc.ifont.set, &dc.ifont.ascent, &dc.ifont.descent,
1961 &dc.ifont.lbearing, &dc.ifont.rbearing); 1963 &dc.ifont.lbearing, &dc.ifont.rbearing);
1964 xgetfontinfo(dc.ibfont.set, &dc.ibfont.ascent, &dc.ibfont.descent,
1965 &dc.ibfont.lbearing, &dc.ibfont.rbearing);
1962} 1966}
1963 1967
1964void 1968void
@@ -1973,7 +1977,7 @@ xinit(void) {
1973 xw.scr = XDefaultScreen(xw.dpy); 1977 xw.scr = XDefaultScreen(xw.dpy);
1974 1978
1975 /* font */ 1979 /* font */
1976 initfonts(FONT, BOLDFONT, ITALICFONT); 1980 initfonts(FONT, BOLDFONT, ITALICFONT, ITALICBOLDFONT);
1977 1981
1978 /* XXX: Assuming same size for bold font */ 1982 /* XXX: Assuming same size for bold font */
1979 xw.cw = dc.font.rbearing - dc.font.lbearing; 1983 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) {
2068 2072
2069 if(base.mode & ATTR_ITALIC) 2073 if(base.mode & ATTR_ITALIC)
2070 fontset = dc.ifont.set; 2074 fontset = dc.ifont.set;
2075 if(base.mode & (ATTR_ITALIC|ATTR_ITALIC))
2076 fontset = dc.ibfont.set;
2071 2077
2072 XSetBackground(xw.dpy, dc.gc, dc.col[bg]); 2078 XSetBackground(xw.dpy, dc.gc, dc.col[bg]);
2073 XSetForeground(xw.dpy, dc.gc, dc.col[fg]); 2079 XSetForeground(xw.dpy, dc.gc, dc.col[fg]);