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

Copy as SVG #49

Open
grimen opened this issue Dec 7, 2015 · 7 comments
Open

Copy as SVG #49

grimen opened this issue Dec 7, 2015 · 7 comments

Comments

@grimen
Copy link
Contributor

grimen commented Dec 7, 2015

Would be neat to be able to copy an icon as SVG.

@grimen
Copy link
Contributor Author

grimen commented Dec 8, 2015

Relevant: Client-side string compression library that could be used for fast compression of icon SVG markup, and fast uncompression on copy: https://github.com/pieroxy/lz-string

@thomaspark
Copy link
Owner

This should be doable. All of the font libraries have SVG. The main hurdle I see is material-design-icons, where files are organized into different category folders. Might be tricky to find the relevant SVG file to grab the markup.

It didn't cross my mind that copying SVG would be useful. Curious what your use case is for it?

@grimen
Copy link
Contributor Author

grimen commented Dec 14, 2015

@thomaspark Yes. Well I in a few occasions prefer SVG, especially when hacking around - but specific use cases are multi-color and animated icons. I also recently posted about GlyphSearch in a active developer forum and the biggest critique against Webfonts - and implicitly the lack of support in GlyphSearch - was that many prefer SVG for various reasons in modern browsers nowadays. There seem to be a ~50/50 opinion on this one.

A few articles on the topic:

I am interested in looking into adding the support, but wanted to anchor it first.

@grimen
Copy link
Contributor Author

grimen commented Dec 31, 2015

@thomaspark Did a first pass of a little JS script that when needed load and convert SVG Font-Face/Glyphs to SVG Paths, and ability to lookup icon by unicode value:

Screenshot

As you mention material-design-icons is a special case (which I will be looking into more), but for the ~40-50 icon font sets i listed that's the only project that have this problem I think it would be a great feature, especially as it is mostly a plugin - only need to add the copy-button for SVG that calls the svg-path-by-unicode method.

Will try to figure out address material-design-icons-issue before I create a pull request.

@grimen
Copy link
Contributor Author

grimen commented Dec 31, 2015

I tried ttf2svg (https://github.com/qdsang/ttf2svg) for material-design-icons and it worked perfectly fine. I suggest adding it to postinstall build step of bower.json (a best practice in these cases for bower and npm).

Picture or it didn't happen:
Screenshot

Sidenote: In fact I would suggest moving away from bower in favor of npm as that is the trend I see happening lately, everything is ending up in both places but the vision of npm is more grand.

@grimen
Copy link
Contributor Author

grimen commented Jan 2, 2016

Repository for SVG conversion example/sandbox: https://github.com/grimen/svg-fontglyphs2svg

@grimen
Copy link
Contributor Author

grimen commented Jan 6, 2016

For the record:

Issue: google/material-design-icons#149
Pull Request: google/material-design-icons#282

Should be merged soon so material-design-icons will have an SVG font bundled soon.

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