// Embeds the subset share-image fonts (Latin only) as base64 in src/fonts.ts. // Fonts: Fredoka 600/700 and Nunito 800 (SIL Open Font License), subset with // pyftsubset to U+0020-007E, U+00A0-00FF and common punctuation. // Usage: node scripts/embed-fonts.mjs import { readFileSync, writeFileSync } from 'node:fs' const f = (n) => readFileSync(new URL(`./fonts/${n}.sub.ttf`, import.meta.url)).toString('base64') writeFileSync( new URL('../src/fonts.ts', import.meta.url), `// Generated by scripts/embed-fonts.mjs. Fredoka and Nunito, SIL Open Font License 1.1.\nexport const FREDOKA_600 = '${f('fredoka-600')}'\nexport const FREDOKA_700 = '${f('fredoka-700')}'\nexport const NUNITO_800 = '${f('nunito-800')}'\n`, ) console.log('fonts embedded')