diff options
| author | ProsperousPotato <114923153+ProsperousPotato@users.noreply.github.com> | 2024-10-16 23:31:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-16 23:31:02 +0100 |
| commit | f3e543b2279cdb93b84a8ed316199ae41ac3bd25 (patch) | |
| tree | ca91ba16d8afe2ddaf98f6463953cfeaf02750b9 | |
| parent | de93953077cd0aeb52107c51e12f519a62a31130 (diff) | |
disable italics, bold and roman fonts
| -rw-r--r-- | config.h | 3 | ||||
| -rw-r--r-- | disablebold.diff | 69 | ||||
| -rw-r--r-- | st | bin | 124592 -> 124704 bytes | |||
| -rw-r--r-- | x.c | 14 | ||||
| -rw-r--r-- | x.o | bin | 88952 -> 89272 bytes |
5 files changed, 83 insertions, 3 deletions
@@ -9,6 +9,9 @@ static char *font = "cozette:pixelsize=12:antialias=true:autohint=true"; static char *font2[] = { "cozette:pixelsize=12:antialias=true:autohint=true" }; static int borderpx = 0; +int disablebold = 1; +int disableitalic = 1; +int disableroman = 1; /* * What program is execed by st depends of these precedence rules: * 1: program passed with -e diff --git a/disablebold.diff b/disablebold.diff new file mode 100644 index 0000000..6083276 --- /dev/null +++ b/disablebold.diff @@ -0,0 +1,69 @@ +From 1e932656e6ca3a50ec67cafabdb08d711635c504 Mon Sep 17 00:00:00 2001 +From: Alex Kozadaev <snobb@gmx.com> +Date: Fri, 24 Mar 2017 12:11:47 +0000 +Subject: [PATCH] disable bold, italic and roman fonts globally + +--- + config.def.h | 6 ++++++ + x.c | 14 +++++++++++--- + 2 files changed, 17 insertions(+), 3 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 877afab..87c4534 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -6,6 +6,12 @@ + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ + 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; ++ + int borderpx = 2; + + /* +diff --git a/x.c b/x.c +index 743b084..23e4f0a 100644 +--- a/x.c ++++ b/x.c +@@ -158,6 +158,11 @@ typedef struct { + static Fontcache frc[16]; + static int frclen = 0; + ++/* declared in config.h */ ++extern int disablebold; ++extern int disableitalic; ++extern int disableroman; ++ + void + getbuttoninfo(XEvent *e) + { +@@ -828,17 +833,20 @@ xloadfonts(char *fontstr, double fontsize) + win.ch = ceilf(dc.font.height * chscale); + + FcPatternDel(pattern, FC_SLANT); +- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); ++ if (!disableitalic) ++ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); + if (xloadfont(&dc.ifont, pattern)) + die("st: can't open font %s\n", fontstr); + + FcPatternDel(pattern, FC_WEIGHT); +- FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); ++ if (!disablebold) ++ FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); + if (xloadfont(&dc.ibfont, pattern)) + die("st: can't open font %s\n", fontstr); + + FcPatternDel(pattern, FC_SLANT); +- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); ++ if (!disableroman) ++ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); + if (xloadfont(&dc.bfont, pattern)) + die("st: can't open font %s\n", fontstr); + +-- +2.1.4 Binary files differ@@ -278,6 +278,11 @@ static int focused = 0; static int oldbutton = 3; /* button event on startup: 3 = release */ static uint buttons; /* bit field of pressed buttons */ +/* declared in config.h */ +extern int disablebold; +extern int disableitalic; +extern int disableroman; + void clipcopy(const Arg *dummy) { @@ -1082,17 +1087,20 @@ xloadfonts(const char *fontstr, double fontsize) win.ch = ceilf(dc.font.height * chscale); FcPatternDel(pattern, FC_SLANT); - FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); + if (!disableitalic) + FcPatternAddInteger(pattern, FC_SLANT, FRC_ITALIC); if (xloadfont(&dc.ifont, pattern)) die("can't open font %s\n", fontstr); FcPatternDel(pattern, FC_WEIGHT); - FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); + if (!disablebold) + FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); if (xloadfont(&dc.ibfont, pattern)) die("can't open font %s\n", fontstr); FcPatternDel(pattern, FC_SLANT); - FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); + if (!disableroman) + FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); if (xloadfont(&dc.bfont, pattern)) die("can't open font %s\n", fontstr); |
