diff --git a/scripts/check-design-system.ts b/scripts/check-design-system.ts index ac0a5a5d..890de942 100644 --- a/scripts/check-design-system.ts +++ b/scripts/check-design-system.ts @@ -135,6 +135,32 @@ for (const token of REQUIRED_COMPONENT_TOKENS) { } } +// UI-05. --font-sans named Inter first, but nothing loads Inter, so most +// machines drew another font and Hangul never came from Inter at all. +// The first family must be a generic keyword or one this repo ships. +const GENERIC_FONT_FAMILIES = new Set([ + "system-ui", + "ui-sans-serif", + "ui-serif", + "ui-monospace", + "sans-serif", + "serif", + "monospace", +]); +const shippedFontFamilies = new Set( + cssSources.flatMap(({ source }) => + [...source.matchAll(/@font-face\s*\{[^}]*font-family:\s*["']?([^;"']+)/g)] + .map((match) => match[1].trim()), + ), +); +const fontSans = lightProperties.get("--font-sans") ?? ""; +const firstFontFamily = fontSans.split(",")[0]?.trim().replace(/^["']|["']$/g, "") ?? ""; +if (!GENERIC_FONT_FAMILIES.has(firstFontFamily) && !shippedFontFamilies.has(firstFontFamily)) { + failures.push( + `--font-sans starts with "${firstFontFamily}", which is neither a generic family nor loaded by @font-face`, + ); +} + const componentSource = await readFile(tokenFiles.component, "utf8"); if (!componentSource.includes("@media (forced-colors: active)")) { failures.push("forced-colors token fallback is missing"); diff --git a/src/presentation/design-system/tokens/semantic.css b/src/presentation/design-system/tokens/semantic.css index d494ba71..de4142f0 100644 --- a/src/presentation/design-system/tokens/semantic.css +++ b/src/presentation/design-system/tokens/semantic.css @@ -30,7 +30,7 @@ --color-danger-surface: oklch(0.96 0.035 25); --color-danger-border: oklch(0.72 0.12 25); - --font-sans: Inter, ui-sans-serif, system-ui, sans-serif; + --font-sans: system-ui, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif; --spacing-page: var(--space-6); --radius-control: var(--radius-sm); --radius-surface: var(--radius-md);