# Inkhaven 1.3.16 — The ConLang Suite (Part 3: writing systems, fonts & output)

_1.3.14–1.3.15 built the spoken language — phonology, lexicon, morphology,
diachronics. 1.3.16 builds the **written** one: a constructed script goes from
hand artwork or an AI description all the way to a real TrueType font, a Typst
layout, and a typed input method — and the language starts becoming a **book**.
RFC LANG-1; reference [CONLANG.md](../CONLANG.md)._

This is the one dependency-heavy phase the plan always flagged. It adds **one
new crate** — `norad` (a pure-Rust UFO reader/writer) — for the fonts pillar the
user approved. The in-process TrueType compiler reuses `write-fonts` + `kurbo`,
which were **already in the dependency tree** (via `typst` / `krilla`), so they
add no new compiled crate; `fontc` was deliberately *not* used (it would have
dragged in `fontir` / `fontbe` plus a duplicate `write-fonts`). `skrifa` is a
test-only dev-dependency, also already in the tree.

## Writing systems + fonts (P5)

A complete pipeline from glyph to font, fully in-process — no external tool:

- **Glyph suitability preflight** — `language glyph-lint --svg a.svg` checks an
  SVG is fit for a font outline (filled paths required; stroke-only / raster /
  gradient artwork is flagged). It also catches the **counter mistake**: a
  near-white fill among darker ones is almost always a hole the author drew with
  white paint, which a monochrome font won't honour.
- **SVG → UFO** — `language font-build` compiles a directory of glyph SVGs into
  a UFO font source (via `norad`).
- **UFO → TrueType, in-process** — `--format ttf|both` assembles a complete
  OpenType table set (`glyf`/`loca`/`cmap`/`head`/`hhea`/`maxp`/`hmtx`/`name`/
  `post`/`OS-2`) directly with `write-fonts`; cubics are quadified for the
  `glyf` table. The result opens in any font tool and passes a fontTools
  structural round-trip.
- **Config-driven font block + binding** — `language font-import-glyph` binds a
  glyph to a phoneme and a Unicode codepoint, stores the artwork, and records it
  in a `font` block in the language; `font-config` lists the bindings;
  `font-build --language <lang>` compiles the script straight from the book.
- **AI text-to-SVG glyph draft** — `language glyph-draft --describe "…"` has the
  model draft an SVG glyph, run through the same preflight, advisory (`--yes`
  binds a usable draft). The prompt instructs the model to cut counters with
  **reverse-wound subpaths**, not white fills. _Validated live against DeepSeek:
  drafting, preflight, binding, and compilation all produce a renderable font._
- **Spatial templates — composed blocks & layout** — one `SpatialTemplate`
  engine, two binding times. `language font-compose` bakes component glyphs into
  one precomposed block (a Hangul-style syllable square, an Egyptian quadrat);
  `language spatial-typst` arranges them at **layout time** in a Typst quadrat
  (the hieroglyphic path — no combinatorial precomposition). Built-in templates
  `lr` / `tb` / `quad` / `stack3`, or define your own.
- **Input method** — `language transliterate --text "katha"` types the script:
  romanized input → glyph codepoints via the font bindings, longest key first so
  a digraph (`th`, `ka`) beats its prefixes.

## Analysis (P6.1)

- **`language stats <lang>`** — a descriptive profile (vs `audit`, which hunts
  for problems): inventory balance (consonants / vowels), phoneme frequency
  across the lexicon, the syllable-length distribution (with bars), which onsets
  and codas get used, and the part-of-speech spread.

## Dictionary output (P6.2)

- **`language dictionary <lang> --format md|typ`** — render the lexicon as a
  real document. Markdown is a clean alphabetized listing; **Typst is the
  showpiece**: a paginated, two-column A5 book with a title page and overview
  table that — when the language has a `font` block — shows each headword in the
  **native script** (transliterated by the input method) beside its
  romanization, pronunciation, POS, and gloss. Compiles to a PDF that embeds and
  renders the conscript font.

## Design notes

- **Deterministic core, thin AI layer.** Every engine — the preflight, the
  SVG→UFO→TTF compiler, the spatial composition, the input method, the analysis
  profile, the document renderers — is a pure, unit-tested function. Only the
  glyph drafter calls the LLM, as a thin layer behind the preflight.
- **AI stays advisory** — the glyph draft is proposal-gated (`--yes`-committed),
  validated through the suitability preflight before it can be bound.
- **Reuse over new deps.** The TrueType compiler builds on crates already in the
  tree; only `norad` is genuinely new, for the approved fonts pillar.

## What's next

The remaining LANG-1 work: the **grammar book** output (phonology tables,
morphology paradigms, the typology questionnaire, sample texts — the companion
to the dictionary), then **polish** (a tutorial and a complete worked example
language).

Tests 1439 (1.3.15) → 1479. One new dependency (`norad`). Full surface:
[CONLANG.md](../CONLANG.md).
