summaryrefslogtreecommitdiff
path: root/x11-terms/st/files/03_cyclefonts.diff
diff options
context:
space:
mode:
Diffstat (limited to 'x11-terms/st/files/03_cyclefonts.diff')
-rw-r--r--x11-terms/st/files/03_cyclefonts.diff77
1 files changed, 77 insertions, 0 deletions
diff --git a/x11-terms/st/files/03_cyclefonts.diff b/x11-terms/st/files/03_cyclefonts.diff
new file mode 100644
index 0000000..ef92feb
--- /dev/null
+++ b/x11-terms/st/files/03_cyclefonts.diff
@@ -0,0 +1,77 @@
+diff --git c/config.def.h i/config.def.h
+index 851066f..7ca1274 100644
+--- c/config.def.h
++++ i/config.def.h
+@@ -5,7 +5,11 @@
+ *
+ * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
+ */
+-static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
++static char *fonts[] = {
++ "Liberation Mono:pixelsize=12:antialias=true:autohint=true",
++ "Gohu GohuFont:pixelsize=11:antialias=false:autohint=false",
++};
++static size_t currentfont = 0;
+
+ /* disable bold, italic and roman fonts globally */
+ int disablebold = 1;
+@@ -207,6 +211,7 @@ static Shortcut shortcuts[] = {
+ { TERMMOD, XK_Y, selpaste, {.i = 0} },
+ { ShiftMask, XK_Insert, selpaste, {.i = 0} },
+ { TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
++ { TERMMOD, XK_End, cyclefonts, {} },
+ };
+
+ /*
+diff --git c/x.c i/x.c
+index dcc3930..a306253 100644
+--- c/x.c
++++ i/x.c
+@@ -59,6 +59,7 @@ static void zoom(const Arg *);
+ static void zoomabs(const Arg *);
+ static void zoomreset(const Arg *);
+ static void ttysend(const Arg *);
++static void cyclefonts(const Arg *);
+
+ /* config.h for applying patches and the configuration. */
+ #include "config.h"
+@@ -320,11 +321,7 @@ void
+ zoomreset(const Arg *arg)
+ {
+ Arg larg;
+-
+- if (defaultfontsize > 0) {
+- larg.f = defaultfontsize;
+- zoomabs(&larg);
+- }
++ zoomabs(&larg);
+ }
+
+ void
+@@ -333,6 +330,17 @@ ttysend(const Arg *arg)
+ ttywrite(arg->s, strlen(arg->s), 1);
+ }
+
++void
++cyclefonts(const Arg *arg)
++{
++ currentfont++;
++ currentfont %= (sizeof fonts / sizeof fonts[0]);
++ usedfont = fonts[currentfont];
++ Arg larg;
++ larg.f = usedfontsize;
++ zoomabs(&larg);
++}
++
+ int
+ evcol(XEvent *e)
+ {
+@@ -1152,7 +1160,7 @@ xinit(int cols, int rows)
+ if (!FcInit())
+ die("could not init fontconfig.\n");
+
+- usedfont = (opt_font == NULL)? font : opt_font;
++ usedfont = (opt_font == NULL)? fonts[currentfont] : opt_font;
+ xloadfonts(usedfont, 0);
+
+ /* colors */