import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import { createHash } from 'node:crypto'; const root = new URL('../', import.meta.url); const css = await readFile(new URL('src/style.css', root), 'utf8'); const html = await readFile(new URL('index.html', root), 'utf8'); const face = css.match(/@font-face\s*\{([^}]+)\}/)?.[1] ?? ''; assert.match(face, /font-family:\s*"BM Kkubulim"/, 'the requested font has an explicit local webfont face'); assert.match(face, /src:\s*url\("\/fonts\/BMKkubulim\.woff"\)\s*format\("woff"\)/); assert.match(face, /font-display:\s*swap/, 'text remains available while the font loads'); assert.match(face, /font-weight:\s*400/); assert.match(face, /font-style:\s*normal/); assert.match(css, /--font-ui:\s*"BM Kkubulim"[^;]+system-ui,sans-serif/); assert.match(css, /:root\s*\{[^}]*font-family:\s*var\(--font-ui\)/); assert.match(css, /font-synthesis:\s*none/, 'do not invent a bold or italic font face'); assert.doesNotMatch(css, /font-weight:\s*(?:[5-9]\d\d|bold|bolder)/, 'only the official regular weight is requested'); assert.doesNotMatch(css, /"Batang"|"Noto Serif KR"|"Arial Rounded MT Bold"/, 'old theme-specific font families cannot win the cascade'); assert.match(css, /:root\[data-theme=wood\]\s*\{(?![^}]*font-family)/, 'wood shares the requested font'); assert.match(css, /\.welcome h1\s*\{[^}]*font-family:\s*inherit/); assert.match(css, /output,input\[type=number\],pre,code\s*\{[^}]*font-family:\s*var\(--font-values\)/, 'technical values keep a readable fixed-width face'); assert.match(css, /strong,b\s*\{[^}]*font-weight:\s*400/); assert.match(html, //); const font = await readFile(new URL('public/fonts/BMKkubulim.woff', root)); assert.equal(font.toString('ascii', 0, 4), 'wOFF', 'bundled asset is a real WOFF font'); assert.equal(font.readUInt32BE(8), font.length, 'font header length matches the asset'); assert.equal(createHash('sha256').update(font).digest('hex'), 'dc1e920bfdc5fd3b90189687e3f1ec3335e7a009015bca11d5b2348c4f4257ec', 'bundle the verified lossless official font'); assert.ok(font.length > 100_000 && font.length < 3_000_000, 'the complete font remains reasonably sized'); const license = await readFile(new URL('public/licenses/BMKkubulim-OFL.txt', root), 'utf8'); for (const text of ['Woowa Brothers', 'BMkkubulim', 'SIL OPEN FONT LICENSE', 'PERMISSION & CONDITIONS', 'TERMINATION', 'DISCLAIMER']) assert.ok(license.includes(text), `license includes ${text}`); const notices = await readFile(new URL('public/THIRD-PARTY-NOTICES.txt', root), 'utf8'); assert.match(notices, /licenses\/BMKkubulim-OFL\.txt/); console.log('UI font passed: local Kkubulim face/preload, shared themes, real font asset, regular weight, readable numeric fallback and complete license wiring (source checks, no browser layout engine).');