Revert "actually properly use the original disable-bold-italic-fonts patch, apparently I have been doing it wrong"

This reverts commit 14ad67f639.
This commit is contained in:
Von Random 2019-04-19 15:08:04 +03:00
parent 0d88911a9b
commit 89e4ee144e
2 changed files with 28 additions and 44 deletions

View file

@ -9,9 +9,8 @@ static char *font = "xos4 Terminus:bold:pixelsize=14";
static int borderpx = 1; static int borderpx = 1;
/* disable bold and italic font styles */ /* disable bold and italic font styles */
int disablebold = 0; int disablebold = 1;
int disableitalic = 1; int disableitalic = 1;
int disableroman = 1;
/* /*
* What program is execed by st depends of these precedence rules: * What program is execed by st depends of these precedence rules:

View file

@ -1,60 +1,45 @@
# based on Alex Kozadaev's st-disable-bold-italic-fonts.diff
# https://st.suckless.org/patches/disable_bold_italic_fonts/
diff --git a/config.def.h b/config.def.h
index 482901e..50a4896 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -6,6 +6,12 @@ @@ -8,6 +8,10 @@
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
+
+/* disable bold, italic and roman fonts globally */
+int disablebold = 0;
+int disableitalic = 0;
+int disableroman = 0;
+
static int borderpx = 2; static int borderpx = 2;
+/* disable bold and italic font styles */
+int disablebold = 0;
+int disableitalic = 0;
+
/* /*
diff --git a/x.c b/x.c * What program is execed by st depends of these precedence rules:
index 5828a3b..ad65501 100644 * 1: program passed with -e
--- a/x.c --- a/x.c
+++ b/x.c +++ b/x.c
@@ -244,6 +244,11 @@ static char *opt_title = NULL; @@ -240,6 +240,10 @@ static char *opt_title = NULL;
static int oldbutton = 3; /* button event on startup: 3 = release */ static int oldbutton = 3; /* button event on startup: 3 = release */
+/* declared in config.h */ +/* declared in config.h */
+extern int disablebold; +extern int disablebold;
+extern int disableitalic; +extern int disableitalic;
+extern int disableroman;
+ +
void void
clipcopy(const Arg *dummy) clipcopy(const Arg *dummy)
{ {
@@ -960,17 +965,20 @@ xloadfonts(char *fontstr, double fontsize) @@ -1152,13 +1156,15 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
win.ch = ceilf(dc.font.height * chscale); frcflags = FRC_NORMAL;
runewidth = win.cw * ((mode & ATTR_WIDE) ? 2.0f : 1.0f);
FcPatternDel(pattern, FC_SLANT); if ((mode & ATTR_ITALIC) && (mode & ATTR_BOLD)) {
- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); - font = &dc.ibfont;
+ if (!disableitalic) + if (!disableitalic && !disablebold) font = &dc.ibfont;
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); + if (disableitalic && !disablebold) font = &dc.bfont;
if (xloadfont(&dc.ifont, pattern)) + if (!disableitalic && disablebold) font = &dc.ifont;
die("can't open font %s\n", fontstr); frcflags = FRC_ITALICBOLD;
} else if (mode & ATTR_ITALIC) {
FcPatternDel(pattern, FC_WEIGHT); - font = &dc.ifont;
- FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); + if (!disableitalic) font = &dc.ifont;
+ if (!disablebold) frcflags = FRC_ITALIC;
+ FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); } else if (mode & ATTR_BOLD) {
if (xloadfont(&dc.ibfont, pattern)) - font = &dc.bfont;
die("can't open font %s\n", fontstr); + if (!disablebold) font = &dc.bfont;
frcflags = FRC_BOLD;
FcPatternDel(pattern, FC_SLANT); }
- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); yp = winy + font->ascent;
+ if (!disableroman)
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
if (xloadfont(&dc.bfont, pattern))
die("can't open font %s\n", fontstr);