ref: ef360350a062aae1393f099bca3fb47de4507aac
parent: 56b9abdd00f436aef9a821ad9d824c92d338e52d
author: mischief <mischief@offblast.org>
date: Fri Oct 12 04:31:05 EDT 2018
truetypefs: use /lib/font/ttf as default font path
--- a/sys/src/cmd/truetypefs.c
+++ b/sys/src/cmd/truetypefs.c
@@ -9,6 +9,8 @@
static char Egreg[] = "my memory of truetype is fading";
static char Enoent[] = "not found";
+static char *fontpath = "/lib/font/ttf";
+
enum { MAXSUB = 0x100 };typedef struct TFont TFont;
@@ -219,7 +221,11 @@
goto inval;
buf = estrdup9p(name);
buf[d - name] = 0;
- ttf = ttfopen(buf, sz, 0);
+ p = smprint("%s/%s", fontpath, buf);+ if(p == nil)
+ sysfatal("smprint: %r");+ ttf = ttfopen(p, sz, 0);
+ free(p);
if(ttf == nil){free(buf);
return nil;
@@ -420,12 +426,22 @@
.destroyfid = fsdestroyfid,
};
+static void
+usage(void)
+{+ fprint(2, "usage: %s [-F fontpath]\n", argv0);
+ exits("usage");+}
+
void
main(int argc, char **argv)
{ ARGBEGIN {+ case 'F':
+ fontpath = EARGF(usage());
+ break;
default:
- sysfatal("usage");+ usage();
} ARGEND;
unmount(nil, "/n/ttf");
--
⑨