nfroidure / svgicons2svgfont

Concatenate SVG icons and ouput an SVG font
http://nfroidure.github.io/svgiconfont/
MIT License
339 stars 71 forks source link

Fails to detect the right size when SVG height and width are expressed in percentage #80

Open daniele-orlando opened 7 years ago

daniele-orlando commented 7 years ago

This works as expected

<svg width="64" height="64" viewBox="0 0 64 64" ...>
    ...
</svg>

This too

<svg viewBox="0 0 64 64" ...>
    ...
</svg>

But this doesn't

<svg width="100%" height="100%" viewBox="0 0 64 64" ...>
    ...
</svg>

normalize: true and fontHeight: 1000 didn't help.

Photoshop and Affinity Designer exports with the width and height expressed in percentage.

schermata 2017-11-27 alle 20 39 54 schermata 2017-11-27 alle 20 40 31
NaridaL commented 6 years ago

I'm not sure what sensible behavior is in this case is. What happens if you have one icon width="120" and one icon width="100%"? Or even one with em? Currently the code seems to assume that everything all widths/heights are simple integers.

Throw an error if there are different units? Convert x% to simply x ? Require fontHeight to be set for % units and transform x% => x / 100 * fontHeight?

@daniele-orlando you are sure it's not possible to have Photoshop output width/heights as ints?

@nfroidure any idea?