-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Is there any way to make icon edges stick to pixels? #78
Comments
how are you inserting in into the HTML? |
@NaridaL First I make a font file using svgicons2svgfont. Then I add a font-face rule to a CSS file: @font-face {
font-family: 'icons';
src: url("../fonts/icons.svg") format('svg');
font-weight: normal;
font-style: normal;
} Then describe the icons in the CSS file: .icon {
line-height: 1;
}
.icon:before {
font-family: 'icons';
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-style: normal;
font-variant: normal;
font-weight: normal;
text-decoration: none;
text-transform: none;
display: inline-block;
vertical-align: bottom;
}
.icon__4squares:before {
content: "\E001"
} And add an icon to a HTML code: <i class="icon icon__4squares"></i> |
This seems related: https://www.w3.org/Graphics/SVG/WG/wiki/Proposals/SVG_hinting#Pixel_snapping |
Looks interesting. Hope it will be implemented.
Yes. The icon becomes even more blurry:
This is not possible in my case. I have the icon in the text block aligned to center, and the text block has arbitrary width and content. |
Ensure you set up a sufficient font height, it often cause issues ti be under 1000. Otherwise, try to use TTFAutoHint: https://www.npmjs.com/package/gulp-iconfont#optionsautohint |
I use fontHeight equals 1024.
I actually use gulp-iconfont to convert the icons to a font. TTFAutoHint affects nothing on macOS and totally breaks the icons on Windows: |
I have an SVG icon which has the size 17x17px and is designed to be pixel-perfect. This is how it looks in an editor:
When I convert the icon to an SVG font and insert it to a HTML page (the icon has CSS style
font-size: 17px;
), the icon becomes blurred:It happens both on Windows and macOS. Sometimes the icon is rendered crispy, it depends on amount of text before the inline icon.
Is there any way to make the icon edges be sharp and crispy in the font?
The icon SVG:
The text was updated successfully, but these errors were encountered: