#820·terax-ai

Terminal: blank font setting renders Nerd Font icons as tofu on macOS (auto-detect fails in WKWebView)

Author: frdrckjCreated Jun 17, 2026Updated Sep 17, 2026

Terax version

0.8.0 (also present on main)

Operating system

macOS (Apple Silicon)

OS version

macOS 26.5 (25F71)

What happened?

With the terminal Font family preference left blank (the default), powerline / Nerd Font glyphs from oh-my-zsh / Powerlevel10k / Starship render as tofu boxes — even though a Nerd Font (e.g. "MesloLGS NF" / "MesloLGS Nerd Font Mono") is installed system-wide.

The auto-detect path is the cause. src/lib/fonts.ts detectMonoFontFamily() selects a Nerd Font only via document.fonts.check(\12px "${f}"`)(line 56). Inside the macOS WKWebView,document.fonts.check()returns **false** for OS-installed fonts that aren't@font-face-registered (Terax bundles no Nerd Font — intentional, for bundle size). So the loop over NERD_FONT_CANDIDATESnever matches and control falls toFALLBACK_CHAIN ("JetBrains Mono", which has no PUA glyphs) → tofu. This is hit whenever the field is empty (resolveFontFamily("")detectMonoFontFamily()`, line 39).

This matches what @Rl0007 reported on the merged #374 (in a comment that also raised the since-fixed spaces-in-name bug): "When I leave it blank the text render fine but icons are broken" (with screenshot). The recent font PR #815 fixed #428 and added resolveFontFamily, but did not touch detection, so this is still present on main.

What did you expect to happen?

With the field blank, Terax should auto-detect an installed Nerd Font (as it does on platforms where document.fonts.check() works) and render powerline/Nerd glyphs correctly out of the box. Setting the font name manually is the current workaround (per #239), but the blank-field auto-detect is the documented fallback (per #374) and silently fails on macOS.

Steps to reproduce

  1. On macOS, install a Nerd Font, e.g. brew install --cask font-meslo-lg-nerd-font (provides "MesloLGS NF").
  2. Use a Nerd-Font prompt (oh-my-zsh + powerlevel10k, or Starship).
  3. Open Terax with Settings → Terminal → Font family left blank (default).
  4. Open a new terminal tab → powerline separators and icon glyphs render as tofu boxes.
  5. Manually typing MesloLGS NF into Font family fixes it — proving the font is installed and the failure is in auto-detection, not the font.

Logs / screenshots

In the WKWebView DevTools console, document.fonts.check('12px "MesloLGS NF"') returns false even though the font is installed (the same call returns true for that family in Safari/Chrome). Before/after screenshots of the prompt can be attached.

Before submitting

  • I searched existing issues and didn't find an open duplicate
  • I am running the latest version (or this happens on main)

Proposed fix (happy to open a PR on your go-ahead): keep document.fonts.check() as the fast path, and only when it returns false, fall back to a canvas measureText() width probe — render a probe string in "<candidate>", monospace vs bare monospace; a genuinely installed family shifts the width off the generic-monospace baseline, and WKWebView reports OS-installed fonts correctly through canvas measurement. It's additive: zero font assets, zero new deps (preserves the bundle-size constraint you called out in #272), never overrides a correct check() result, and is memoized (worst case a handful of canvas measurements once per process). I'd add detectMonoFontFamily() unit tests covering all branches (fast-path hit, canvas-probe hit, no-font fallback, no-document fallback), since only resolveFontFamily is covered today.

Since this changes the blank-field default behavior in a core rendering path, I'm raising it as an issue first per CONTRIBUTING rather than opening a cold PR. The patch + tests are drafted; I'll verify the canvas probe on a real macOS build and include before/after screenshots in the PR. Refs #239, #374, #272.