# Make a .glyphs file with only brace glyphs, export these files in Glyphs App as variable fonts, and the build script will swap these out in the final VF import sys import re from glyphsLib import GSFont from glyphsLib import GSGlyph from glyphsLib import GSLayer file = sys.argv[1] font = GSFont(file) print("\tPreparing %s" % file) # Append Italic to font family naame if Italics style = sys.argv[2] if style == "Italic": font.familyName = "%s %s" % (font.familyName, style) # Clear all features font.features = [] font.classes = [] font.featurePrefixes = [] # Remove Rename Glyphs custom parameter for instance in font.instances: for customParam in instance.customParameters: if customParam.name == "Rename Glyphs": del customParam # Find brace glyphs listOfBraceGlyphs = [] for eachGlyph in font.glyphs:
# Make a .glyphs file with only brace glyphs, export these files in Glyphs App as variable fonts, and the build script will swap these out in the final VF import sys import re from glyphsLib import GSFont from glyphsLib import GSGlyph from glyphsLib import GSLayer file = sys.argv[1] font = GSFont(file) print "\tPreparing %s" % file # Append Italic to font family naame if Italics style = sys.argv[2] if style == "Italic": font.familyName = "%s %s" % (font.familyName, style) # Clear all features font.features = [] font.classes = [] font.featurePrefixes = [] # Remove Rename Glyphs custom parameter for instance in font.instances: for customParam in instance.customParameters: if customParam.name == "Rename Glyphs": del customParam # Find brace glyphs listOfBraceGlyphs = [] for eachGlyph in font.glyphs:
import sys import os import re import time import copy from glyphsLib import GSFont from glyphsLib import GSGlyph from glyphsLib import GSLayer filename = sys.argv[-1] font = GSFont(filename) delMasters = [] delInstances = [] font.familyName = "Cabin Condensed" i = 0 for master in font.masters: if re.match('.*Condensed.*', master.name) == None: for glyph in font.glyphs: for layer in glyph.layers: if layer.layerId == master.id or layer.associatedMasterId == master.id: del glyph.layers[layer.layerId] font.kerning.pop(master.id) delMasters.append(i) i = i - 1 else: master.name = re.sub(' *Condensed *', '', master.name) i = i + 1
import sys import os import re from glyphsLib import GSFont from glyphsLib import GSGlyph filename = sys.argv[-1] font = GSFont(filename) nonExportGlyphs = [] baseIndex = 0 for glyph in font.glyphs: for layer in glyph.layers: if re.match('.*\}.*', layer.name) != None: layer.name = 'Brace Off' elif re.match('.*\].*', layer.name) != None: layer.name = 'Bracket Off' font.familyName = "Hepta Slab Hairline" font.instances[0].active = True del font.instances[1:] font.save(filename)