st-disable-bold-italic-fonts.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
st-disable-bold-italic-fonts.diff (1967B) | |
--- | |
1 From 1e932656e6ca3a50ec67cafabdb08d711635c504 Mon Sep 17 00:00:00 2001 | |
2 From: Alex Kozadaev <[email protected]> | |
3 Date: Fri, 24 Mar 2017 12:11:47 +0000 | |
4 Subject: [PATCH] disable bold, italic and roman fonts globally | |
5 | |
6 --- | |
7 config.def.h | 6 ++++++ | |
8 x.c | 14 +++++++++++--- | |
9 2 files changed, 17 insertions(+), 3 deletions(-) | |
10 | |
11 diff --git a/config.def.h b/config.def.h | |
12 index 877afab..87c4534 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… | |
17 */ | |
18 char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=tru… | |
19 + | |
20 +/* disable bold, italic and roman fonts globally */ | |
21 +int disablebold = 0; | |
22 +int disableitalic = 0; | |
23 +int disableroman = 0; | |
24 + | |
25 int borderpx = 2; | |
26 | |
27 /* | |
28 diff --git a/x.c b/x.c | |
29 index 743b084..23e4f0a 100644 | |
30 --- a/x.c | |
31 +++ b/x.c | |
32 @@ -158,6 +158,11 @@ typedef struct { | |
33 static Fontcache frc[16]; | |
34 static int frclen = 0; | |
35 | |
36 +/* declared in config.h */ | |
37 +extern int disablebold; | |
38 +extern int disableitalic; | |
39 +extern int disableroman; | |
40 + | |
41 void | |
42 getbuttoninfo(XEvent *e) | |
43 { | |
44 @@ -828,17 +833,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("st: 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("st: 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("st: can't open font %s\n", fontstr); | |
67 | |
68 -- | |
69 2.1.4 | |
70 |