diff --git a/public/fonts/aldrich-regular.woff2 b/public/fonts/aldrich-regular.woff2 new file mode 100644 index 00000000..c92a531b Binary files /dev/null and b/public/fonts/aldrich-regular.woff2 differ diff --git a/public/style.css b/public/style.css index 58c885cf..5af7f8fa 100644 --- a/public/style.css +++ b/public/style.css @@ -1,5 +1,16 @@ /* === CoreScope — style.css === */ +/* Aldrich webfont — used by the navbar logo SVG (issue #1137 follow-up). + * Self-hosted woff2 (latin subset from Google Fonts, ~16KB). Only weight + * available is 400; the SVG's font-weight="700" synthesizes bold. */ +@font-face { + font-family: 'Aldrich'; + src: url('/fonts/aldrich-regular.woff2') format('woff2'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + /* ============================================================ * Z-INDEX SCALE (single source of truth — issues #1128, #1131, #1128 followup) * ------------------------------------------------------------ diff --git a/scripts/instrument-frontend.sh b/scripts/instrument-frontend.sh index 615416ed..51562f8c 100644 --- a/scripts/instrument-frontend.sh +++ b/scripts/instrument-frontend.sh @@ -16,6 +16,15 @@ if [ -d public/img ]; then mkdir -p public-instrumented/img cp -r public/img/. public-instrumented/img/ fi +# Copy webfonts (e.g. public/fonts/aldrich-regular.woff2 used by the +# navbar logo SVG @font-face, #1137 follow-up). Same SPA-fallback gotcha +# as /img — without this, GET /fonts/aldrich-regular.woff2 returns +# index.html and the @font-face download fails silently, so the logo +# falls back to monospace and the Aldrich E2E assertion fails. +if [ -d public/fonts ]; then + mkdir -p public-instrumented/fonts + cp -r public/fonts/. public-instrumented/fonts/ +fi # Copy vendored libraries unmodified — `nyc instrument` skips subdirectories # without a package.json, so vendor/qrcode.js, vendor/jsqr.min.js, etc. are # never emitted into public-instrumented/. Without them the SPA fallback diff --git a/test-e2e-playwright.js b/test-e2e-playwright.js index 1783af27..8e695375 100644 --- a/test-e2e-playwright.js +++ b/test-e2e-playwright.js @@ -56,6 +56,28 @@ async function run() { assert(nav, 'Nav bar not found'); }); + // #1137 follow-up: Aldrich webfont must actually load so the navbar logo SVG + // renders in the intended typeface (not the silent monospace fallback). + await test('#1137 Aldrich webfont is loaded for navbar logo SVG', async () => { + await page.goto(BASE, { waitUntil: 'domcontentloaded' }); + // Explicitly request the font (waits for download). On the broken state + // there is no @font-face for Aldrich, so no FontFace matches and check() + // stays false — the assertion below fails on behavior, not infra. + const aldrichLoaded = await page.evaluate(async () => { + try { await document.fonts.load('1em Aldrich'); } catch (_) {} + await document.fonts.ready; + return document.fonts.check('1em Aldrich'); + }); + assert(aldrichLoaded, 'document.fonts.check("1em Aldrich") returned false — Aldrich is not loaded'); + // Sanity: the inline SVG still declares Aldrich in its font-family. + const fontFamily = await page.evaluate(() => { + const t = document.querySelector('nav svg text, .navbar svg text, header svg text'); + return t ? (t.getAttribute('font-family') || getComputedStyle(t).fontFamily) : null; + }); + assert(fontFamily && /aldrich/i.test(fontFamily), + `Navbar SVG font-family should include Aldrich, got: ${fontFamily}`); + }); + // Test 6: Theme customizer opens (reuses home page from test 1) await test('Theme customizer opens', async () => { // Look for palette/customize button