[hackers] [st] Implementing italic-bold. This will require an increase of the avgWdth. || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Fri, 14 Sep 2012 19:48:24 +0200 (CEST)

changeset: 302:2a0be13ebd44
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Fri Sep 14 19:46:07 2012 +0200
files: config.def.h st.c
description:
Implementing italic-bold. This will require an increase of the avgWdth.


diff -r abf95fd3442b -r 2a0be13ebd44 config.def.h
--- a/config.def.h Thu Sep 13 23:21:40 2012 +0200
+++ b/config.def.h Fri Sep 14 19:46:07 2012 +0200
_AT_@ -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
diff -r abf95fd3442b -r 2a0be13ebd44 st.c
--- a/st.c Thu Sep 13 23:21:40 2012 +0200
+++ b/st.c Fri Sep 14 19:46:07 2012 +0200
_AT_@ -240,7 +240,7 @@
                 short lbearing;
                 short rbearing;
                 XFontSet set;
- } font, bfont, ifont;
+ } font, bfont, ifont, ibfont;
 } DC;
 
 static void die(const char*, ...);
_AT_@ -1945,13 +1945,15 @@
 }
 
 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);
_AT_@ -1959,6 +1961,8 @@
             &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
_AT_@ -1973,7 +1977,7 @@
         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;
_AT_@ -2068,6 +2072,8 @@
 
         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]);
Received on Fri Sep 14 2012 - 19:48:24 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 14 2012 - 20:00:08 CEST