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

Wrong grid used for iconset FontAwesome #15

Closed
Tklaversma opened this issue Aug 8, 2016 · 5 comments
Closed

Wrong grid used for iconset FontAwesome #15

Tklaversma opened this issue Aug 8, 2016 · 5 comments
Labels

Comments

@Tklaversma
Copy link

Tklaversma commented Aug 8, 2016

Before you compile icons, the icons are sized in a grid. For example 15x14. When compiled to SVG, this grid translates into a viewBox.

So, what I found out is that the viewBoxes for the FontAwesome icon library in your SVG are way bigger than my viewBoxes (mine is compiled manually outside this project, but we basically do the same thing).

Meaning your FontAwesome icons are not compiled from their original grid size, which is 15x14 for the FontAwesome icons. See here.

Now you are wondering, what does it matter or does it even matter....it does!
Why does it matter, I didn't found out yet, but using the wrong grid size results in icons not being shown completely when applying a font-size to it.

Let me explain / show you.


In order to size a SVG-icon with font-size (instead of apply an individual width and height to each icon), the following CSS must be applied.

svg:not(:root) {
    overflow  : hidden;
    ...
}

svg {
    display        : inline-block;
    fill           : currentColor;
    height         : 1em;
    position       : relative;
    stroke         : currentColor;
    stroke-width   : 0;
    width          : 1em;
}

// From hereon we can size SVG-icons by just applying a
// `font-size` to it, since the width and height is related
// to it by using `em`.

Now when I use the CSS above in combination with your SVG-icons (the wrong grid and therefor the viewBoxes), I see some icons not being shown completely. See example below:

SVG icon


How to fix this? Just apply the correct grid to each icon for each iconset before compiling.
Again, for FontAwesome the original grid size is 15x14.

@leungwensen leungwensen added the bug label Aug 8, 2016
@leungwensen
Copy link
Owner

@Tklaversma

Actually I started a PhantomJS process to render each icon to get they real size to build the viewBox attribute. I did this because I wanted to use icons from different vendors, and so that I removed pads around every icon.

So, the grid I am using now is the real size of each icon. I applied the style you offered here and did not found icons that were not correctly rendered. Can you provide screenshots for those icons not being shown completely to help me locate the problem?

@Tklaversma
Copy link
Author

@leungwensen

Can you provide screenshots for those icons not being shown completely to help me locate the problem?

I'll get on that later today. I'll update this post with the necessary screenshots and information.

@leungwensen
Copy link
Owner

@Tklaversma thank you

@Tklaversma
Copy link
Author

So I tried to recreate my issue, but for some reason I can't anymore. Did you do an update on your website? The reason I'm asking is because I used a newly generated svg-file of the FontAwesome icons..

Anyways, their seems to be no problem (anymore).
You may close this issue.

@leungwensen
Copy link
Owner

@Tklaversma I think the problem happened because you used the version before this commit f446903, in which I trimmed FontAwesome icons.

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

No branches or pull requests

2 participants