Skip to content

perf(game): 预加载 Zpix 字体,减少 FOUT 跳动 - #36

Merged
realRoc merged 1 commit into
mainfrom
fix/game-lang-switch-pixel-ui
Jun 1, 2026
Merged

perf(game): 预加载 Zpix 字体,减少 FOUT 跳动#36
realRoc merged 1 commit into
mainfrom
fix/game-lang-switch-pixel-ui

Conversation

@realRoc

@realRoc realRoc commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

Performance

  • perf(game): 为 game.html 添加 <link rel="preconnect"><link rel="preload"> 提前下载 Zpix 像素字体 woff2,减少 font-display: swap 回退渲染窗口(FOUT 跳动)

Pre-Landing Review

No issues found. Diff: 2 lines (HTML <link> tags with correct crossorigin and as="font" attributes).

Design Review

No visual changes — preload is metadata-only.

Adversarial Review

Claude subagent: informational — no SRI integrity on jsDelivr URL (theoretical supply-chain risk, non-blocking for a pixel font). Recommendation: ship as-is.

Test plan

  • HTML valid — <link rel="preload" as="font" type="font/woff2" crossorigin> correct syntax
  • crossorigin attribute consistent with @font-face anonymous CORS mode
  • preconnect to cdn.jsdelivr.net correctly added alongside preload

🤖 Generated with Claude Code

为 game.html 添加 preconnect + preload,让 Zpix woff2 在 HTML 解析阶段
即开始并行下载,缩小 font-display:swap 的回退渲染窗口。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@realRoc

realRoc commented Jun 1, 2026

Copy link
Copy Markdown
Owner Author

🤖 由 Codex 自动生成

建议

暂无额外建议。docs/game.html:17 的 preload URL 与 @font-facesrc 一致,crossorigin 与跨域字体加载匹配;资源返回 font/woff2 且允许跨域。

结论:✅ 可以合并

@realRoc
realRoc merged commit 450c399 into main Jun 1, 2026
1 check passed
@realRoc
realRoc deleted the fix/game-lang-switch-pixel-ui branch June 1, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant