fix(skill): pdf-official CJK font protocol — verified TTF ladder, CID fallback, never Helvetica - #2189
Merged
Merged
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pdf-official 技能(compose.md §4)未约束 CJK 字体注册路径,导致模型照搬 docx/pptx 字体名
(PingFang/思源黑体)直接传给 reportlab,注册必败 → try/except 吞异常 → 静默回落 Helvetica
(无 CJK 字形)→ 中文全渲染为黑色方块。
Changes
compose.md§4: 整段替换为强制 CJK 协议SKILL.md: Common gotchas 新增 文档中分享页面或存在问题 #4 CJK 黑盒条目Verification
macOS 捆绑运行时(reportlab 4.2.5)实测: