mirror of
https://github.com/2234839/web-font.git
synced 2026-09-04 23:02:27 +08:00
woff2 重新编码,不消费 TTF directory 的 per-table checksum 与 head.checkSumAdjustment(encodeTTFToWOFF2 只读 directory 的 tag/offset/length, 重建自己的 directory)。TTFWriter 加 skipCheckSum 选项,font.write 的 woff2 分支传入,跳过 checkSumArrayBuffer 调用 + directory 回填 + head adjustment。 node --prof 思源 3500 字大字集:checkSumArrayBuffer 5.1%(JS nonlib 第二大) 从热点列表消失。端到端 min -2%(brotli 主导稀释收益),但消除的是语义上 纯无用的计算(被 woff2 丢弃)。head.checkSumAdjustment 保持 0 占位(resolveTTF 已置 0),浏览器渲染不依赖该字段。 ttf 直出(消费 directory checksum)与 woff(ttf2woff 读 directory checksum 写 WOFF 表目录)分支不受影响,仅 woff2 生效。 基准测试全 SSIM 与历史固有值一致(FiraCode 0.9923/初夏纯标点 0.9920/篆体 0.9876 等),woff2 输出字节 IDENTICAL(思源千字文中段 17052/FiraCode 8892/ 霞鹜 3840/初夏 6164/6864/得意黑 2532/1628)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>