How the Font Pairing Suggester Works
A pure engine (fontPairingEngine.ts) holds a curated catalogue of heading + body Google Fonts pairings, each tagged with a mood and a one-line rationale. For the selected pair it builds a Google Fonts css2 request for ONLY those families and only the weights actually used, and serialises the copy-paste CSS — an @import line plus font-family declarations for headings and body — so the preview and the exported code match exactly. The React page injects a single <link> for the visible/selected families, lets the user type their own heading and body specimen text (kept entirely local), tune sizes, and toggle a dark canvas or a system-fonts-only mode.
- Curated pairings, each with a mood tag and a plain-language rationale
- Only selected families + used weights are requested — never the whole catalogue
- Every font-family value ends in a system fallback so text is readable while loading
- The exported @import URL is identical to what the preview loads
- Pure, deterministic engine — the same pair always emits the same CSS
