summaryrefslogtreecommitdiff
path: root/st-disable-bold-italic-fonts.patch
blob: a19584ed15f3fa1bf249b4b74fbcdc49a4dcb1fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--- a/config.def.h
+++ b/config.def.h
@@ -8,6 +8,10 @@
 static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
 static int borderpx = 2;
 
+/* disable bold and italic font styles */
+int disablebold = 0;
+int disableitalic = 0;
+
 /*
  * What program is execed by st depends of these precedence rules:
  * 1: program passed with -e
--- a/x.c
+++ b/x.c
@@ -240,6 +240,10 @@ static char *opt_title = NULL;
 
 static int oldbutton = 3; /* button event on startup: 3 = release */
 
+/* declared in config.h */
+extern int disablebold;
+extern int disableitalic;
+
 void
 clipcopy(const Arg *dummy)
 {
@@ -1152,13 +1156,15 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
 			frcflags = FRC_NORMAL;
 			runewidth = win.cw * ((mode & ATTR_WIDE) ? 2.0f : 1.0f);
 			if ((mode & ATTR_ITALIC) && (mode & ATTR_BOLD)) {
-				font = &dc.ibfont;
+				if (!disableitalic && !disablebold) font = &dc.ibfont;
+				if (disableitalic && !disablebold) font = &dc.bfont;
+				if (!disableitalic && disablebold) font = &dc.ifont;
 				frcflags = FRC_ITALICBOLD;
 			} else if (mode & ATTR_ITALIC) {
-				font = &dc.ifont;
+				if (!disableitalic) font = &dc.ifont;
 				frcflags = FRC_ITALIC;
 			} else if (mode & ATTR_BOLD) {
-				font = &dc.bfont;
+				if (!disablebold) font = &dc.bfont;
 				frcflags = FRC_BOLD;
 			}
 			yp = winy + font->ascent;