diff options
| author | Lukasz Kasprzak <lukasz@arcofasiagroup.com> | 2026-08-21 10:09:04 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukasz@arcofasiagroup.com> | 2026-08-21 10:09:04 +0200 |
| commit | 31db51d7fb782c8e79bf1df067dadc1a8be63255 (patch) | |
| tree | 04c0cc05700c7cc1a898fe724b89acfa5e2aa843 /colitur-mu.c | |
| parent | 5312537c9fc12eed4d14d89d9cc1a226f2df94c3 (diff) | |
| download | colitur-x-31db51d7fb782c8e79bf1df067dadc1a8be63255.tar.gz colitur-x-31db51d7fb782c8e79bf1df067dadc1a8be63255.zip | |
config: Terminus by default, and stop hiding knobs in the source
config.h now carries everything a reader would reasonably want to change:
both fonts, the liturgical palette and the fallback for an unlisted
colour, the selection rings, geometry, weekday headings, the detail-pane
labels, the window title, and which rank earns a badge and what it says.
Several of those were literals buried in colitur-x.c.
Default font is Terminus:pixelsize=20:antialias=false, matching st.
Terminus is a bitmap face, so it exists only at fixed pixelsizes -- the
list is in the comment, because asking for one it lacks silently gets a
substitute rather than an error.
Layout metrics now come from the font instead of magic numbers: line
height and the badge from XftFont ascent/descent in colitur-x, column
widths in characters rather than pixels in colitur-mu. Before this,
changing the font size left a 13px line height and a 110px date column
that quietly truncated their contents.
Diffstat (limited to 'colitur-mu.c')
| -rw-r--r-- | colitur-mu.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/colitur-mu.c b/colitur-mu.c index d76152d..1907274 100644 --- a/colitur-mu.c +++ b/colitur-mu.c @@ -95,12 +95,17 @@ static void reload(void) result looks like a layout bug rather than a height bug. */ static void frame(mu_Context *ctx, int W, int H) { - enum { RH = 24 }; + /* Column widths in CHARACTERS, not pixels. Hardcoded pixel widths are + silently wrong the moment config.h names a different font size: at + Terminus 20 a 110px "date" column truncates an ISO date. Row height + likewise follows the font. */ + int ch = mux_text_width(NULL, "0", 1); + int RH = mux_text_height(NULL) + 10; if (!mu_begin_window_ex(ctx, "colitur", mu_rect(0, 0, W, H), MU_OPT_NOTITLE | MU_OPT_NORESIZE | MU_OPT_NOCLOSE)) return; - int wy[] = { 120, 40, 40, 90, -1 }; + int wy[] = { 11*ch, 3*ch, 3*ch, 7*ch, -1 }; mu_layout_row(ctx, 5, wy, RH); mu_label(ctx, "Year"); if (mu_button(ctx, "-")) { year--; reload(); } @@ -109,7 +114,7 @@ static void frame(mu_Context *ctx, int W, int H) mu_label(ctx, y); mu_label(ctx, ""); - int w4[] = { 120, 90, 90, -1 }; + int w4[] = { 11*ch, 9*ch, 9*ch, -1 }; struct { const char *cap; const char **opts; int *idx; } sets[] = { { "Language", langs, &lang_i }, { "Book names", books, &book_i }, @@ -133,13 +138,13 @@ static void frame(mu_Context *ctx, int W, int H) mu_layout_row(ctx, 1, w1, RH); mu_label(ctx, status); - int listh = H - 7 * RH - 90; + int listh = H - 7 * RH - 4 * RH; if (listh < 100) listh = 100; mu_layout_row(ctx, 1, w1, listh); mu_begin_panel(ctx, "days"); - int wrow[] = { 110, 100, 330, -1 }; + int wrow[] = { 11*ch, 11*ch, 34*ch, -1 }; for (int i = 0; i < nrows; i++) { - mu_layout_row(ctx, 4, wrow, 22); + mu_layout_row(ctx, 4, wrow, RH - 2); if (mu_button(ctx, rows[i].f[0])) sel = i; mu_label(ctx, rows[i].f[9]); mu_label(ctx, rows[i].f[6]); |
