KonghaYao / cn-font-split

划时代的字体切割工具,CJK与任何字符!支持 otf、ttf、woff2 字体多线程切割,完美地细颗粒度地进行包大小控制。A revolutionary font subetter that supports CJK and any characters! It enables multi-threaded subset of otf, ttf, and woff2 fonts, allowing for precise control over package size.
https://chinese-font.netlify.app/
Apache License 2.0
421 stars 15 forks source link

Firefox提示maxZone:0 #74

Closed kkdaisuki closed 1 month ago

kkdaisuki commented 1 month ago

现行css模板在firefox下会提示downloadable font: maxp: Bad maxZones: 0。参见https://github.com/ecomfe/fontmin/issues/83#issuecomment-1143771799。

去除https://github.com/KonghaYao/cn-font-split/blob/911b85d6ec11fb515cc6715eae2f80f35f4dfaa2/packages/subsets/src/templates/css.ts#L75 中间的空格应当即可解决。

KonghaYao commented 1 month ago

您好,感谢您的提示。这个 issue 需要有具体的字体及环境复现,可以的话,请提供一下哈 @KanbeKotoriDaisuki

kkdaisuki commented 1 month ago

字体:资源圆体TTC全字符 环境:vite插件下

{
  renameOutputFont: "[hash][ext]",
  chunkSize: 1000 * 1024,
  chunkSizeTolerance: 1.5,
  testHTML: true,
}
kkdaisuki commented 1 month ago

字体:资源圆体TTC全字符 环境:vite插件下

{
  renameOutputFont: "[hash][ext]",
  chunkSize: 1000 * 1024,
  chunkSizeTolerance: 1.5,
  testHTML: true,
}

不过开不开输出样例html文件是一样的就是了

KonghaYao commented 1 month ago

@KanbeKotoriDaisuki

  1. TTC 默认是不会被 cn-font-split 解析的。因为 ttc 内部有多个 ttf,cn-font-split 没有内置的解析器。
  2. 如果你需要解析 TTC,那么可以用这个平台转换一下 https://transfonter.org/ttc-unpack
  3. 关于 FireFox 的 maxZone:0 问题属于 FireFox 84 的问题,在 128 等版本不会有此 BUG。并且考虑到低版本 FireFox 的市场占有率,估计不会进行修复。 image
kkdaisuki commented 1 month ago

我实际使用的是cn版本各个字重的ttf,上面打错了。我测试用的环境是firefox 128.0,不排除是更新把老bug又刷出来了。

KonghaYao commented 1 month ago

感谢 5.1.1 版本修复了在 firefox 的这个 BUG!@KanbeKotoriDaisuki