fix(cht):補齊 atlas 漏收字 —— 「登上二樓」的「樓」等 4 字顯示灰框 - #9
Open
laneser wants to merge 1 commit into
Open
Conversation
`tools/build_cjk_font.py` 的 `JSON_FILES` 漏掃 `dumps/maps_bilingual.json` 與 `dumps/location_types.json`,但 `tools/build_lookup.py` 兩份都有收。結果是這兩份 來源獨有的漢字「翻得出來卻畫不出來」—— 引擎對 codepoint >= 0x80 一律查 CJK atlas, 查無即畫灰框。 實際受影響 4 字(其餘字剛好被別的來源檔涵蓋): | 來源 | 缺字 | 可見症狀 | |---|---|---| | `maps_bilingual` | 樓 窩 謬 | 地城「登上二樓!」/「下至一樓!」的「樓」變灰框 | | `location_types` | 拼 | 進城型別字 | 修正: - `JSON_FILES` 補上 `location_types` 與 `maps_bilingual`,並加註解說明此清單必須與 `build_lookup.py` 的來源清單同步(日後新增 dumps/*.json 兩邊都要加) - 以 docker/Dockerfile.font 重烘三套 atlas(參數同 apply_cht.sh:Noto index 3 / size 22 / cell 24 / mode gray),字數 2023 → 2027 驗證:逐字確認 4 字在 Noto / Firefly 宋 / Kai 楷 三套中都有實際字圖(非「收了卻空白」), 非零像素數分別為 樓 318/258/231、拼 238/216/186、窩 275/215/196、謬 312/287/222。 引擎原始碼未動 —— 灰框是 atlas 查無此字的正常 fallback,毋須重生 cht-engine.patch, atlas 為執行期資料檔亦毋須重建執行檔。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
此 PR 修正「翻得出來卻畫不出來」的灰框問題:build_lookup.py 產生查表時會納入 location_types / maps_bilingual,但 build_cjk_font.py 烘 CJK atlas 時漏掃這兩份來源,導致 atlas 缺字(例如「登上二樓!」的「樓」)。
Changes:
tools/build_cjk_font.py的JSON_FILES補上location_types與maps_bilingual,使烘字來源與查表來源一致。- 在
JSON_FILES上方新增註解,明確記錄此清單需與tools/build_lookup.py同步,避免日後再度漏掃造成灰框。
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
問題
地城裡的樓層訊息「登上二樓!」/「下至一樓!」,「樓」字顯示為灰色方塊。
根因不是編碼、也不是翻譯缺漏,而是兩支建置工具的來源清單不同步:
tools/build_lookup.py:76-79產 en→zh 查表時,有收location_types與maps_bilingualtools/build_cjk_font.py:28-31烘 CJK atlas 時,JSON_FILES漏了這兩份引擎對所有 codepoint ≥ 0x80 一律查 CJK atlas,查無即畫灰框 —— 所以這兩份來源獨有的漢字會「翻得出來卻畫不出來」。
「登上二樓!」裡登、上、二都被別的來源檔涵蓋,只有樓是maps_bilingual獨有,因此只有那一格反灰,與回報現象吻合。影響範圍
把現行
assets/cjk_font.bin(2023 字)與兩份漏掃檔逐字對照,實際只缺 4 字:dumps/maps_bilingual.json樓窩謬dumps/location_types.json拼其餘 96 個字剛好都已被其他來源檔涵蓋,所以只有這 4 個會反灰。
修正
build_cjk_font.py的JSON_FILES補上"location_types", "maps_bilingual",並加註解說明此清單必須與build_lookup.py的來源清單保持同步(日後新增dumps/*.json時兩邊都要加),避免同類問題再犯。docker/Dockerfile.font重烘三套 atlas,參數完全比照tools/apply_cht.sh(Noto index 3 /--size 22/--cell 24/--mode gray)。字數 2023 → 2027。驗證
逐字檢查 4 個新字在三套字形中都有實際字圖(而非「收進 atlas 卻是空白」——AR PL 宋/楷字集較小,值得確認),統計非零像素數:
樓U+6A13拼U+62FC窩U+7AA9謬U+8B2C已在本機重建
u4cht/xu4-allegro並部署 Windows build 實測。不需要動的部分
cht-engine.patchassets/u4_cht.tab未變 —— 查表端本來就已收這兩份來源🤖 Generated with Claude Code