Export a variable font with only a few glyphs

Hi i have made a script which export a variable font. But how do i make The export so it only exports a few glyphs of The font. Fx The space and A glyphs? Or fx only The basic latin?
Thanks

You add an extra “variable export setting” and give it a “Keep Glyphs” parameter with the glyphs you like to keep.

I’m not sure how to do that exactly. But do you mean like this:

# Define the glyphs for the two variable fonts
space_glyph = ".space"
space_widthMetricsKey = 20000

# Export the variable font file with only the "space" glyph
filename = font.familyName + "-space-A.ttf"
export_path = os.path.join(web_protected_path, filename)

print("== Exporting Variable (space only) ==")
print(Glyphs.font.export(Format=VARIABLE, Containers=[PLAIN, WOFF, WOFF2], FontPath=os.path.expanduser(export_path), UseProductionNames=UseProductionNames, KeepGlyphs=".space"))
print()


# Export the variable font file with all glyphs and adjusted space width
filename = font.familyName + "-space-B.ttf"
export_path = os.path.join(web_protected_path, filename)

print("== Exporting Variable (full set, but adjusted space width) ==")
print(Glyphs.font.export(Format=VARIABLE, Containers=[PLAIN, WOFF, WOFF2], FontPath=os.path.expanduser(export_path), UseProductionNames=UseProductionNames, widthMetricsKey=space_widthMetricsKey))
print()


# Export limited test characters set
filename = font.familyName + "-limited.ttf"
export_path = os.path.join(web_protected_path, filename)

print("== Exporting Variable (limited test characters set) ==")
print(Glyphs.font.export(Format=VARIABLE, Containers=[PLAIN, WOFF, WOFF2], FontPath=os.path.expanduser(export_path), UseProductionNames=UseProductionNames, KeepGlyphs=".space, A , B, C"))
print()

You have to do it in the Exports tab, under Custom Parameters search for Keep Glyphs in the popup menu. Then you can define which glyphs will be exported. You can also select glyphs in the font view, and uncheck the Export setting, but that would be true for all export instances.

I didn’t see that you meant it to be a script. Is that required?

Arhh okay i see.

I was actually looking for at way to do it by script, if that it possible?

I’ve done it now with the filters under export and keep glyphs. But for some reason the filter that change the width of the “space” glyph only change one of the variable states.

I have added this on a Variable font setting under Custom Parameters:
Filter “Transformations; Width: 20000; include:space”
This change the condensed thin state, but not the other states on export. Is there something wrong with my Filter?

I fixed the Transformations filter to transform all layers. Thanks for reporting this.