Skip to content

Instantly share code, notes, and snippets.

@ryanbugden
Created February 25, 2022 16:06
Show Gist options
  • Select an option

  • Save ryanbugden/e134aed20d7a9d586b17cd2288cb41cc to your computer and use it in GitHub Desktop.

Select an option

Save ryanbugden/e134aed20d7a9d586b17cd2288cb41cc to your computer and use it in GitHub Desktop.
RF start-up script: Puts a button in your Glyph Editor toolbar which brings the corresponding Font Overview window to the forefront.
import os
from AppKit import NSImage
from lib.UI.toolbarGlyphTools import ToolbarGlyphTools
from mojo.subscriber import Subscriber, registerRoboFontSubscriber
class SummonFontOverview(Subscriber):
def glyphEditorWantsToolbarItems(self, info):
label = identifier = 'Summon Font Overview'
image = NSImage.imageNamed_("toolbarGlyphs").copy()
image.setSize_((18, 18))
view = ToolbarGlyphTools((25, 25),
[dict(image=image, toolTip=label)], trackingMode="one")
newItem = {
'itemIdentifier': identifier,
'label': label,
'view': view,
'callback': self.summonFO
}
info['itemDescriptions'].insert(-2, newItem)
def summonFO(self, sender):
CurrentFont().document().getMainWindow().open()
if __name__ == '__main__':
registerRoboFontSubscriber(SummonFontOverview)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment