PNG / SVG Export

You can do this already.

You can use the “Glyph as Image” filter.

Georg … Did you ever get a chance to change it to be useful for icon collections? I have one with about 300 icons I would like to get as SVG files. Is there a way a script could help with that if you haven’t?

Select them, set the category to Icon (Edit > Info for Selection), run the filter.

Or what exactly do you mean by useful for icon collections? What are you trying to do which you cannot achieve? The UI and the way it works now is not perfect but we’ve been using it for icons already.

mekkablue - Thanks for the reply. I was referring to a comment Georg made in another thread that they would try to make it work better for collections of icons or something to that effect. It was a vague comment so I didn’t know what he meant by that. In my case the issue is with 300+ icons, it’s a lot of work to have to convert between exporting as a font and individual SVG images, and I need it as both. Some of the images are used in a context where a font is appropriate and others I need to migrate to SVG images.

I was able to successfully export SVG images that I drew in Adobe Illustrator years ago before I dumped it because I didn’t want to pay the subscription model. I just assumed I could even do my SVG art in the Glyphs 3 App rather than have to draw the same images in multiple apps.

But even SVG is not working right, as the SVG is not rendering in other vector editing apps. They are completely confused by the SVG being exported by Glyphs 3.

Thank you for all the background. But: How can we help you now? What do you want to do? And what keeps you from it?

RE: mekkablue … The following post describes what I want to do and what is not working for me:

I have a font of over 350 glyph (icons). I need to be able to break my artwork out of the font into SVG in order to piecemeal it out for specific purposes, without having to distribute the font itself, and I don’t know how I can do that, since exporting SVG from Glyphs 3, with “Filter As Image”, isn’t producing SVG that anything seems to be able to render properly.

And the other issue is that with so many glyphs, it is tedious to have to manually export them one by one. And also, I’m not sure if that flips a switch that causes them not to be exported into the font.

I really need this and would appreciate any guidance I can get for extracting those icons into SVG either your code, 3rd party code or guidance on how I could write some code to do it. If you know of any tools or techniques I’d really appreciate the tips!

Can you send me some samples where the svg export is not rendering well.

I’m working on a but better system to handle icons. But it will take a while until I can release it. Until then, use “Glyph as Image” (when I have fixed it). Or write a drawbot script that exports the whole font as individual svgs. That way, you have much more control over the details (but last time I checked, the svg from drawbot are less compact, so the file size will be bigger).

I noticed as I was cutting and pasting images for you and SVG exported data that the ones that didn’t render had the different kind of handles. One of them I just selected and converted to cubic and now it renders! Yay! Hopefully that’s the only issue because it gives me a workaround, which right now is a lifesaver.

1 Like

That were quadratic TrueType outlines. For batch-converting, you can select all glyphs in Font view and choose Path > Other > Convert to Cubic and outlines should be PostScript curves again.

I’ll have a look and see if I can come up with a snippet for batch exporting SVGs.

@GeorgSeifert shall we add an export warning? Something like ‘Quadratic curves cannot be converted reliably into SVG, consider converting them to cubic.’

OK, here is a snippet you can paste in Window > Macro Panel. Select the glyphs and run the code from the macro window. It will prompt you for a folder and then store the SVGs with glyph names and an .svg suffix:

from AppKit import NSSize
GlyphAsImage = NSClassFromString("GlyphAsImage")
folder = GetFolder(allowsMultipleSelection=False)
if folder:
	folderURL = NSURL.fileURLWithPath_(folder)
	for layer in Font.selectedLayers:
		preset = {
			"active": True,
			"name": "SVG",
			"size": layer.ascender,
			"factor": 1,
			"format": "SVG"
		layerSize = NSSize(layer.width, layer.ascender)
		svgData = GlyphAsImage.svgDataWithLayer_origSize_settings_(layer, layerSize, preset)
		svgFileName = + ".svg"
		svgURL = folderURL.URLByAppendingPathComponent_(svgFileName)
		svgData.writeToURL_atomically_(svgURL, False)

(edit by @GeorgSeifert: I simplified the code a bit)

1 Like

Hey, thanks!!

I am trying to figure out how to get SVG from GSinstance instead of selectedLayers.
I guess trying to use the filter will not work. Right?

Which direction should I look for?

Interpolate the layers and pass them through this one by one. Best to use an export plug-in.

1 Like

To get an interpolated layer:

instance = Font.instances[1]
interpolatedFont = instance.interpolatedFontProxy
interpolatedGlyph = interpolatedFont.glyphs["A"]
interpolatedLayer = interpolatedGlyph.layers[0]
1 Like

Hi Mekka,
Can I get a script that export the selected glyphs as png images?

  1. I need to be able to select the image size (for example 512x512, or 716x716, or whatever)
  2. I need to be able to draw a rectangle to represent the bbox
  3. Ideally, a small line to represent also the baseline and the xheight (just a tiny little short line, for example from 0,0 to 0,10 on the baseline)

It all need to be centered inside the png image, having a little 10px margin arround it.
If you need more detail, get in touch with me via Skype.


Why don’t you use DrawBot for this? You can use DrawBot straight from within Glyphs.

You can do that natively from Glyphs. Take a look at the PS and EPS export plugins.

What i use for the drawbot plugin to save as SVG

from import CurrentFont, RGlyph
import GlyphsApp

height = 700
margin = 200
minMargin = 0

font = CurrentFont()
layers = GlyphsApp.Glyphs.font.selectedLayers

Scale = float(height) / float(

for l in layers:
    g = RGlyph(layer=l)

    minX, minY, maxX, maxY =
    extraSpace = 0
    offset = 0
    offsetY = 0
    offsetX = 0

    extraSpace *= Scale
    offset *= Scale
    width = margin + (g.width * Scale) + margin + extraSpace
    newPage(width, height + (2 * margin))

    # Draw transparent square
    fill(0, 0, 0, 0)  # Set fill color with alpha (0 for transparency)
    rect(0, 0, width, height + (2 * margin))

    fill(0, 0, 0)  # Set fill color to black
    translate(margin + offsetY, margin + offsetX)

    saveImage("export/" + + ".svg")
1 Like

I tried this macro panel script on glyphs/shapes that are using Native Color gradients, but most colors came out as flat colors, some with slight gradient (not same as design). Is it possible to retain the gradient data for the exported SVGs? Thanks! :slight_smile:

Update: I used picosvg to do the job instead