sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

st-disable-bold-italic-fonts-0.8.2.diff (2051B)


      1 From 0856fbfcdae3f8e48db791984591b0bb8a91de68 Mon Sep 17 00:00:00 2001
      2 From: Ryan Kes <alrayyes@gmail.com>
      3 Date: Fri, 29 Mar 2019 10:59:09 +0100
      4 Subject: [PATCH] st-disable-bold-italic-fonts-0.8.2
      5 
      6 ---
      7  config.def.h |  6 ++++++
      8  x.c          | 10 +++++++++-
      9  2 files changed, 15 insertions(+), 1 deletion(-)
     10 
     11 diff --git a/config.def.h b/config.def.h
     12 index 482901e..4f5aeac 100644
     13 --- a/config.def.h
     14 +++ b/config.def.h
     15 @@ -6,6 +6,12 @@
     16   * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
     17   */
     18  static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
     19 +
     20 +/* disable bold, italic and roman fonts globally */
     21 +int disablebold = 0;
     22 +int disableitalic = 0;
     23 +int disableroman = 0;
     24 +
     25  static int borderpx = 2;
     26  
     27  /*
     28 diff --git a/x.c b/x.c
     29 index 5828a3b..9663fa6 100644
     30 --- a/x.c
     31 +++ b/x.c
     32 @@ -233,6 +233,11 @@ static char *usedfont = NULL;
     33  static double usedfontsize = 0;
     34  static double defaultfontsize = 0;
     35  
     36 +/* declared in config.h */
     37 +extern int disablebold;
     38 +extern int disableitalic;
     39 +extern int disableroman;
     40 +
     41  static char *opt_class = NULL;
     42  static char **opt_cmd  = NULL;
     43  static char *opt_embed = NULL;
     44 @@ -966,17 +971,20 @@ xloadfonts(char *fontstr, double fontsize)
     45  	win.ch = ceilf(dc.font.height * chscale);
     46  
     47  	FcPatternDel(pattern, FC_SLANT);
     48 -	FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
     49 +	if (!disableitalic)
     50 +		FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
     51  	if (xloadfont(&dc.ifont, pattern))
     52  		die("can't open font %s\n", fontstr);
     53  
     54  	FcPatternDel(pattern, FC_WEIGHT);
     55 -	FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
     56 +	if (!disablebold)
     57 +	    FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
     58  	if (xloadfont(&dc.ibfont, pattern))
     59  		die("can't open font %s\n", fontstr);
     60  
     61  	FcPatternDel(pattern, FC_SLANT);
     62 -	FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
     63 +	if (!disableroman)
     64 +	    FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
     65  	if (xloadfont(&dc.bfont, pattern))
     66  		die("can't open font %s\n", fontstr);
     67  
     68 -- 
     69 2.39.2
     70