Synchronize Glyph Editors Across Fonts ↩
The following script leverages the power of Subscriber
to synchronize multiple glyph editors across different fonts to the current glyph with a tiny amount of code. The script uses the font.info.styleName
to avoid aligning also glyph editors from the same font.
Did you know you can have multiple glyph editors opened from the same font? Just press alt when clicking on glyph from the Font Overview
from mojo.subscriber import registerGlyphEditorSubscriber, Subscriber, disableSubscriberEvents
from mojo.UI import AllGlyphWindows
class GlyphEditorSubscriber(Subscriber):
debug = True
def glyphEditorDidSetGlyph(self, info):
glyph = info["glyph"]
glyphEditors = AllGlyphWindows()
with disableSubscriberEvents():
for eachEditor in glyphEditors:
editorFont = eachEditor.getGlyph().font
if editorFont.info.styleName != glyph.font.info.styleName and glyph.name in editorFont:
eachEditor.setGlyphByName(glyph.name)
if __name__ == '__main__':
registerGlyphEditorSubscriber(GlyphEditorSubscriber)