SOLVED How to execute undo for some glyphs via code?
RafaŁ Buchner last edited by gferreira
Sorry, maybe it is obvious, but I couldn't find it in the documentation.
I possible something like that? (executing Edit>Undo for some glyph ?) if yes, how to do it?
font = CurrentFont() g = font['a'].execUndo()
then you dont need to call undo :) but you have to add undo items while editing.
glyph = CurrentGlyph() # in RF 3.2 with glyph.undo("changed spacing"): glyph.leftMargin += 10 glyph.rightMargin += 10
this will 'record' the change, add an menu item.
RafaŁ Buchner last edited by RafaŁ Buchner
I have a tool, that has my own custom edit window which works quite differently than the default Glyph Window.
I wanted to add undo/redo functionality to it because it is more convenient than swapping between my tool and the edit window only for this.
why would you want to call undo separately?
fontParts has no api for this, maybe it should...
this is the internal way calling undo:
f = CurrentFont() m = f.document().getUndoManagerForGlyph_(f["a"].naked()) m.undo()