// Plan 06.1-04 — one-shot converter from FSEX300.ttf to FixedsysExcelsior.woff2. // Reproducibility script. Run with `node tools/convert-fixedsys-woff2.mjs`. // // Upstream source: https://github.com/kika/fixedsys (CC0 Public Domain). // Output: apps/client/public/assets/fonts/FixedsysExcelsior.woff2 import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { createRequire } from 'node:module'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); // Anchor require on the @rebno/client package so the installed wawoff2 devDep resolves. const require = createRequire(path.join(__dirname, '..', 'apps', 'client', 'package.json')); const TTF_PATH = path.resolve(__dirname, '..', 'apps', 'client', 'public', 'assets', 'fonts', 'FSEX302.ttf'); const WOFF2_PATH = path.resolve(__dirname, '..', 'apps', 'client', 'public', 'assets', 'fonts', 'FixedsysExcelsior.woff2'); const { Font, woff2 } = require('fonteditor-core'); await woff2.init(); const ttf = fs.readFileSync(TTF_PATH); const font = Font.create(ttf, { type: 'ttf' }); const buf = font.write({ type: 'woff2' }); fs.writeFileSync(WOFF2_PATH, Buffer.from(buf)); console.log('Wrote', WOFF2_PATH, '(', buf.length, 'bytes )');