fix: 修复行缘、切分还原与语言解析并同步文档

保留逐字 margin/jiya.bias 字体后备方案;补齐 demo 重排、量测边界说明及共享规则 1.0.1 反例向量。

验证:完整构建通过,Node 376 项、WKWebView 64 项及原生 demo 9 项通过;Firefox 仍暂缓。
This commit is contained in:
2026-10-03 21:15:54 +08:00
parent 024ad5da93
commit 3a4fa1c932
33 changed files with 983 additions and 140 deletions
+8 -2
View File
@@ -6,6 +6,10 @@
量各標點 glyph 之 ink bounding box,依墨色中心建議 left/center/right/full,並印出
可貼入 `options.jiya.bias` 之 JSON 片段。
只量預設 cmap glyph,未做 shaping、未應用 `locl`;語言參數僅選 JSON 的語言分類鍵,
不切換字型的語言字形。`halt` feature 存在也不保證涵蓋所有標點。建議表須按瀏覽器
實際字形逐字微調,尤其是會依語言替換 glyph 的字型。
依賴:fonttools(`pip install fonttools`)。
用法:python3 tools/measure-bias.py /path/to/font.ttf [zh-Hans|zh-Hant|ja|other]
@@ -26,7 +30,7 @@ from fontTools.ttLib import TTFont
# 聚珍 margin 模式會收半形之標點(句末點號僅半角式收,此處一併量供參考)。
PUNCT = {
"pause_stop": ",、。;:!?",
"pause_stop": ",、。.;:!?",
"open": "「『(《〈【〖〔[{“‘",
"close": "」』)》〉】〗〕]}”’",
}
@@ -75,8 +79,10 @@ def main():
halt = has_feature(font, "halt")
print(f"# 字型:{path}")
print(f"# OpenType halt:{'有(建議直接用 halt 預設模式,無需 margin 後備)' if halt else '無 → 需 margin 後備模式'}")
print(f"# OpenType halt:{'有(feature 存在不保證涵蓋所有標點,須逐字確認)' if halt else '無 → 可用 margin 後備模式'}")
print(f"# unitsPerEm={upm}")
print("# 量測預設 cmap glyph,未做 shaping/未應用 locl;語言參數僅選 JSON 分類鍵。")
print("# 請按瀏覽器實際字形逐字微調建議表。")
print()
table = {}