Closed hdodov closed 4 years ago
I managed to get an even more minimal example with a simpler shape. I used svg-path-parser to make the paths more readable.
Working:
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.22666 12.42L0.333336 6.50001L8.1419 0.643585L12.7687 5.93137L8.22666 12.42ZM8 11L11.5 6.00001L8 2.00001L2 6.50001L8 11Z" fill="black"/>
</svg>
0: Object {code: "M", command: "moveto", x: 8.22666, y: 12.42}
1: Object {code: "L", command: "lineto", x: 0.333336, y: 6.50001}
2: Object {code: "L", command: "lineto", x: 8.1419, y: 0.643585}
3: Object {code: "L", command: "lineto", x: 12.7687, y: 5.93137}
4: Object {code: "L", command: "lineto", x: 8.22666, y: 12.42}
5: Object {code: "Z", command: "closepath"}
6: Object {code: "M", command: "moveto", x: 8, y: 11}
7: Object {code: "L", command: "lineto", x: 11.5, y: 6.00001}
8: Object {code: "L", command: "lineto", x: 8, y: 2.00001}
9: Object {code: "L", command: "lineto", x: 2, y: 6.50001}
10: Object {code: "L", command: "lineto", x: 8, y: 11}
11: Object {code: "Z", command: "closepath"}
Not working:
<svg width="19" height="13" viewBox="0 0 19 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.361 12.2281L0.358917 6.50002L14.2823 0.804077L18.7687 5.93137L14.361 12.2281ZM14 2.00002L17.5 6.00002L14 11L3 6.50002L14 2.00002Z" fill="black"/>
</svg>
0: Object {code: "M", command: "moveto", x: 14.361, y: 12.2281}
1: Object {code: "L", command: "lineto", x: 0.358917, y: 6.50002}
2: Object {code: "L", command: "lineto", x: 14.2823, y: 0.804077}
3: Object {code: "L", command: "lineto", x: 18.7687, y: 5.93137}
4: Object {code: "L", command: "lineto", x: 14.361, y: 12.2281}
5: Object {code: "Z", command: "closepath"}
6: Object {code: "M", command: "moveto", x: 14, y: 2.00002}
7: Object {code: "L", command: "lineto", x: 17.5, y: 6.00002}
8: Object {code: "L", command: "lineto", x: 14, y: 11}
9: Object {code: "L", command: "lineto", x: 3, y: 6.50002}
10: Object {code: "L", command: "lineto", x: 14, y: 2.00002}
11: Object {code: "Z", command: "closepath"}
https://github.com/fontello/fontello/wiki/How-to-use-custom-images
You need to remove all "fill*" attrs and make contours properly oriented instead.
@puzrin I tried that, but I still get an incorrect icon. I'm exporting it from Figma, though. The exact steps I'm doing are:
I can see there's a guide for exporting from Inkscape and Illustrator. Maybe you could add one for Figma? It has turned pretty mainstream. They recently launched support for plugins too. Perhaps there could be a plugin that fixes paths, or even one that directly generates fonts from layers? That would be so cool.
Sorry, can't consult about Figma. This is just a convertor, it needs correct input svg font. If font is correct, result will be correct.
I'm using svg2ttf via @vusion/webfonts-generator via webfonts-loader via Webpack.
I noticed one icon wasn't being generated correctly and started digging. I managed to create two visually identical icons with different paths, but one is displayed correctly in the font and one isn't.
These are direct exports from Figma:
arrow-good.svg
arrow-bad.svg
There are obvious differences in the paths, but I don't know what exactly they represent. I just played around and drew a bunch of arrows until one of them started to work. My guess is that it has something to deal with the direction in which they're drawn.
This is a screen capture from the rendered glyphs in the browser:
The version of svg2ttf is
4.3.0
and the same issue happens if I drag and drop the SVG files in the online Fontello generator itself.