measurementNames.append(row[0]) measurements[row[0]] = mDict # loop through designspace doc = DesignSpaceDocument() doc.read(designspacePath) designspaceFileName = os.path.split(designspacePath)[1] # gather glyph index for width counting for source in doc.sources: if source.copyInfo: f = OpenFont(source.path, showInterface=False) for gname in f.glyphOrder: if gname in f: widthsCols.append(gname) f.close() widthsRows.append(widthsCols) # process each source for source in doc.sources: if not os.path.exists(source.path): print('missing source', source.path) continue f = OpenFont(source.path, showInterface=False) charMap = f.getCharacterMapping() row = [os.path.split(source.path)[1], int(f.info.unitsPerEm)] # get the measurements for measurementName in measurementNames: value = None
printWrite(f'sans italic '.ljust(80, '-') + '\n') printWrite('\n') for g in font: if '.' in g.name and\ g.name.split('.')[1] == 'italic' and\ g.name.split('.')[0][0] not in italicsNotInSans: baseName = g.name.split('.')[0] rule = f'<sub name="{baseName}" with="{g.name}" />' printWrite(rule + '\n') makeRules() makeSansItalicRules() font.close() GSUBrules.close() # go through glyph construction recipes and pull out all suffixed glyphs # OR go through the charset of a UFO and find all suffixes that have dict rules # print(suffix) # print(f"<sub name="{baseDiacritic}" with="{baseDiacritic}.{suffix}" />") # only do this for diacritics which have bases in certain rule set # TODO: limit these rules to what bases are already in a selected designspace? # sans: do not italicize # c # f # s