From 6b03740a8c9fb98b788549412f0ebf3cbae1d2de Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 13 Nov 2026 16:39:50 +0100 Subject: feat(tablet): clock fonts and sizes from keystone's Fonts page The dim cover's time and date fonts move out of [tablet] clock_font and clock_font_date into keystone's fonts.json: "family" deckit-clock and deckit-date, each served at /fonts/, and the "override" sizes deckit:clock and deckit:date (else deck.css's 8rem and 1.6rem). The date can now have a font of its own. theme.css carries the rules, so a save on the Fonts page reaches an open tablet page within 5s, with no restart and no flags in the tablet state. Co-Authored-By: Claude Opus 5.5 --- deckit/server.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'deckit/server.py') diff --git a/deckit/server.py b/deckit/server.py index 2ced8dd..bd46446 100644 --- a/deckit/server.py +++ b/deckit/server.py @@ -142,10 +142,11 @@ def nerd_font(): return _font["p"] -def clock_font(): - """[tablet] clock_font's file, for the dim cover's clock; None when unset - or not installed (fc-match falls back to any font, so the family must match).""" - family = CFG.get("tablet", {}).get("clock_font", "") +def clock_font(key): + """The file of a clock font keystone's fonts.json names (theme.CLOCK_FONTS); + None when unset or not installed (fc-match falls back to any font, so the + family must match).""" + family = theme.families().get(key, "") if not family: return None out = _run(["fc-match", "-f", "%{family}\n%{file}", family]) @@ -219,8 +220,8 @@ class Handler(BaseHTTPRequestHandler): if path == "/fonts/nerd.ttf": f = nerd_font() return self._send(200, f.read_bytes(), "font/ttf", cache=True) if f else self._send(404) - if path == "/fonts/clock": - f = clock_font() + if path.startswith("/fonts/") and path[len("/fonts/"):] in theme.CLOCK_FONTS: + f = clock_font(path[len("/fonts/"):]) return self._send(200, f.read_bytes(), mimetypes.guess_type(f)[0] or "font/ttf") if f else self._send(404) if path.startswith("/api/"): if not self._authed(): -- cgit v1.2.3