Re: [dev][st] Disable bold fonts?

From: Tarmo Heiskanen <turskii_AT_gmail.com>
Date: Sun, 30 Mar 2014 16:50:37 +0300

I am using this patch to disable both bold font and italics:

diff --git a/st.c b/st.c
index 69b2491..b4c4f3b 100644
--- a/st.c
+++ b/st.c
_AT_@ -337,7 +337,7 @@ typedef struct {
 /* Drawing Context */
 typedef struct {
        Colour col[LEN(colorname) < 256 ? 256 : LEN(colorname)];
- Font font, bfont, ifont, ibfont;
+ Font font;
        GC gc;
 } DC;

_AT_@ -2973,21 +2973,6 @@ xloadfonts(char *fontstr, double fontsize) {
        xw.cw = CEIL(dc.font.width * cwscale);
        xw.ch = CEIL(dc.font.height * chscale);

- FcPatternDel(pattern, FC_SLANT);
- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
- if(xloadfont(&dc.ifont, pattern))
- die("st: can't open font %s\n", fontstr);
-
- FcPatternDel(pattern, FC_WEIGHT);
- FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
- if(xloadfont(&dc.ibfont, pattern))
- die("st: can't open font %s\n", fontstr);
-
- FcPatternDel(pattern, FC_SLANT);
- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
- if(xloadfont(&dc.bfont, pattern))
- die("st: can't open font %s\n", fontstr);
-
        FcPatternDestroy(pattern);
 }

_AT_@ -3019,9 +3004,6 @@ xunloadfonts(void) {
        frclen = 0;

        xunloadfont(&dc.font);
- xunloadfont(&dc.bfont);
- xunloadfont(&dc.ifont);
- xunloadfont(&dc.ibfont);
 }

 void
_AT_@ -3166,13 +3148,9 @@ xdraws(char *s, Glyph base, int x, int y, int
charlen, int bytelen) {
        if(base.mode & ATTR_ITALIC) {
                if(base.fg == defaultfg)
                        base.fg = defaultitalic;
- font = &dc.ifont;
- frcflags = FRC_ITALIC;
        } else if((base.mode & ATTR_ITALIC) && (base.mode & ATTR_BOLD)) {
                if(base.fg == defaultfg)
                        base.fg = defaultitalic;
- font = &dc.ibfont;
- frcflags = FRC_ITALICBOLD;
        } else if(base.mode & ATTR_UNDERLINE) {
                if(base.fg == defaultfg)
                        base.fg = defaultunderline;
_AT_@ -3217,8 +3195,6 @@ xdraws(char *s, Glyph base, int x, int y, int
charlen, int bytelen) {
                 * 196 - 231 – highest 256 color cube
                 * 252 - 255 – brightest colors in greyscale
                 */
- font = &dc.bfont;
- frcflags = FRC_BOLD;
        }

        if(IS_SET(MODE_REVERSE)) {


2014-03-30 8:09 GMT+03:00 Wolfgang Corcoran-Mathe
<first.lord.of.teal_AT_gmail.com>:
> Hello all, recent st convert here. Because fontconfig's emboldened fonts
> are hideous, I am trying to disable bold fonts entirely in st. This
> crude hack does it:
>
> --- st-0.4.1/st.c
> _AT_@ -2752,7 +2752,7 @@
> * 196 - 231 – highest 256 color cube
> * 252 - 255 – brightest colors in greyscale
> */
> - font = &dc.bfont;
> + font = &dc.font;
> frcflags = FRC_BOLD;
> }
>
> Obviously, bold fonts are still loaded/unloaded, etc. Has anyone created
> a cleaner and more comprehensive patch to disable bold fonts entirely?
>
> Thanks.
>
> --
> Wolfgang Corcoran-Mathe
Received on Sun Mar 30 2014 - 15:50:37 CEST

This archive was generated by hypermail 2.3.0 : Sun Mar 30 2014 - 16:00:11 CEST