commit 3c6a02be72f8aa8f57053b888cebb04eb2e14dcb
parent dc189550cc5bd9b46df02d765c2ac928401e0397
Author: Natasha Kerensikova <natacha@instinctive.eu>
Date: Sun, 2 Mar 2025 09:24:37 +0100
[nat] Run-time option to set bounding-box multipliers
Diffstat:
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -32,8 +32,8 @@ char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
char *vtiden = "\033[?6c";
/* Kerning / character bounding-box multipliers */
-static float cwscale = 1.0;
-static float chscale = 1.0;
+float cwscale = 1.0;
+float chscale = 1.0;
/*
* word delimiter string
diff --git a/x.c b/x.c
@@ -257,6 +257,7 @@ static char *opt_font = NULL;
static char *opt_io = NULL;
static char *opt_line = NULL;
static char *opt_name = NULL;
+static char *opt_scale = NULL;
static char *opt_title = NULL;
static uint buttons; /* bit field of pressed buttons */
@@ -2205,6 +2206,7 @@ updatescheme(void)
int
main(int argc, char *argv[])
{
+ char *endptr;
xw.l = xw.t = 0;
xw.isfixed = False;
xsetcursor(cursorshape);
@@ -2239,6 +2241,17 @@ main(int argc, char *argv[])
case 'n':
opt_name = EARGF(usage());
break;
+ case 's':
+ opt_scale = EARGF(usage());
+ cwscale = strtof(opt_scale, &endptr);
+ if (endptr && endptr[0] && endptr[1]) {
+ chscale = strtof(endptr + 1,&endptr);
+ if (endptr && endptr[0]) {
+ usage();
+ abort();
+ }
+ }
+ break;
case 't':
case 'T':
opt_title = EARGF(usage());