转换汉仪字体时报错
使用「字蛛」转换「汉仪菱心体简」字体时报错,报错信息如下:
Error: Offset is outside the bounds of the DataView
RangeError: Offset is outside the bounds of the DataView
at DataView.getUint8 (native)
at Reader.read (/usr/local/lib/node_modules/font-spider/node_modules/fontmin/node_modules/fonteditor-ttf/lib/ttf/reader.js:66:43)
at Reader.readUint8 (/usr/local/lib/node_modules/font-spider/node_modules/fontmin/node_modules/fonteditor-ttf/lib/common/lang.js:33:27)
at Table.readSimpleGlyf (/usr/local/lib/node_modules/font-spider/node_modules/fontmin/node_modules/fonteditor-ttf/lib/ttf/table/glyfcontour.js:75:32)
at Table.table.create.read (/usr/local/lib/node_modules/font-spider/node_modules/fontmin/node_modules/fonteditor-ttf/lib/ttf/table/glyfcontour.js:201:40)
at Table.table.create.read (/usr/local/lib/node_modules/font-spider/node_modules/fontmin/node_modules/fonteditor-ttf/lib/ttf/table/glyf.js:39:48)
at /usr/local/lib/node_modules/font-spider/node_modules/fontmin/node_modules/fonteditor-ttf/lib/ttf/ttfreader.js:68:75
at Array.forEach (native)
at TTFReader.read (/usr/local/lib/node_modules/font-spider/node_modules/fontmin/node_modules/fonteditor-ttf/lib/ttf/ttfreader.js:65:40)
at TTFReader.read (/usr/local/lib/node_modules/font-spider/node_modules/fontmin/node_modules/fonteditor-ttf/lib/ttf/ttfreader.js:161:29)
Node.js 版本为 v0.12.6,在 OS X 10 和 CentOS 6 上均重现。
@junmer
使用的字体文件是设计师给的,是公司买的授权的。在网上搜索下载的此字体版本也有同样的问题。
@aui 可以升级到 fontmin 0.8.1试试
已经更新 [email protected]
@aui @junmer 多谢,升级到 [email protected] 后问题已解决。
升级到目前的最新版后,转换这个字体报错:
error read glyf coordinates:1556520
但是字体文件的确生成了。
使用生成的字体,除 iOS 9 Public Beta 外均没有问题。
在 iOS 9 Public Beta 的 Safari 里,中文字体没事,数字部分,很奇怪,宽度大约是字符的两倍。见截图。
上图中,数字的 DOM 结构里没有任何空格,除 font-family 外也没用设置任何样式。
@liuweifeng
coordinates 是字型拐点的数量,fontmin 字型解析有一个上限
error read glyf coordinates:1556520
应该是某个 超级难写的字 字型没有解析,这里报一个错误,但不会影响整个字体的输出 所以,暂时可以不考虑,下个版本我们 改成 warn
宽度两倍
之前发现过类似问题,并改过
求 发一下字体文件 我们来查一下
唔,涉及版权的话可以发我邮箱
@junmer 多谢!字体文件已发到你的 foxmail 邮箱。
@liuweifeng
基本原因找到了,是由 kerning 引起的,我开个 https://github.com/ecomfe/fontmin/issues/21 列入开发计划,临时解决方案
<span>123456 </span>步
@junmer 多谢,测试可以。