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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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 */
|