st

Custom st fork
git clone git://git.deurzen.net/st
Log | Files | Refs | README | LICENSE

st-disable-font-styling-0.8.2.diff (1693B)


      1 diff --git a/config.def.h b/config.def.h
      2 index 00d289c..01f01b6 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -6,6 +6,12 @@
      6   * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
      7   */
      8  static char *font = "xos4 Terminus:pixelsize=12";
      9 +
     10 +/* disable bold, italic and roman fonts globally */
     11 +int disablebold = 1;
     12 +int disableitalic = 1;
     13 +int disableroman = 0;
     14 +
     15  static int borderpx = 2;
     16  
     17  /*
     18 diff --git a/x.c b/x.c
     19 index e9fd6e9..8623711 100644
     20 --- a/x.c
     21 +++ b/x.c
     22 @@ -229,6 +229,11 @@ static char *usedfont = NULL;
     23  static double usedfontsize = 0;
     24  static double defaultfontsize = 0;
     25  
     26 +/* declared in config.h */
     27 +extern int disablebold;
     28 +extern int disableitalic;
     29 +extern int disableroman;
     30 +
     31  static char *opt_class = NULL;
     32  static char **opt_cmd  = NULL;
     33  static char *opt_embed = NULL;
     34 @@ -966,17 +971,20 @@ xloadfonts(char *fontstr, double fontsize)
     35  	win.ch = ceilf(dc.font.height * chscale);
     36  
     37  	FcPatternDel(pattern, FC_SLANT);
     38 -	FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
     39 +	if (!disableitalic)
     40 +		FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
     41  	if (xloadfont(&dc.ifont, pattern))
     42  		die("can't open font %s\n", fontstr);
     43  
     44  	FcPatternDel(pattern, FC_WEIGHT);
     45 -	FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
     46 +	if (!disablebold)
     47 +		FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
     48  	if (xloadfont(&dc.ibfont, pattern))
     49  		die("can't open font %s\n", fontstr);
     50  
     51  	FcPatternDel(pattern, FC_SLANT);
     52 -	FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
     53 +	if (!disableroman)
     54 +		FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
     55  	if (xloadfont(&dc.bfont, pattern))
     56  		die("can't open font %s\n", fontstr);
     57