GSPen Problem?

Hi all,

It seems there is a problem with robofab and the GSPen.

I tried to use a part of a script to get svg coordinates.
(from: fontinspector.py; function svg().
See here: https://github.com/urtd/fontinspector/blob/master/fontinspector.py)

works fine with ‘pure’ glyphs, but prints an error when use it for components …
(Also the original foninspector-script crashes here)

Is this a GSPen Problem? How to fix this?
(I have the latest Glyphs2, OSX and GSPen, objectsGS)

The snipped of the (modified) code is here:

---- CODE-SNIPPED: ----

font=CurrentFont()
g = font[g]

if len(g.components):
font.newGlyph(‘svg’)
new = font[‘svg’]
new.width = g.width
new.appendGlyph(g) #doesnt work
new.decompose()
g = new

---- ERROR-MESSAGE: ----

Traceback (most recent call last):
File “”, line 28, in
File “/Folder/RoboFab/RoboFab/Lib/robofab/objects/objectsBase.py”, line 1521, in appendGlyph
aGlyph.drawPoints(pen)
File “/Folder/RoboFab/RoboFab/Lib/robofab/objects/objectsBase.py”, line 1506, in drawPoints
c.drawPoints(pen)
File “/Folder/RoboFab/RoboFab/Lib/robofab/objects/objectsBase.py”, line 2760, in drawPoints
pen.addComponent(self.baseGlyph, (sX, 0, 0, sY, oX, oY))
File “/Users/Library/Application Support/Glyphs/Scripts/GSPen.py”, line 76, in addComponent
if isinstance(name, “RGlyph”):
NameError: global name ‘name’ is not defined

Are you trying to append a glyph to a glyph?

This is the way the script does … So, yes append glyph?!

But i would do it the ‘glyphs’ way. Im was confused because also the original script has this error…

What exactly are you trying to do? A decomposed copy of one particular glyph?

I am not fluent in RoboFab anymore, but could help you get it done in the glyphsapp API.

I fixed the problem. Please get the update from github

Thank you mekka/georg

Yes i would like to have decomposed copy of component.

First i will check georgs update.
Also i will try do it with glyphs api on my own (as an exercise)

When i transgix i will post again. Much thanks again.

I had downloaded the latest GSPen.py from Github.

But now there is a new Error:

Traceback (most recent call last):
File “”, line 39, in
TypeError: appendGlyph() takes at least 2 arguments (1 given)
Traceback (most recent call last):
File “”, line 39, in
File “/Folder/RoboFab/RoboFab/Lib/robofab/objects/objectsBase.py”, line 1521, in appendGlyph
aGlyph.drawPoints(pen)
File “/Folder/RoboFab/RoboFab/Lib/robofab/objects/objectsBase.py”, line 1506, in drawPoints
c.drawPoints(pen)
File “/Folder/RoboFab/RoboFab/Lib/robofab/objects/objectsBase.py”, line 2760, in drawPoints
pen.addComponent(self.baseGlyph, (sX, 0, 0, sY, oX, oY))
File “/Users/Library/Application Support/Glyphs/Scripts/GSPen.py”, line 76, in addComponent
if isinstance(baseName, “RGlyph”):
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types

mhhh