Skip to content

fix(cht):補齊 atlas 漏收字 —— 「登上二樓」的「樓」等 4 字顯示灰框 - #9

Open
laneser wants to merge 1 commit into
wicanr2:mainfrom
laneser:fix/cjk-atlas-missing-glyphs
Open

fix(cht):補齊 atlas 漏收字 —— 「登上二樓」的「樓」等 4 字顯示灰框#9
laneser wants to merge 1 commit into
wicanr2:mainfrom
laneser:fix/cjk-atlas-missing-glyphs

Conversation

@laneser

@laneser laneser commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

問題

地城裡的樓層訊息「登上二樓!」/「下至一樓!」,「樓」字顯示為灰色方塊

根因不是編碼、也不是翻譯缺漏,而是兩支建置工具的來源清單不同步:

  • tools/build_lookup.py:76-79 產 en→zh 查表時,location_typesmaps_bilingual
  • tools/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 進城型別字(castle / towne / village / ruins)

其餘 96 個字剛好都已被其他來源檔涵蓋,所以只有這 4 個會反灰。

修正

  1. build_cjk_font.pyJSON_FILES 補上 "location_types", "maps_bilingual",並加註解說明此清單必須與 build_lookup.py 的來源清單保持同步(日後新增 dumps/*.json 時兩邊都要加),避免同類問題再犯。
  2. docker/Dockerfile.font 重烘三套 atlas,參數完全比照 tools/apply_cht.sh(Noto index 3 / --size 22 / --cell 24 / --mode gray)。字數 2023 → 2027
glyphs: 2027  cell 24x24  → assets/cjk_font.bin (1175676 bytes)
glyphs: 2027  cell 24x24  → assets/cjk_font_firefly.bin (1175676 bytes)
glyphs: 2027  cell 24x24  → assets/cjk_font_kai.bin (1175676 bytes)

驗證

逐字檢查 4 個新字在三套字形中都有實際字圖(而非「收進 atlas 卻是空白」——AR PL 宋/楷字集較小,值得確認),統計非零像素數:

Noto Firefly 宋 Kai 楷
U+6A13 318 258 231
U+62FC 238 216 186
U+7AA9 275 215 196
U+8B2C 312 287 222

已在本機重建 u4cht/xu4-allegro 並部署 Windows build 實測。

不需要動的部分

  • 引擎原始碼未改 —— 灰框是 atlas 查無此字的正常 fallback,行為本身正確,毋須重生 cht-engine.patch
  • 毋須重建執行檔 —— atlas 是執行期讀的資料檔
  • assets/u4_cht.tab 未變 —— 查表端本來就已收這兩份來源

🤖 Generated with Claude Code

`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>
Copilot AI review requested due to automatic review settings August 2, 2026 10:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

此 PR 修正「翻得出來卻畫不出來」的灰框問題:build_lookup.py 產生查表時會納入 location_types / maps_bilingual,但 build_cjk_font.py 烘 CJK atlas 時漏掃這兩份來源,導致 atlas 缺字(例如「登上二樓!」的「樓」)。

Changes:

  • tools/build_cjk_font.pyJSON_FILES 補上 location_typesmaps_bilingual,使烘字來源與查表來源一致。
  • JSON_FILES 上方新增註解,明確記錄此清單需與 tools/build_lookup.py 同步,避免日後再度漏掃造成灰框。

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants