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( thisLayer.parent.name )
# 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.
If it is a filter, you add ; include: a, b, c, d to the end of the value. It will apply to only the glyphs you name.
Easy way to get the list of glyph names: You can select all glyphs you want to add in font view, right click, select Copy Glyph Names > Comma-Separated.