Scripting Window

RoboFont’s primary scripting environment is the Scripting Window, a code editor which allows edit and run Python scripts.

Script browser

The Scripting Window includes a file browser for navigating through a folder of scripts. Use the icon at the bottom left of the window to show or hide it.

Scripts in the current folder are also listed in the main application menu.

Code interaction
The code editor supports a special interaction mode which allows the user to modify selected values dynamically.

Font objects out-of-the-box

When writing code in the Scripting Window, the main font objects are available out of the box – so you can use CurrentFont, OpenFont, NewFont, AllFonts, CurrentGlyph etc. directly, without having to import them at the top of your scripts.

print(CurrentFont())
<RFont 'RoboType Roman' at 4864862160>
print(CurrentGlyph())
<RGlyph 'G' ('foreground') at 4872730960>

Note that these objects are available only to scripts which are run in the Scripting Window. If your main script calls a function from an external module, then you’ll need to import the font objects explicitly from mojo.roboFont in that file:

# getFont.py
from mojo.roboFont import CurrentFont

def getFont():
    return CurrentFont()
from getFont import getFont

print(getFont())
<RFont 'RoboType Roman' at 4853462928>

RoboFont supports a custom title and a keyboard shortcut for each script. If available, the title is used in the Scripts menu instead of the file name.

Title and shortcut must be added at the top of your script with the following syntax:

# menuTitle : my funky script
# shortCut  : command+shift+alt+t

print('hello world')

Shortcuts must be constructed using the following format:

command+shift+control+alt+<input>

Not all modifier keys are required.

The input key can be a character or any of the following keys:

space tab backtab arrowup arrowdown arrowleft arrowright f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f20 f21 f22 f23 f24 f25 f26 f27 f28 f29 f30 f31 f32 f33 f34 f35 enter backspace delete home end pageup pagedown

Output Window

The Output Window is where print statements and tracebacks appear when a script is not running from the Scripting Window. It is used mainly for debugging.

Last edited on 06/05/2019