Like in the topic. How can I do it from macro-script level?
font = Glyphs.font
currTab = font.currentTab
leftLetter = currTab.text[currTab.textCursor-1]
rightLetter = currTab.text[currTab.textCursor]
leftLetter = Glyphs.niceGlyphName(leftLetter)
rightLetter = Glyphs.niceGlyphName(rightLetter)
for glyph in font.glyphs:
if glyph.name == leftLetter:
leftLetter = glyph
if glyph.name == rightLetter:
rightLetter = glyph
print rightLetter
font.removeKerningForPair(font.selectedFontMaster.id,leftLetter.name,rightLetter.name)
this doesn’t work
I don’t understand why you iterate through all glyphs. This works:
font = Glyphs.font
currTab = font.currentTab
leftChar = currTab.text[currTab.textCursor-1]
rightChar = currTab.text[currTab.textCursor]
leftGlyphName = Glyphs.niceGlyphName(leftChar)
rightGlyphName = Glyphs.niceGlyphName(rightChar)
font.removeKerningForPair(font.selectedFontMaster.id,leftGlyphName,rightGlyphName)
I tried to do it like you showed and it didn’t work (that’s why I tried to iterate through all glyphs: I thought that maybe there is solution). Maybe there is problem with my GlyphsApp. I will reinstall glyphsapp
EDIT:
I just figured out that removeKerningForPair
doesn’t work with one particular .glyph file. Still don’t know why
Can you send me the .glyphs file and the script you used?
Sure
That script only removes kerning between glyphs, not between classes. Instead of the glyph name, you need to remove the kerning with the .leftKerningGroup and rightKerningGroup:
font = Glyphs.font
currTab = font.currentTab
cursor = currTab.graphicView().cachedSelectionRange().location # there will be a wrapper for this in the next version
leftLayer = currTab.layers[cursor - 1]
rightLayer = currTab.layers[cursor ]
leftGlyphName = leftLayer.parent.name
rightGlyphName = rightLayer.parent.name
leftGroup = leftLayer.parent.rightKerningGroupId()
rightGroup = rightLayer.parent.leftKerningGroupId()
font.removeKerningForPair(font.selectedFontMaster.id, leftGlyphName, rightGlyphName)
font.removeKerningForPair(font.selectedFontMaster.id, leftGroup , rightGroup)
font.removeKerningForPair(font.selectedFontMaster.id, leftGroup, rightGlyphName)
font.removeKerningForPair(font.selectedFontMaster.id, leftGlyphName, rightGroup)