nfroidure/svgicons2svgfont

Parsing error on path tag with transformation attribute

Closed this issue · 3 comments

Not sure if I should report this bug here or on gulp-iconfont, let me know if I should move it.

I'd like to report a regression bug regarding the parsing of path tag in latest gulp-iconfont (9.0.1). Through gulp-iconfont, I'm generating a font using a bunch of SVGs, among which there is the following one:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 327.66 500">
    <path 
         d="M393.62,500a20.22,20.22,0,0,1-15.54-7.28L250,339,121.92,492.72a20.22,20.22,0,0,1-35.75-12.94V20.22A20.22,20.22,0,0,1,106.39,0H393.61a20.22,20.22,0,0,1,20.22,20.22V479.78A20.22,20.22,0,0,1,393.62,500Z" 
         transform="translate(-86.17)"
     />
</svg>

Expected behavior

I'd expect my the SVG to be parsed since it's valid and working in gulp-iconfont@9.0.0

Actual behavior

Parsing fails with below error. Important note, the bug goes away when I specify the y param of transform="translate(-86.17)".

Error: Got an error parsing the glyph "wish-full": path must start with moveto.
at SAXStream.saxStream.on (<my_project>/node_modules/svgicons2svgfont/src/index.js:241:28)
at emitOne (events.js:115:13)
at SAXStream.emit (events.js:210:7)
at SAXParser.me._parser.(anonymous function) [as onopentag] (<my_project>/node_modules/sax/lib/sax.js:258:17)
at emit (<my_project>/node_modules/sax/lib/sax.js:640:35)
at emitNode (<my_project>/node_modules/sax/lib/sax.js:645:5)
at openTag (<my_project>/node_modules/sax/lib/sax.js:841:5)
at SAXParser.write (<my_project>/node_modules/sax/lib/sax.js:1308:13)
at SAXStream.write (<my_project>/node_modules/sax/lib/sax.js:239:18)
at PassThrough.ondata (<my_project>/node_modules/readable-stream/lib/_stream_readable.js:541:20)
at emitOne (events.js:115:13)
at PassThrough.emit (events.js:210:7)
at PassThrough.Readable.read (<my_project>/node_modules/readable-stream/lib/_stream_readable.js:386:26)
at flow (<my_project>/node_modules/readable-stream/lib/_stream_readable.js:734:34)
at resume_ (<my_project>/node_modules/readable-stream/lib/_stream_readable.js:717:3)
at _combinedTickCallback (internal/process/next_tick.js:138:11)

Debugging informations

  • node -v result:
v8.5.0
  • npm -v result:
5.3.0

No, here looks appropriate. I'll have a look now.

@htulipe I've fixed it and updated gulp-iconfonts. Please check if it works.

Looks great @NaridaL. Thanks for the quick action.