Fonts

kou does not bundle fonts. Instead, like ort for ONNX Runtime, it fetches a curated family into a shared cache (once, then cached across runs) and locates it transparently. A [FontSet] pairs a primary monospace face with an optional CJK fallback; the renderer loads them with ab_glyph and, for each codepoint, picks the first face that covers it — so a single render mixes Latin and CJK without tofu.

Families

SlotKOU_FONT_* valueFamily
primary (default)fira-codeFira Code
primaryjetbrains-monoJetBrains Mono
CJK (default)sarasaSarasa Mono SC (更纱黑体)
CJKsourcehansansSource Han Sans SC (思源黑体)
CJKsmileysansSmiley Sans (得意黑)
CJKnonedisable the fallback

Resolution order

  1. Explicit fileKOU_FONT_PATH (primary) / KOU_FONT_CJK_PATH.
  2. Shared cache<cache>/kou/fonts/<family>.ttf|otf.
  3. Runtime download — the font-fetch feature fetches the family from a public source (GitHub / jsDelivr) into the cache.

Knobs

EnvPurpose
KOU_FONT_PRIMARYOverride the primary family.
KOU_FONT_CJKOverride / disable the CJK family.
KOU_FONT_MIRRORReplace the canonical GitHub / jsDelivr host with a mirror (e.g. for use behind a restrictive network).
KOU_DOWNLOAD_PROXYRoute font downloads through http:// / https:// / socks5:// proxy.
KOU_DOWNLOAD_TIMEOUT_SECSPer-request timeout (default 120).
KOU_SKIP_FONT_FETCHDisable runtime fetching (use cache / explicit paths only).

No fonts at all

If no face can be resolved, FontCache is empty and the renderer degrades to drawing a solid block per non-empty cell — so kou still produces something without fonts, and never panics on a missing file.