I want to swap entire glyphs, not only names.
e.g. swapping “a” with “a.1” should also change the component in aacute to “a.1”
I tried with changing the ID in a modified Mark2Mark script, but it does not work and Glyphs crashes after a few tries. Any hints?
Doc = Glyphs.currentDocument
Font = Glyphs.font
Selection = Font.selectedLayers
listOfGlyphNames = [ x.parent.name for x in Selection ]
listOfGlyphIDs = [ x.parent.id for x in Selection ]
print(listOfGlyphIDs)
if len(listOfGlyphNames) == 2:
Selection[1].parent.name = "Temp"
Selection[1].parent.id = '3BA8C044-CB97-4F5B-9A50-999999999999' #temp id
print(Selection[1].parent.id)
print(listOfGlyphNames)
Selection[0].parent.name = listOfGlyphNames[1]
Selection[1].parent.name = listOfGlyphNames[0]
Selection[0].parent.id = listOfGlyphIDs[1]
Selection[1].parent.id = listOfGlyphIDs[0]
else:
#pass
# from robofab.interface.all.dialogs import Message
Message("Select only TWO glyphs", "", OKButton="OK")