wealth/docs/decisions/0004-self-hosted-yekan-bakh.md

1.4 KiB
Raw Blame History

0004 Self-hosted Yekan Bakh variable font

Status: Superseded by 0007 · Area: design · Date: 2026-10-04 · Decided by: user

Context

The Lumina Design System replaced Vazirmatn with Yekan Bakh, a licensed variable font (weights 100–1000) that ships with the app, plus Yekan Bakh FaNum, which draws Latin digits as Persian.

Decision

  • Serve both faces from island: packages/island/src/fonts/yekan-bakh-vf.woff2 and yekan-bakh-fa-num-vf.woff2. Never load them from a public CDN.
  • Each app loads them with next/font/local (weight: '100 1000', display: 'swap', a Tahoma fallback), with variable: '--font-yekan-bakh' and '--font-yekan-bakh-fa-num', on <html lang="fa" dir="rtl">, never <body>: island's --font-sans and --font-fanum resolve on :root, so variables set lower fall back to Tahoma silently.
  • Use font-sans everywhere and write Persian digits. Use font-fanum only where typed Latin digits can't be reformatted.

Alternatives

  • Vazirmatn from Google Fonts (the design system's first choice): a third-party request on the critical path.
  • Static weight files: the design system ships only the variable files, and one file per weight means more requests.

Consequences

  • No third-party font request; one preloaded file covers every weight.
  • The font is licensed: keep the repo private, and check that the licence covers web embedding in every app before release.
  • Upgrading the font is a file swap in island.