在使用svg2ttf插件时,如果用Adobe Illustrator编辑SVG,实际生成的是path,而插件本身仅支持已经被标准淘汰掉的glyph标签,所以,需要将插件的lib/svg.js文件修改下才能较好的支持path标签
下面是代码:
//修改第12行
//glyph.d = glyphElem.getAttribute('d').trim();
glyph.d = svgpath(glyphElem.getAttribute('d'))
.scale(1, -1)
.translate(0, fontInfo.ascent)
.toString();
//第160行
//_.forEach(fontElem.getElementsByTagName('glyph'), function (glyphElem) {
_.forEach(fontElem.getElementsByTagName('path'), function (glyphElem) {
否则即便你用起来,那个图形也是反的,扣了2个小时解决了。