summaryrefslogtreecommitdiff
path: root/st
diff options
context:
space:
mode:
Diffstat (limited to 'st')
-rw-r--r--st/config.h20
-rwxr-xr-xst/stbin124592 -> 124728 bytes
-rw-r--r--st/x.c25
3 files changed, 34 insertions, 11 deletions
diff --git a/st/config.h b/st/config.h
index 2b40a9f..0555fbc 100644
--- a/st/config.h
+++ b/st/config.h
@@ -5,8 +5,14 @@
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
-static char *font = "mono:pixelsize=16:antialias=true:autohint=true";
+static char *fonts[] = {
+ "mono:pixelsize=16:antialias=true:autohint=true",
+ "FiraCode Nerd Font Mono:pixelsize=16:antialias=ture:autohint=true",
+ "Hack Nerd Font Mono:pixelsize=16:antialias=ture:autohint=true",
+};
+static size_t currentfont = 0;
static char *font2[] = { "NotoColorEmoji:pixelsize=10:antialias=true:autohint=true" };
+
static int borderpx = 2;
/*
@@ -30,6 +36,10 @@ char *vtiden = "\033[?6c";
static float cwscale = 1.0;
static float chscale = 1.0;
+/* Character rendering offsets in pixels */
+static short cxoffset = 0;
+static short cyoffset = 0;
+
/*
* word delimiter string
*
@@ -187,7 +197,7 @@ static uint forcemousemod = ShiftMask;
* Xresources preferences to load at startup
*/
ResourcePref resources[] = {
- { "font", STRING, &font },
+ { "fonts", STRING, &fonts },
{ "fontalt0", STRING, &font2[0] },
{ "color0", STRING, &colorname[0] },
{ "color1", STRING, &colorname[1] },
@@ -259,7 +269,7 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_K, zoom, { .f = +1 } },
{ TERMMOD, XK_D, zoom, { .f = -2 } },
{ TERMMOD, XK_U, zoom, { .f = +2 } },
- { TERMMOD, XK_parenright, zoomreset, { .f = 0 } },
+ { TERMMOD, XK_plus, zoomreset, { .f = 0 } },
// COPIES
{ MODKEY, XK_y, clipcopy, { .i = 0 } },
@@ -267,6 +277,9 @@ static Shortcut shortcuts[] = {
{ MODKEY, XK_c, externalpipe, { .v = copyurlcmd } },
{ MODKEY, XK_o, externalpipe, { .v = copyoutput } },
+ // FONTS
+ { TERMMOD, XK_I, cyclefonts, {} },
+
// PASTES
{ MODKEY, XK_p, clippaste, { .i = 0 } },
{ TERMMOD, XK_P, clippaste, { .i = 0 } },
@@ -294,7 +307,6 @@ static Shortcut shortcuts[] = {
// EXTRAS
{ TERMMOD, XK_Num_Lock, numlock, { .i = 0 } },
{ XK_ANY_MOD, XK_Break, sendbreak, { .i = 0 } },
-
};
/*
diff --git a/st/st b/st/st
index f9e3a0d..24eb0c5 100755
--- a/st/st
+++ b/st/st
Binary files differ
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;