Robofab Pens in Glyphs

Will the following Robofab script work in Glyphs? I’m trying to talk a fellow font designer into switching to Glyphs, and my Robofab isn’t working on my machine.

from robofab.world import *
from robofab.pens.filterPen import thresholdGlyph
 
d = 10
thresholdGlyph(CurrentGlyph(), d)

If it doesn’t work would there be a Glyphs equivalent to this script?

Robofab does work in Glyphs. You have to install the wrapper script from github in particular the objectsGS.py.

I needed to fix a view things but now the script runs fine.
There might be some more issues, I did not had many testers for it. I’m happy to improve on that.

Not every script that was written for RoboFab in FontLab does work as there where many hacks to get it to work in FontLab and those do not work in Glyphs.

Thank you kindly for the info!

Best,
Dathan

This threshold pen was working for me for the longest time however it isn’t working anymore, I can run it on a single glyph but it doesn’t work globally. Also it removes all counter paths. Is there any changes that could be made to make it run globally for all glyphs in a font file?

#MenuTitle: Threshold 11

from objectsGS import *
from robofab.world import CurrentFont
from robofab.pens.filterPen import thresholdGlyph

d = 11

Glyphs.clearLog()
f = CurrentFont()
selection = f.selection

for glyph in selection:
	print "Filtering", glyph
	g = f[glyph]
	thresholdGlyph( g, d )
	
print 'All done filtering the selected glyphs!'

What error message do you get?

Start
Filtering A
Traceback (most recent call last):
File “Threshold 11.py”, line 16, in
thresholdGlyph( g, d )
File “/Users/dathanboardman/Library/Application Support/Glyphs/Scripts/robofab/pens/filterPen.py”, line 128, in thresholdGlyph
aGlyph.appendGlyph(new)
File “/Users/dathanboardman/Library/Application Support/Glyphs/Scripts/robofab/objects/objectsBase.py”, line 1525, in appendGlyph
aGlyph.drawPoints(pen)
File “/Users/dathanboardman/Library/Application Support/Glyphs/Scripts/robofab/objects/objectsBase.py”, line 1508, in drawPoints
c.drawPoints(pen)
File “/Users/dathanboardman/Library/Application Support/Glyphs/Scripts/robofab/objects/objectsBase.py”, line 1996, in drawPoints
pen.endPath()
File “GlyphsApp/GSPen.py”, line 33, in endPath
File “GlyphsApp/objectsGS.py”, line 546, in _invalidateContours
AttributeError: ‘GSLayer’ object has no attribute ‘updatePath’
End

I fixed it.

1 Like

I just tried rerunning the script but got the same error message. Or do you mean you fixed the script?

I believe, in this case, the fix is in Glyphs and will be included in the next update (it may have already been included in the beta 2.6.1 (1208), released earlier today).

Ah yes, it works, thank you @GeorgSeifert & @composerjk !!!