summaryrefslogtreecommitdiff
path: root/ui.c
diff options
context:
space:
mode:
authorkatalx2026-01-29 02:16:39 -0500
committerkatalx2026-01-29 02:16:39 -0500
commit1b60f12d71688ec4b0c1429d6c6283cb0f6335ac (patch)
tree9966b5b5ace92ac678e2a20499526e1be4bd1e7c /ui.c
parent75bfbc2605c794c25045755b06f10efc1ea219c1 (diff)
fall back to fixed font if no new century schoolbook
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ui.c b/ui.c
index bb4b4aa..f518c89 100644
--- a/ui.c
+++ b/ui.c
@@ -20,8 +20,6 @@ static Atom wm_delete_window;
static XFontStruct *freg, *fital;
-/* TODO: center menu on screen */
-
void
ui_init(int argc, char **argv, UiOpts opt)
{
@@ -64,6 +62,9 @@ ui_init(int argc, char **argv, UiOpts opt)
freg = XLoadQueryFont(dsp, "-*-new century schoolbook-medium-r-*-*-24-*-*-*-*-*-*-*");
fital = XLoadQueryFont(dsp, "-*-new century schoolbook-medium-i-*-*-24-*-*-*-*-*-*-*");
+ if (!freg) freg = XLoadQueryFont(dsp, "fixed");
+ if (!fital) fital = XLoadQueryFont(dsp, "fixed");
+
int w = 0;
for (int i = 0; i < opt.n; i++) {
int ow = XTextWidth(freg, opt.v[i].s, opt.v[i].n);
@@ -177,8 +178,7 @@ ui_draw(Str input, int inpi, int seli, UiOpts o)
12, y - freg->ascent,
w + 8, freg->descent + freg->ascent);
XSetForeground(dsp, gc, bg);
- XDrawString(dsp, win, gc,
- 16, y,
+ XDrawString(dsp, win, gc, 16, y,
o.v[i].s, o.v[i].n);
XSetForeground(dsp, gc, fg);
} else {