Robofab Pens in Glyphs


#1

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?


#2

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.


#3

Thank you kindly for the info!

Best,
Dathan


#4

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!'

#5

What error message do you get?


#6

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


#7

I fixed it.


#8

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


#9

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).


#10

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