-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Refine creation process #24
Comments
Commit 8010dc9 adds my hand-made SVG template. Includes definitions for all our gradients, as well. Generating script should need to do the following:
That last one's a bit of doozy when talking about fitting the shapes to the text, and we'll have to find a way to determine how much space the text will take up... /cc @olivierlacan |
I've been slacking good sir. Can we pair on the script using ScreenHero this week end or on Friday afternoon? |
No worries, I've been a bit distracted too. Sure, you know where to get a hold of me, so just let me know when you've got the time and we'll work something out. |
This project excited me enough that I spent this morning writing a small script that generates badges dynamically: It's written in Python and requires Cairo and lxml. Try it out:
|
You can see in my screenshot that the text drop shadow is missing. That's because CairoSVG doesn't support filters, and it's not likely to be ever supported. |
@mgedmin This is awesome, thanks so much for making it. 😸 With the limitations you mentioned we might not be able to use it for our purposes but it's a fantastic proof of concept. Is it me or does the font look different too? Different rendering option? |
Could just be Cairo's SVG rendering. Could also be a side effect of the filters (even though Cairo doesn't render them, it could still be making the text look thin like that). Like I mentioned the other day if that becomes a problem we could just fall back to using 2 text nodes instead of the filter. The interesting part there is the determining of the width the paths need to be, which looks like he's doing it by having Cairo render the desired text into an empty image and returning the width from that. I think we can do that with IMagick too, though I'm not super familiar with it. |
The font rendering noticeably differs when I switch between PNG and SVG options, but I'm not sure why. Different hinting options? Different layout engine? I see that CairoSVG uses the "toy" text_path API instead of integrating Pango properly. I currently determine the text width by using Cairo's text_extents. It exactly matches CairoSVG's rendering, but fails to match native browser SVG rendering in some cases, which results in the text being cut off: Meanwhile Inkscape renders the same SVG file as I'll try ImageMagick next. |
@mgedmin Take a look @ https://github.com/olivierlacan/shields/issues/15. afeld managed to create a pretty near-perfect replica using ImageMagick, with its default SVG renderer. The template SVG I made was changed from the one he used there, so if you follow that perfectly and it still breaks then it probably has to do with the things I've changed in the new SVG. Could be that ImageMagick doesn't support the text shadow filters and causes mass breakage? Not sure why else the gradient could be broken, it worked with afeld's method, and I can see it at least recognizes the defs element so it should be rendering them correctly. Also, I know ImageMagick does support transparent backgrounds, though I don't know off hand how you'd make it do so. |
I can try again with the new SVG this weekend, if that would help. |
This is awesome. I need to make 100+ badges, and was futzing about with imagemagick text annotations on base image files, but the svg method is much more elegant. Is the template the start of the art at the moment? How can I help or use the latest and greatest generation technique (the @afeld process from #15 seems to be the way, but with the updated template from @ackerdev - true?) |
I'm still dedicated to doing a script and/or service to do this. Will try to work on it tonight. |
ok - I'll focus on other things, but if I can help at all, at least testing, let me know. |
We're (slowly) working on creating a gem to completely automate this process (#27). @kookster I'm not quite completely sure whether the new template svg will work 100% properly–I changed some things from the Illustrator SVGs that made more sense, but could cause it to render strangely in some cases, and I haven't had a chance to test that out yet. I would suggest testing it out on one first. Also be sure to move & resize the background to fit the text width. Sorry, shields is in a bit of a transitional state and it's hard to get up and running to create your own badge set right now... If you want, I can help you out with generating your badges and making sure that they are up to spec. |
you guys are great, no apologies pls. I'll try the svg stuff, invest some more of my own time, and we'll have a friendly race; either I'll figure it out, or you and @afeld will finish the gem ;) |
How does this ticket relate to #15? |
Most of this discussion has moved over to #15. |
AKA "Free as in Freedom" the shit out of the shield creation process.
To both remove the need for proprietary tools like Photoshop and Illustrator, and to automate the creation of new badges, we should do the following:
Remove illustrator noise, use semantic class names for easy node manipulation. Make note of gradients for automation in the generator script.
Nokogiri to parse SVG XML. Make it easy to define the required badges that will be generated. See https://github.com/olivierlacan/shields/issues/15#issuecomment-13878052 for a guide to convert the SVGs to PNGs using imagemagick
The text was updated successfully, but these errors were encountered: