fix(app): keep diff typography and colours native to the host

This commit is contained in:
2026-10-21 18:40:49 +01:00
parent ada25a59e5
commit 32e1cac46f
10 changed files with 63 additions and 210 deletions
+3 -18
View File
@@ -219,30 +219,15 @@ try {
throw new Error(`Root index is not text/html: ${contentType}`);
}
// The diff's core content can only be monospaced if the web build ships a
// code face; CanvasKit cannot resolve the system `monospace` family.
// Diff text inherits native host typography; it must not add a custom face.
const manifest = await evaluate("fetch('/assets/FontManifest.json').then(r => r.json())");
const codeEntry = (Array.isArray(manifest) ? manifest : []).find(
(entry) => entry.family === 'RobotoMono',
);
const codeAsset = codeEntry?.fonts?.[0]?.asset;
if (!codeAsset) {
throw new Error(`FontManifest has no RobotoMono family: ${JSON.stringify(manifest)}`);
}
const fontResponse = await evaluate(`fetch('/assets/${codeAsset}').then(async (r) => ({
status: r.status,
contentType: r.headers.get('content-type'),
bytes: (await r.arrayBuffer()).byteLength,
}))`);
if (codeEntry) throw new Error('Diff build still overrides native typography');
evidence.checks.push({
check: 'the web build carries the diff code face',
family: codeEntry.family,
asset: codeAsset,
...fontResponse,
check: 'the web build does not register a custom diff font',
});
if (fontResponse.status !== 200 || fontResponse.bytes < 10000) {
throw new Error(`Code face did not load: ${JSON.stringify(fontResponse)}`);
}
const firstLabels = await labels();
const firstBody = await bodyText();