popup: use system fonts exclusively

This commit is contained in:
2026-08-14 15:17:00 +09:00
parent 54355b8190
commit 08369e718e
14 changed files with 34 additions and 116 deletions

View File

@@ -52,7 +52,6 @@ struct Test
char socket[384];
char addrfile[512];
char address[512];
char missing[384];
char addrcontents[2048];
size_t naddrcontents;
struct stat socketst;
@@ -170,9 +169,7 @@ setup(Test *t)
snprintf(t->home, sizeof t->home, "%s/home", t->root)
>= (int)sizeof t->home ||
snprintf(t->socket, sizeof t->socket, "%s/strans.sock", t->runtime)
>= (int)sizeof t->socket ||
snprintf(t->missing, sizeof t->missing, "%s/missing-font.ttf", t->root)
>= (int)sizeof t->missing)
>= (int)sizeof t->socket)
return fail("temporary path is too long");
if(!makedir(t->runtime) || !makedir(t->config) || !makedir(t->ibus) ||
!makedir(t->bus) || !makedir(t->home))
@@ -224,7 +221,7 @@ startchild(Test *t, char *program, char *mapdir, pid_t *child, int *errfd)
strerror(errno));
_exit(126);
}
execl(program, program, mapdir, t->missing, (char*)0);
execl(program, program, mapdir, (char*)0);
dprintf(STDERR_FILENO, "exec %s: %s\n", program, strerror(errno));
_exit(127);
}

View File

@@ -40,7 +40,6 @@ struct Test
char home[320];
char socket[384];
char badmap[320];
char missingfont[384];
char expected[768];
char err[4096];
size_t nerr;
@@ -156,8 +155,6 @@ setup(Test *t)
>= (int)sizeof t->socket ||
snprintf(t->badmap, sizeof t->badmap, "%s/missing-map", t->root)
>= (int)sizeof t->badmap ||
snprintf(t->missingfont, sizeof t->missingfont,
"%s/missing-font.ttf", t->root) >= (int)sizeof t->missingfont ||
snprintf(t->expected, sizeof t->expected,
"strans: can't open: %s/hira.map\n", t->badmap)
>= (int)sizeof t->expected)
@@ -213,7 +210,7 @@ startchild(Test *t, char *program)
strerror(errno));
_exit(126);
}
execl(program, program, t->badmap, t->missingfont, (char*)0);
execl(program, program, t->badmap, (char*)0);
dprintf(STDERR_FILENO, "exec %s: %s\n", program, strerror(errno));
_exit(127);
}

View File

@@ -67,7 +67,6 @@ struct Test
char bus[448];
char home[320];
char socket[384];
char missing[384];
char addrfile[512];
char addrbase[256];
char firstaddress[512];
@@ -221,9 +220,7 @@ setup(Test *t)
snprintf(t->home, sizeof t->home, "%s/home", t->root)
>= (int)sizeof t->home ||
snprintf(t->socket, sizeof t->socket, "%s/strans.sock", t->runtime)
>= (int)sizeof t->socket ||
snprintf(t->missing, sizeof t->missing, "%s/missing-font.ttf", t->root)
>= (int)sizeof t->missing)
>= (int)sizeof t->socket)
return fail("temporary path is too long");
if(!makedir(t->runtime) || !makedir(t->config) || !makedir(t->ibus) ||
!makedir(t->bus) || !makedir(t->home))
@@ -292,7 +289,7 @@ startchild(Test *t, char *program, char *mapdir, pid_t *child, int *errfd)
strerror(errno));
_exit(126);
}
execl(program, program, mapdir, t->missing, (char*)0);
execl(program, program, mapdir, (char*)0);
dprintf(STDERR_FILENO, "exec %s: %s\n", program, strerror(errno));
_exit(127);
}

View File

@@ -10,15 +10,6 @@ enum
};
static u32int guardcolor = 0x5a5a5a5a;
static char *testfonts[] = {
"/usr/share/fonts/noto/NotoColorEmoji.ttf",
"/usr/share/fonts/TTF/DejaVuSans.ttf",
"/usr/share/fonts/TTF/Jigmo.ttf",
"/usr/share/fonts/TTF/Jigmo2.ttf",
};
static char *missingfonts[] = {
"/strans-test-no-such-font",
};
static void
fillpixels(u32int *p, int n, u32int color)
@@ -195,14 +186,7 @@ font_render(struct ct *t)
buf = mem + Guard;
fillpixels(buf, Testn, Colbg);
a = mkstr("A");
CT_CHECK(t, !textinit(missingfonts, nelem(missingfonts)));
CT_EQ_INT(t, 0, textwidth(&a));
textdraw(buf, Testw, Testh, 0, 0, &a);
for(i = 0; i < Testn; i++)
CT_EQ_UINT(t, Colbg, buf[i]);
checkguards(t, mem);
if(!CT_CHECK(t, textinit(testfonts, nelem(testfonts)))){
if(!CT_CHECK(t, textinit())){
free(mem);
return;
}

View File

@@ -228,7 +228,6 @@ waitaddress(Daemon *d, int notifyfd)
static int
startdaemon(Daemon *d, char *program, char *mapdir)
{
char missing[384];
int fd, notifyfd, watch, errpipe[2];
long maxfd;
pid_t pid;
@@ -250,9 +249,7 @@ startdaemon(Daemon *d, char *program, char *mapdir)
snprintf(d->home, sizeof d->home, "%s/home", d->root)
>= (int)sizeof d->home ||
snprintf(d->socket, sizeof d->socket, "%s/strans.sock", d->runtime)
>= (int)sizeof d->socket ||
snprintf(missing, sizeof missing, "%s/missing-font.ttf", d->root)
>= (int)sizeof missing)
>= (int)sizeof d->socket)
return fail("temporary path is too long");
if(!makedir(d->runtime) || !makedir(d->config) || !makedir(d->ibus) ||
!makedir(d->bus) || !makedir(d->home))
@@ -299,7 +296,7 @@ startdaemon(Daemon *d, char *program, char *mapdir)
strerror(errno));
_exit(126);
}
execl(program, program, mapdir, missing, (char*)0);
execl(program, program, mapdir, (char*)0);
dprintf(STDERR_FILENO, "exec %s: %s\n", program, strerror(errno));
_exit(127);
}

View File

@@ -174,7 +174,6 @@ waitsocket(Daemon *d, int notifyfd)
static int
startdaemon(Daemon *d, char *program, char *mapdir)
{
char missing[384];
int fd, notifyfd, watch, errpipe[2];
long maxfd;
pid_t pid;
@@ -196,9 +195,7 @@ startdaemon(Daemon *d, char *program, char *mapdir)
snprintf(d->home, sizeof d->home, "%s/home", d->root)
>= (int)sizeof d->home ||
snprintf(d->socket, sizeof d->socket, "%s/strans.sock", d->runtime)
>= (int)sizeof d->socket ||
snprintf(missing, sizeof missing, "%s/no-such-font.ttf", d->root)
>= (int)sizeof missing)
>= (int)sizeof d->socket)
return fail("temporary path is too long");
if(!makedir(d->runtime) || !makedir(d->config) || !makedir(d->ibus) ||
!makedir(d->bus) || !makedir(d->home))
@@ -246,7 +243,7 @@ startdaemon(Daemon *d, char *program, char *mapdir)
strerror(errno));
_exit(126);
}
execl(program, program, mapdir, missing, (char*)0);
execl(program, program, mapdir, (char*)0);
dprintf(STDERR_FILENO, "exec %s: %s\n", program, strerror(errno));
_exit(127);
}