Adding Custom Parameter in Exports Tabs

Hey there I’m trying to make a script that exports only the selected glyphs, for making Trial Fonts.

I want to use the “Keep Glyphs” parameter, but when I run the script it adds this Custom Parameter in the “Font” tab, instead of “Exports” tab.
Any insights?
Thank you!

thisFonts = Glyphs.fonts

# List that will be filled with glyphs to export
glyphsToKeep = []

# Go trough each open font
for thisFont in thisFonts : 
	# Go trough each selected glyph
	for thisLayer in thisFont.selectedLayers :
		# Add each name of selected glyph to empty list
		glyphsToKeep.append( )
	# Add custom parameter "Keep Glyphs" with the filled list
	thisFont.customParameters['Keep Glyphs'] = glyphsToKeep

	thisFont.instances[0].generate( OTF )

	print ( thisFont.instances[0].fullName, "— Exported." )

print ( "" )
print ( "--------" )
print ( "Finished" )

Hey @ferfolio! Glyphs allows you to add a custom parameter to the entire font, a master, or an instance. And I think there are different custom parameters available for each type of object.

You can set custom parameters on an instance object too. Here’s a link to that in the documentation, and an example:

thisFont = Glyphs.font
firstInstance = thisFont.instances[0]
firstInstance.customParameters['Keep Glyphs'] = ["a", "b", "c"]
1 Like