patch: defaultfontsize

This commit is contained in:
frosty 2024-08-19 22:49:20 +00:00
parent af9766d76b
commit 55b3a5eb32
2 changed files with 15 additions and 1 deletions

8
st.1
View file

@ -22,6 +22,8 @@ st \- simple terminal
.IR line ] .IR line ]
.RB [ \-w .RB [ \-w
.IR windowid ] .IR windowid ]
.RB [ \-z
.IR fontsize ]
.RB [[ \-e ] .RB [[ \-e ]
.IR command .IR command
.RI [ arguments ...]] .RI [ arguments ...]]
@ -44,6 +46,8 @@ st \- simple terminal
.IR title ] .IR title ]
.RB [ \-w .RB [ \-w
.IR windowid ] .IR windowid ]
.RB [ \-z
.IR fontsize ]
.RB \-l .RB \-l
.IR line .IR line
.RI [ stty_args ...] .RI [ stty_args ...]
@ -91,6 +95,10 @@ defines the window title (default 'st').
embeds st within the window identified by embeds st within the window identified by
.I windowid .I windowid
.TP .TP
.BI \-z " fontsize"
sets the default fontsize to
.I fontsize
.TP
.BI \-l " line" .BI \-l " line"
use a tty use a tty
.I line .I line

8
x.c
View file

@ -4,6 +4,7 @@
#include <limits.h> #include <limits.h>
#include <locale.h> #include <locale.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#include <sys/select.h> #include <sys/select.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
@ -1168,7 +1169,7 @@ xinit(int cols, int rows)
die("could not init fontconfig.\n"); die("could not init fontconfig.\n");
usedfont = (opt_font == NULL)? font : opt_font; usedfont = (opt_font == NULL)? font : opt_font;
xloadfonts(usedfont, 0); xloadfonts(usedfont, defaultfontsize);
/* colors */ /* colors */
xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None); xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
@ -2116,6 +2117,11 @@ main(int argc, char *argv[])
case 'v': case 'v':
die("%s " VERSION "\n", argv0); die("%s " VERSION "\n", argv0);
break; break;
case 'z':
defaultfontsize = strtod(EARGF(usage()), NULL);
if (!(defaultfontsize > 0))
usage();
break;
default: default:
usage(); usage();
} ARGEND; } ARGEND;