def _merge_OTL(font, model, master_fonts, axisTags): log.info("Merging OpenType Layout tables") merger = VariationMerger(model, axisTags, font) merger.mergeTables(font, master_fonts, ['GSUB', 'GDEF', 'GPOS']) store = merger.store_builder.finish() if not store.VarData: return try: GDEF = font['GDEF'].table assert GDEF.Version <= 0x00010002 except KeyError: font['GDEF'] = newTable('GDEF') GDEFTable = font["GDEF"] = newTable('GDEF') GDEF = GDEFTable.table = ot.GDEF() GDEF.GlyphClassDef = None GDEF.AttachList = None GDEF.LigCaretList = None GDEF.MarkAttachClassDef = None GDEF.MarkGlyphSetsDef = None GDEF.Version = 0x00010003 GDEF.VarStore = store # Optimize varidx_map = store.optimize() GDEF.remap_device_varidxes(varidx_map) if 'GPOS' in font: font['GPOS'].table.remap_device_varidxes(varidx_map)
def _merge_OTL(font, model, master_fonts, axisTags): log.info("Merging OpenType Layout tables") merger = VariationMerger(model, axisTags, font) merger.mergeTables(font, master_fonts, ['GPOS']) # TODO Merge GSUB # TODO Merge GDEF itself! store = merger.store_builder.finish() if not store.VarData: return try: GDEF = font['GDEF'].table assert GDEF.Version <= 0x00010002 except KeyError: font['GDEF']= newTable('GDEF') GDEFTable = font["GDEF"] = newTable('GDEF') GDEF = GDEFTable.table = ot.GDEF() GDEF.Version = 0x00010003 GDEF.VarStore = store # Optimize varidx_map = store.optimize() GDEF.remap_device_varidxes(varidx_map) if 'GPOS' in font: font['GPOS'].table.remap_device_varidxes(varidx_map)
def _add_BASE(font, masterModel, master_ttfs, axisTags): log.info("Generating BASE") merger = VariationMerger(masterModel, axisTags, font) merger.mergeTables(font, master_ttfs, ['BASE']) store = merger.store_builder.finish() if not store.VarData: return base = font['BASE'].table assert base.Version == 0x00010000 base.Version = 0x00010001 base.VarStore = store
def _merge_OTL(font, model, master_fonts, axisTags): log.info("Merging OpenType Layout tables") merger = VariationMerger(model, axisTags, font) merger.mergeTables(font, master_fonts, ['GPOS']) store = merger.store_builder.finish() try: GDEF = font['GDEF'].table assert GDEF.Version <= 0x00010002 except KeyError: font['GDEF']= newTable('GDEF') GDEFTable = font["GDEF"] = newTable('GDEF') GDEF = GDEFTable.table = ot.GDEF() GDEF.Version = 0x00010003 GDEF.VarStore = store