nfroidure/svgicons2svgfont

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

daniele-orlando opened this issue · 1 comments

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

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?