feat: add model-specific render profiles and recall evidence

This commit is contained in:
Steven Chong
2026-07-09 22:25:06 -04:00
parent bfcf15ca95
commit cd4c9efddd
54 changed files with 13941 additions and 503 deletions
+9 -7
View File
@@ -52,6 +52,8 @@ const FALLBACK_FONT_PX = Number(process.env.ATLAS_FALLBACK_PX ?? PRIMARY_FONT_PX
const FONT_FAMILY_LABEL =
process.env.ATLAS_LABEL ??
`${PRIMARY_FONT_FAMILY} ${PRIMARY_FONT_PX}px + ${FALLBACK_FONT_FAMILY} ${FALLBACK_FONT_PX}px fallback`;
const PRIMARY_FONT_LABEL = process.env.ATLAS_PRIMARY_FONT ?? 'assets/Spleen-5x8.otb';
const FALLBACK_FONT_LABEL = process.env.ATLAS_FALLBACK_FONT ?? 'assets/Unifont-16.0.04.otf';
const PROFILE = (process.env.ATLAS_PROFILE ?? 'full-bmp') as
| 'practical'
| 'full-bmp'
@@ -223,14 +225,14 @@ for (const [lo, hi, label] of RANGES) {
`[gen-atlas] ${label.padEnd(48)} ` +
`U+${lo.toString(16).padStart(4, '0').toUpperCase()}..` +
`U+${hi.toString(16).padStart(4, '0').toUpperCase()} ` +
`kept ${kept}/${hi - lo + 1} (spleen=${primary}, unifont=${fallback})`,
`kept ${kept}/${hi - lo + 1} (primary=${primary}, fallback=${fallback})`,
);
}
found.sort((a, b) => a.cp - b.cp);
const wideCount = found.filter((f) => f.wide).length;
const primaryCount = found.filter((f) => f.source === 'primary').length;
console.log(`[gen-atlas] total glyphs: ${found.length} (${wideCount} wide, ${primaryCount} Spleen primary)`);
console.log(`[gen-atlas] total glyphs: ${found.length} (${wideCount} wide, ${primaryCount} primary)`);
// --- Rasterize glyphs ------------------------------------------------------
const contexts = {
@@ -327,9 +329,9 @@ if (GRAY_MODE) {
const grayBanner = `// AUTO-GENERATED by scripts/gen-atlas.ts (ATLAS_GRAY=1) — DO NOT EDIT.
// Regenerate with: ATLAS_GRAY=1 npx tsx scripts/gen-atlas.ts
// EVAL-ONLY artifact: this file is NOT imported by the production render path.
// Source fonts: assets/Spleen-5x8.otb @ ${PRIMARY_FONT_PX}px for ASCII/code; assets/Unifont-16.0.04.otf @ ${FALLBACK_FONT_PX}px fallback (profile: ${PROFILE})
// Glyphs: ${found.length} codepoints (${wideCount} wide, ${primaryCount} Spleen primary)
// Grayscale companion atlas; imported when RenderStyle.aa is true.
// Source fonts: ${PRIMARY_FONT_LABEL} @ ${PRIMARY_FONT_PX}px primary; ${FALLBACK_FONT_LABEL} @ ${FALLBACK_FONT_PX}px fallback (profile: ${PROFILE})
// Glyphs: ${found.length} codepoints (${wideCount} wide, ${primaryCount} primary)
// Pixel format: 1 coverage byte per pixel (0-255), raw R-channel from anti-aliased canvas.
// ATLAS_GRAY_OFFSETS are BYTE offsets (not bit offsets like ATLAS_OFFSETS).
`;
@@ -447,8 +449,8 @@ const banner = `// AUTO-GENERATED by scripts/gen-atlas.ts — DO NOT EDIT.
// Regenerate with: pnpm run build:atlas
// (or ATLAS_PROFILE=practical pnpm run build:atlas to drop Hangul for
// Workers free-tier deployments under the 1 MB compressed-bundle cap)
// Source fonts: assets/Spleen-5x8.otb @ ${PRIMARY_FONT_PX}px for ASCII/code; assets/Unifont-16.0.04.otf @ ${FALLBACK_FONT_PX}px fallback (profile: ${PROFILE})
// Glyphs: ${found.length} codepoints (${wideCount} wide, ${primaryCount} Spleen primary)
// Source fonts: ${PRIMARY_FONT_LABEL} @ ${PRIMARY_FONT_PX}px primary; ${FALLBACK_FONT_LABEL} @ ${FALLBACK_FONT_PX}px fallback (profile: ${PROFILE})
// Glyphs: ${found.length} codepoints (${wideCount} wide, ${primaryCount} primary)
`;
const body = `