diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-16 18:44:24 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-16 18:44:24 +0100 |
| commit | c074a085cca9d97d9b4eb18f21004fb41f7857f6 (patch) | |
| tree | ffb3a91c7efd8788f58b669991127e08b0e1c034 /deckit/server.py | |
| parent | 573ad65a8eee9173256c860f46204e584169c749 (diff) | |
| download | deck-it-c074a085cca9d97d9b4eb18f21004fb41f7857f6.tar.gz deck-it-c074a085cca9d97d9b4eb18f21004fb41f7857f6.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'deckit/server.py')
| -rw-r--r-- | deckit/server.py | 8 |
1 files changed, 5 insertions, 3 deletions
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: |
