fix(app): keep diff typography and colours native to the host
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user