mirror of
https://github.com/2234839/web-font.git
synced 2026-09-04 23:02:27 +08:00
subset 模式下 simple 字形走原始字节快路径([[glyf-origbytes-fastpath]]),完整保留 原始 hinting instructions。但 web 渲染场景浏览器用 autohint,原始 instructions 不参与 渲染——实测剥离后所有基准用例 SSIM 与 ink 逐位一致(含最敏感的小字号用例)。 read 快路径定位 instructionLength(紧接 endPtsOfContours,OpenType 规范布局,无需展开 flags),存 _instrOff/_instrLen。write 快路径跳过 instructions 段并写 instructionLength=0, sizeof 同步扣减字节长度。_instrOff=-1(无 instructions)走原整段拷贝路径。 收益(SSIM 全不变): - FiraCode woff2 10776→8892(-17.5%),端到端 avg 1.92→1.68ms(-12.5%) - 千字文 woff2 79784→79736,ttf 体积同步减小 - CJK 字体(初夏/霞鹜/思源)instructions 极少,体积持平 brotli 是 write 阶段硬下限,减小 glyf 原始字节直接减小 brotli 输入与输出。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>