What i use for the drawbot plugin to save as SVG
from robofab.world import CurrentFont, RGlyph
import GlyphsApp
height = 700
margin = 200
minMargin = 0
font = CurrentFont()
layers = GlyphsApp.Glyphs.font.selectedLayers
Scale = float(height) / float(font.info.unitsPerEm)
for l in layers:
g = RGlyph(layer=l)
print(g.name)
minX, minY, maxX, maxY = g.box
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)
scale(Scale)
drawGlyph(g)
saveImage("export/" + g.name + ".svg")