summaryrefslogtreecommitdiff
path: root/st/x.c
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2024-06-05 15:29:47 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2024-06-05 15:29:47 +0900
commitfeea909d13ddd60627a1293bc88043704ce91223 (patch)
tree263fd8cd67400da92c3a7c1663a317207e25c608 /st/x.c
parent5346d88ee42d4e2d15050a22f6f5ea0ade9e9eb5 (diff)
Init
Diffstat (limited to 'st/x.c')
-rw-r--r--st/x.c25
1 files changed, 18 insertions, 7 deletions
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;