From 066416f76425a2784ef880826f47ad7b5fac7d43 Mon Sep 17 00:00:00 2001 From: Nikita Langer Date: Sun, 31 May 2026 15:33:29 +0200 Subject: Cycle Fonts --- x.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'x.c') diff --git a/x.c b/x.c index 57ca715..8ff82cf 100644 --- a/x.c +++ b/x.c @@ -60,6 +60,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" @@ -337,11 +338,7 @@ void zoomreset(const Arg *arg) { Arg larg; - - if (defaultfontsize > 0) { - larg.f = defaultfontsize; - zoomabs(&larg); - } + zoomabs(&larg); } void @@ -350,6 +347,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) { @@ -1299,7 +1307,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 */ -- cgit