From 1b60f12d71688ec4b0c1429d6c6283cb0f6335ac Mon Sep 17 00:00:00 2001 From: katalx Date: Thu, 29 Jan 2026 02:16:39 -0500 Subject: fall back to fixed font if no new century schoolbook --- ui.c | 8 ++++---- 1 file 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 { -- cgit v1.2.3