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 import addObserver

class CustomFontOverviewContextualMenu(object):

   def __init__(self):
       addObserver(self, "fontOverviewAdditionContextualMenuItems", "fontOverviewAdditionContextualMenuItems")

   def fontOverviewAdditionContextualMenuItems(self, notification):
       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")


The same approach can be used to add custom items to other contextual menus in RoboFont. Use the following keys to access the menus for glyphs, guides and images:

  • glyphAdditionContextualMenuItems
  • guideAdditionContextualMenuItems
  • imageAdditionContextualMenuItems
Last edited on 02/06/2020