Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
daniele-orlando opened this issue Nov 27, 2017 · 1 comment
Assignees

Comments

@daniele-orlando
Copy link

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

@daniele-orlando daniele-orlando changed the title Fails to detect the right size when SVG height and width are in percentage Fails to detect the right size when SVG height and width are expressed in percentage Nov 27, 2017
@NaridaL NaridaL self-assigned this Dec 1, 2017
@NaridaL
Copy link
Collaborator

NaridaL commented Dec 4, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants