commit 18761f8

hovercats  ·  2024-08-14 22:18:06 +0000 UTC
parent 450167f
st: remove font2 patch
6 files changed,  +36, -175
+2, -2
1@@ -1,6 +1,6 @@
2 5f42aca0fbf4d8014cd36075a853c37318b2f75aee3b8bc0992b51bead96631532
3-a79d4baca110087248fc79928a7d5c6deedf6a3ce64d96e4c5769628b128f7e101
4-039cd65296f78888998e73b9e5b7ad37fac6844fd9d51daa33faddf0376da7bbca
5+0f827f70840df96a2cbc8d35ba3ddb66451756ed7c71a68232441cdfe0789131a1
6+6979175a17b8db2ee7b8435119c9cd2a1da34dc3ec1ae67a3b04bd34092619a30e
7 e6d59e013c60877e06fbffc01d18df0798169698be007b889ee70d6b297af5a85a
8 ab5bb6c9c98845c06af71e119c14bc6763d7675a4af4a5721b5d1255b33c99249e
9 d4146c590ee3440c9c36a68d98d49bc2e9edeaeba4c72609b5e2063b9504ae7703
+0, -164
  1@@ -1,164 +0,0 @@
  2-From b9434fb961cf2f26a774e982072b9f99afb8324f Mon Sep 17 00:00:00 2001
  3-From: hovercats <hovercatswithlasereyes@protonmail.com>
  4-Date: Mon, 28 Aug 2023 21:44:09 +0000
  5-Subject: [PATCH 1/5] apply font2 patch
  6-
  7----
  8- config.def.h |   7 +++-
  9- x.c          | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++
 10- 2 files changed, 107 insertions(+), 1 deletion(-)
 11-
 12-diff --git a/config.def.h b/config.def.h
 13-index 91ab8ca..6129b7a 100644
 14---- a/config.def.h
 15-+++ b/config.def.h
 16-@@ -5,7 +5,12 @@
 17-  *
 18-  * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
 19-  */
 20--static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
 21-+static char *font = "Tamzen:pixelsize=14:antialias=true:autohint=true";
 22-+/* Spare fonts */
 23-+static char *font2[] = {
 24-+"Liberation Mono:pixelsize=12:antialias=true:autohint=true",
 25-+};
 26-+
 27- static int borderpx = 2;
 28- 
 29- /*
 30-diff --git a/x.c b/x.c
 31-index 2a3bd38..24db59d 100644
 32---- a/x.c
 33-+++ b/x.c
 34-@@ -157,6 +157,8 @@ static void xhints(void);
 35- static int xloadcolor(int, const char *, Color *);
 36- static int xloadfont(Font *, FcPattern *);
 37- static void xloadfonts(const char *, double);
 38-+static int xloadsparefont(FcPattern *, int);
 39-+static void xloadsparefonts(void);
 40- static void xunloadfont(Font *);
 41- static void xunloadfonts(void);
 42- static void xsetenv(void);
 43-@@ -306,6 +308,7 @@ zoomabs(const Arg *arg)
 44- {
 45- 	xunloadfonts();
 46- 	xloadfonts(usedfont, arg->f);
 47-+	xloadsparefonts();
 48- 	cresize(0, 0);
 49- 	redraw();
 50- 	xhints();
 51-@@ -1050,6 +1053,101 @@ xloadfonts(const char *fontstr, double fontsize)
 52- 	FcPatternDestroy(pattern);
 53- }
 54- 
 55-+int
 56-+xloadsparefont(FcPattern *pattern, int flags)
 57-+{
 58-+	FcPattern *match;
 59-+	FcResult result;
 60-+	
 61-+	match = FcFontMatch(NULL, pattern, &result);
 62-+	if (!match) {
 63-+		return 1;
 64-+	}
 65-+
 66-+	if (!(frc[frclen].font = XftFontOpenPattern(xw.dpy, match))) {
 67-+		FcPatternDestroy(match);
 68-+		return 1;
 69-+	}
 70-+
 71-+	frc[frclen].flags = flags;
 72-+	/* Believe U+0000 glyph will present in each default font */
 73-+	frc[frclen].unicodep = 0;
 74-+	frclen++;
 75-+
 76-+	return 0;
 77-+}
 78-+
 79-+void
 80-+xloadsparefonts(void)
 81-+{
 82-+	FcPattern *pattern;
 83-+	double sizeshift, fontval;
 84-+	int fc;
 85-+	char **fp;
 86-+
 87-+	if (frclen != 0)
 88-+		die("can't embed spare fonts. cache isn't empty");
 89-+
 90-+	/* Calculate count of spare fonts */
 91-+	fc = sizeof(font2) / sizeof(*font2);
 92-+	if (fc == 0)
 93-+		return;
 94-+
 95-+	/* Allocate memory for cache entries. */
 96-+	if (frccap < 4 * fc) {
 97-+		frccap += 4 * fc - frccap;
 98-+		frc = xrealloc(frc, frccap * sizeof(Fontcache));
 99-+	}
100-+
101-+	for (fp = font2; fp - font2 < fc; ++fp) {
102-+	
103-+		if (**fp == '-')
104-+			pattern = XftXlfdParse(*fp, False, False);
105-+		else
106-+			pattern = FcNameParse((FcChar8 *)*fp);
107-+	
108-+		if (!pattern)
109-+			die("can't open spare font %s\n", *fp);
110-+	   		
111-+		if (defaultfontsize > 0) {
112-+			sizeshift = usedfontsize - defaultfontsize;
113-+			if (sizeshift != 0 &&
114-+					FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) ==
115-+					FcResultMatch) {	
116-+				fontval += sizeshift;
117-+				FcPatternDel(pattern, FC_PIXEL_SIZE);
118-+				FcPatternDel(pattern, FC_SIZE);
119-+				FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontval);
120-+			}
121-+		}
122-+	
123-+		FcPatternAddBool(pattern, FC_SCALABLE, 1);
124-+	
125-+		FcConfigSubstitute(NULL, pattern, FcMatchPattern);
126-+		XftDefaultSubstitute(xw.dpy, xw.scr, pattern);
127-+	
128-+		if (xloadsparefont(pattern, FRC_NORMAL))
129-+			die("can't open spare font %s\n", *fp);
130-+	
131-+		FcPatternDel(pattern, FC_SLANT);
132-+		FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
133-+		if (xloadsparefont(pattern, FRC_ITALIC))
134-+			die("can't open spare font %s\n", *fp);
135-+			
136-+		FcPatternDel(pattern, FC_WEIGHT);
137-+		FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
138-+		if (xloadsparefont(pattern, FRC_ITALICBOLD))
139-+			die("can't open spare font %s\n", *fp);
140-+	
141-+		FcPatternDel(pattern, FC_SLANT);
142-+		FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
143-+		if (xloadsparefont(pattern, FRC_BOLD))
144-+			die("can't open spare font %s\n", *fp);
145-+	
146-+		FcPatternDestroy(pattern);
147-+	}
148-+}
149-+
150- void
151- xunloadfont(Font *f)
152- {
153-@@ -1147,6 +1245,9 @@ xinit(int cols, int rows)
154- 	usedfont = (opt_font == NULL)? font : opt_font;
155- 	xloadfonts(usedfont, 0);
156- 
157-+	/* spare fonts */
158-+	xloadsparefonts();
159-+
160- 	/* colors */
161- 	xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
162- 	xloadcols();
163--- 
164-2.42.0
165-
+25, -0
 1@@ -0,0 +1,25 @@
 2+From 81bee8a1eb4bbaf1f515f386156b1a8a318dba16 Mon Sep 17 00:00:00 2001
 3+From: hovercats <hovercatswithlasereyes@protonmail.com>
 4+Date: Thu, 15 Aug 2024 00:13:03 +0200
 5+Subject: [PATCH 1/5] set tamzen as default font
 6+
 7+---
 8+ config.def.h | 2 +-
 9+ 1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+diff --git a/config.def.h b/config.def.h
12+index 2cd740a..89fb5d1 100644
13+--- a/config.def.h
14++++ b/config.def.h
15+@@ -5,7 +5,7 @@
16+  *
17+  * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
18+  */
19+-static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
20++static char *font = "Tamzen:pixelsize=14:antialias=true:autohint=true";
21+ static int borderpx = 2;
22+ 
23+ /*
24+-- 
25+2.45.1
26+
+7, -7
 1@@ -1,4 +1,4 @@
 2-From b4883c0ee8d8d942aabfb05784175f493c1275ae Mon Sep 17 00:00:00 2001
 3+From 666e445330cd1183beca770a691f94bed0651e8e Mon Sep 17 00:00:00 2001
 4 From: hovercats <hovercatswithlasereyes@protonmail.com>
 5 Date: Mon, 28 Aug 2023 21:44:42 +0000
 6 Subject: [PATCH 2/5] set borderpx to 5
 7@@ -8,18 +8,18 @@ Subject: [PATCH 2/5] set borderpx to 5
 8  1 file changed, 1 insertion(+), 1 deletion(-)
 9 
10 diff --git a/config.def.h b/config.def.h
11-index 6129b7a..56061ca 100644
12+index 89fb5d1..d676f03 100644
13 --- a/config.def.h
14 +++ b/config.def.h
15-@@ -11,7 +11,7 @@ static char *font2[] = {
16- "Liberation Mono:pixelsize=12:antialias=true:autohint=true",
17- };
18- 
19+@@ -6,7 +6,7 @@
20+  * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
21+  */
22+ static char *font = "Tamzen:pixelsize=14:antialias=true:autohint=true";
23 -static int borderpx = 2;
24 +static int borderpx = 5;
25  
26  /*
27   * What program is execed by st depends of these precedence rules:
28 -- 
29-2.42.0
30+2.45.1
31 
+1, -1
1@@ -1,5 +1,5 @@
2 https://dl.suckless.org/st/st-0.9.2.tar.gz
3-patches/0001-apply-font2-patch.patch
4+patches/0001-set-tamzen-as-default-font.patch
5 patches/0002-set-borderpx-to-5.patch
6 patches/0003-set-default-cursor-to-_.patch
7 patches/0004-switch-keybindings-for-zoom-and-copy-paste.patch
+1, -1
1@@ -1 +1 @@
2-0.9.2 1
3+0.9.2 2