feat: load Aldrich webfont for #1137 logo SVG (#1138)

Adds Aldrich webfont so the merged #1137 logo renders in the intended
typeface.

## Problem
The inline SVG logo merged in #1137 declares `font-family="Aldrich,
monospace"` in `public/index.html` and `public/home.js`, but the page
never loaded the Aldrich font face. Browsers silently fell back to
monospace.

## Fix
Self-hosted webfont:
- `public/fonts/aldrich-regular.woff2` — Regular 400, ~16KB, downloaded
from Google Fonts (latin subset). Self-hosted to avoid third-party CDN
dependency, privacy concern, and FOUT delay.
- `@font-face` declaration added at the top of `public/style.css` with
`font-display: swap`.

Aldrich only ships in 400; the SVG `font-weight="700"` on the wordmark
synthesizes bold (matches the design intent of #1137).

## TDD
- Red commit: E2E test asserting `document.fonts.check('1em Aldrich')`
is true and the navbar SVG `<text>` `font-family` contains "Aldrich".
Without the font face declaration, both assertions fail on an assertion
(not a build error).
- Green commit: adds the woff2 + `@font-face` rule, both assertions
pass.

## Files
- `public/fonts/aldrich-regular.woff2` (new, 16460 bytes)
- `public/style.css` — `@font-face` rule
- `test-e2e-playwright.js` — new test

---------

Co-authored-by: openclaw-bot <bot@openclaw.local>
This commit is contained in:
Kpa-clawbot
2026-05-06 21:24:57 -07:00
committed by GitHub
co-authored by openclaw-bot
parent eddca7acde
commit eae1b915ca
4 changed files with 42 additions and 0 deletions
Binary file not shown.
+11
View File
@@ -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)
* ------------------------------------------------------------
+9
View File
@@ -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
+22
View File
@@ -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 <text> 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 <text> 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