This example shows how to create a custom contextual menu in the Font Overview.

To activate the contextual menu, right-click anywhere in the font window.

from mojo.subscriber import Subscriber, registerRoboFontSubscriber

class CustomFontOverviewContextualMenu(Subscriber):

    debug = True

    def fontOverviewWantsContextualMenuItems(self, info):
        myMenuItems = [
            ("option 1", self.option1Callback),
            ("option 2", self.option2Callback),
            ("submenu", [("option 3", self.option3Callback)])

    def option1Callback(self, sender):
        print("option 1 selected")

    def option2Callback(self, sender):
        print("option 2 selected")

    def option3Callback(self, sender):
        print("option 3 selected")

if __name__ == '__main__':

The same approach can be used to add custom items to other contextual menus in RoboFont. Use the following Subscriber methods to access the menus for space center, font overview and the glyph editor:

Last edited on 01/09/2021