fontello / svg2ttf

SVG -> TTF font convertor
MIT License
518 stars 79 forks source link

Invalid TTF font generated with Node 10 #72

Closed Th3S4mur41 closed 6 years ago

Th3S4mur41 commented 6 years ago

TTF generated with the same settings and same SVGs works fine when generated with Node 8 (see fonts.zip)

puzrin commented 6 years ago

This statement looks suspicious. I can't imagine how files of different size can be generated. The only difference is TTF timestamp, if you don't use special option.

Could you create a minimal test repo for reproducible run, to prove your case?

Th3S4mur41 commented 6 years ago

Here is an example https://github.com/Th3S4mur41/invalid-ttf-node10 including the output under dist/node10 and dist/node8

You'll notice that the node10 folder is missing the .woff, the .less and the demo file because the task fails with the error below. The .woff file cannot be generated based on the invalid .ttf file.

invalid-ttf-node10\node_modules\ttf2woff2\jssrc\ttf2woff2.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.has
OwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof proce
ss==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS
_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var no
deFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](fi
Checksum error in glyf

This was tested on both a Windows 10 machine and a Mac. When trying to open the .ttf file generated with node10, you get the the following error: bad font

puzrin commented 6 years ago

That's a bit noizy. Could you drop everything, and leave only:

  1. svg FONT (not separate image)
  2. list of CLI calls for convertors (run svg2ttf with --ts 0 to freeze timestamps and get binary equal results), without grunt.

TTF files must be the same (proof: fontello use node 10 and it's fine).

I suppose, your problems may be related to ttf2woff2. It's very buggy (if it fails to compile C sources, it fallbacks to buggy JS version, transpiled with old emscripten). Use this one instead https://github.com/fontello/wawoff2.

Th3S4mur41 commented 6 years ago

Issue has been fixed in grunt-webfonts. Thanks