Skip to content

fix(skill): pdf-official CJK font protocol — verified TTF ladder, CID fallback, never Helvetica - #2189

Merged
oscar-cao7 merged 2 commits into
mainfrom
fix/pdf-cjk-font-protocol
Aug 22, 2026
Merged

fix(skill): pdf-official CJK font protocol — verified TTF ladder, CID fallback, never Helvetica#2189
oscar-cao7 merged 2 commits into
mainfrom
fix/pdf-cjk-font-protocol

Conversation

@oscar-cao7

Copy link
Copy Markdown
Collaborator

Summary

pdf-official 技能(compose.md §4)未约束 CJK 字体注册路径,导致模型照搬 docx/pptx 字体名
(PingFang/思源黑体)直接传给 reportlab,注册必败 → try/except 吞异常 → 静默回落 Helvetica
(无 CJK 字形)→ 中文全渲染为黑色方块。

Changes

  • compose.md §4: 整段替换为强制 CJK 协议
    • per-OS 实测 TTF 阶梯(macOS: STHeiti/Songti/Arial Unicode; Windows: msyh/simhei/simsun; Linux: Noto CJK/wqy)
    • 全缺回落内置 CID STSong-Light,禁回落 Helvetica
    • Platypus 样式 + 页眉页脚回调须同步设 CJK_FONT
    • 列出已知失败字体(PingFang.ttc/Hiragino Sans GB/思源黑体)
  • SKILL.md: Common gotchas 新增 文档中分享页面或存在问题 #4 CJK 黑盒条目

Verification

macOS 捆绑运行时(reportlab 4.2.5)实测:

  • STHeiti Light.ttc 注册+嵌入 OK
  • Songti.ttc 注册+嵌入 OK
  • CID STSong-Light 注册 OK
  • PingFang.ttc / Hiragino Sans GB 确认不可用(已排除)
  • 真机验收:canvas + Platypus 简繁日零豆腐

oscar-cao7 and others added 2 commits August 21, 2026 16:41
… fallback, never Helvetica

CJK PDFs came out as all-tofu when the model referenced fonts that don't
exist on the machine (思源黑体, PingFang) and the registration failure was
swallowed, silently falling back to Helvetica which has no CJK glyphs.
compose.md §4 now mandates resolve_cjk_font(): probe verified per-OS font
files (macOS STHeiti/Songti/Arial Unicode, Windows msyh/simhei/simsun,
Linux Noto/WQY) and register+embed, with built-in UnicodeCIDFont
STSong-Light as the terminal fallback — never Helvetica. SKILL.md gains a
matching top-level gotcha. Verified end-to-end on the bundled runtime
(reportlab 4.2.5): canvas + Platypus render 简/繁/日 with zero tofu.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…expand Linux ladder

- PingFang.ttc failure is CFF outlines (same as Hiragino), not "not readable"
- Arial Unicode.ttf: note macOS 11+ usually not preinstalled
- Linux: add Fedora/RHEL + Arch Noto CJK paths

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@oscar-cao7
oscar-cao7 merged commit f57520c into main Aug 22, 2026
6 checks passed
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