崮生(子虚) ce893976f1 perf(cmap): subset 模式复用 probe 的 codepoint→gid 映射跳过二分查找
Font.create 内 readWindowsAllCodes 在 subset 模式下对每个 subset 字符做
lookupFormat4/lookupFormat12 二分查找产出 codepoint→gid,这与之前 probeGsubAndCmap
的 probe.lookup(算法一致)完全重复。subset 模式下 format0/format14 不解析
(glyphIdArray/groups 为空),codes 仅来自 format4/12,故 probe.lookup 与
readWindowsAllCodes 产出严格等价。

fontSubset 在 probe.ok 时将 probe.lookup(Map)转为普通对象经 readOptions.presetCmap
注入,readWindowsAllCodes 检测到 presetCmap 直接返回,跳过 N 次(subset 长度)二分查找。

收益(best-of Font.create):千字文 -10.2%、初夏纯标点 -5.5%、FiraCode -3.7%
(与 subset 长度成正比,每 codepoint 省一次二分)。5 字体 woff2 sha 逐字节一致,
SSIM 全部不变。probe 不 ok(otf 或无 format4/12)时不注入,走原逻辑。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-24 20:25:03 +08:00
..
2026-04-08 22:05:17 +08:00
2024-08-19 18:10:09 +08:00