From c074a085cca9d97d9b4eb18f21004fb41f7857f6 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 16 Nov 2026 18:44:24 +0100 Subject: fix(ui): serve the Propo Nerd Font so icons centre The plain Inconsolata Nerd Font gives each icon a 500 unit advance while its ink is up to twice that wide, so every Nerd Font button sat right of centre. The Propo variant's advance is the ink, so centring works for all of them; the VM power button's padding workaround goes. The URL becomes /fonts/nerd-propo.ttf because the font is cached for a day. Co-Authored-By: Claude Opus 5.5 --- deckit/server.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'deckit/server.py') diff --git a/deckit/server.py b/deckit/server.py index bd46446..8f6a39f 100644 --- a/deckit/server.py +++ b/deckit/server.py @@ -131,9 +131,11 @@ _font = {} def nerd_font(): - """The Nerd Font the canvas draws its icons with, for the tablet.""" + """The Nerd Font the canvas draws its icons with, for the tablet. Propo: + each icon's advance is its ink, so a centred glyph is centred (the plain + variant's icons overflow their advance to the right).""" if "p" not in _font: - out = _run(["fc-match", "-f", "%{file}", "Inconsolata Nerd Font:style=Regular"]) + out = _run(["fc-match", "-f", "%{file}", "Inconsolata Nerd Font Propo:style=Regular"]) # fc-match falls back to any font; only a Nerd Font has the glyphs. found = "NerdFont" in out.replace(" ", "") and Path(out).is_file() if not found: @@ -217,7 +219,7 @@ class Handler(BaseHTTPRequestHandler): name = path[len("/icons/"):].removesuffix(".svg") icon = icon_path(name) return self._send(200, icon.read_bytes(), "image/svg+xml") if icon else self._send(404) - if path == "/fonts/nerd.ttf": + if path == "/fonts/nerd-propo.ttf": f = nerd_font() return self._send(200, f.read_bytes(), "font/ttf", cache=True) if f else self._send(404) if path.startswith("/fonts/") and path[len("/fonts/"):] in theme.CLOCK_FONTS: -- cgit v1.2.3