From feea909d13ddd60627a1293bc88043704ce91223 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:29:47 +0900 Subject: Init --- st/x.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'st/x.c') diff --git a/st/x.c b/st/x.c index e2ec9db..66b9a35 100644 --- a/st/x.c +++ b/st/x.c @@ -75,6 +75,8 @@ 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" @@ -353,10 +355,7 @@ zoomreset(const Arg *arg) { Arg larg; - if (defaultfontsize > 0) { - larg.f = defaultfontsize; - zoomabs(&larg); - } + zoomabs(&larg); } void @@ -365,6 +364,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) { @@ -1301,7 +1311,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); /* spare fonts */ @@ -1451,8 +1461,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x if (glyphidx) { specs[numspecs].font = font->match; specs[numspecs].glyph = glyphidx; - specs[numspecs].x = (short)xp; - specs[numspecs].y = (short)yp; + specs[numspecs].x = (short)xp + cxoffset; + specs[numspecs].y = (short)yp + cyoffset; + xp += runewidth; numspecs++; continue; -- cgit v1.2.3