fix(lint): allow CJK fallback stacks documented in output-spec.md (#75)

Extend lint-skin.py font allowlist with the Hiragino/Noto/Yu Gothic
families from output-spec.md §4 and add adversarial tests including a
Yu Gothic UI rejection case.

Fixes #74
This commit is contained in:
Atirna
2026-08-17 13:44:37 -07:00
committed by GitHub
parent 09df49d8d1
commit 7ed2b20a5a
4 changed files with 49 additions and 2 deletions
+4
View File
@@ -53,6 +53,10 @@ ALLOWED_FONTS = {
"instrument serif",
"geist",
"geist mono",
"hiragino sans",
"noto sans jp",
"yu gothic",
"noto sans mono cjk jp",
"system-ui",
"sans-serif",
"serif",
+43
View File
@@ -363,6 +363,49 @@ def main() -> int:
"font-family: unsupported font family: Unapproved Sans",
directory,
)
cjk_name_svg = VALID_SVG.replace("fixture-title", "cjk-name-stack-title").replace(
"fixture-desc", "cjk-name-stack-desc"
)
require_pass(
"cjk-name-stack",
cjk_name_svg.replace(
"</svg>",
'<text font-family="\'Geist\', \'Hiragino Sans\', \'Noto Sans JP\', '
'\'Yu Gothic\', sans-serif">認証サービス</text>\n</svg>',
),
directory,
)
cjk_mono_svg = VALID_SVG.replace("fixture-title", "cjk-mono-stack-title").replace(
"fixture-desc", "cjk-mono-stack-desc"
)
require_pass(
"cjk-mono-stack",
cjk_mono_svg.replace(
"</svg>",
'<text font-family="\'Geist Mono\', \'Noto Sans Mono CJK JP\', '
'monospace">포트 443</text>\n</svg>',
),
directory,
)
cjk_css_svg = VALID_SVG.replace("fixture-title", "cjk-css-stack-title").replace(
"fixture-desc", "cjk-css-stack-desc"
)
require_pass(
"cjk-css-stack",
'<style>text { font-family: "Geist", "Hiragino Sans", "Noto Sans JP", '
'"Yu Gothic", sans-serif; }</style>\n' + cjk_css_svg,
directory,
)
yu_gothic_ui_svg = VALID_SVG.replace(
"fixture-title", "yu-gothic-ui-title"
).replace("fixture-desc", "yu-gothic-ui-desc")
require_lint_finding(
"yu-gothic-ui",
'<style>text { font-family: "Yu Gothic UI", sans-serif; }</style>\n'
+ yu_gothic_ui_svg,
"font-family: unsupported font family: Yu Gothic UI",
directory,
)
spec = importlib.util.spec_from_file_location("build_icons", BUILD_ICONS)
if spec is None or spec.loader is None: