The Scripting Window is a simple code editor for writing and running Python scripts.

The code editor supports syntax highlighting for Python. The colors can be configured in the Python Preferences.

The Scripting Window makes the main FontParts objects available out-of-the-box.

Options

An options menu is available by clicking on the gears icon at the bottom left:

title description
Show line numbers Show line number before each line.
Indent using spaces Indent code using spaces instead of tabs.
Window float on top Make the Scripting Window float on top of other windows.

Toolbar

The toolbar gives access to the Scripting Window’s main functions:

title description
Run Execute the current script.
Comment Comment the selected line(s).
Uncomment Uncomment the selected line(s).
Indent Add indentation to selected line(s).
Dedent Remove indentation from selected line(s).
Save Save the current script as a .py file.
Reload Reload the script from disk. Useful if the script has been edited by another application.
New Create a new empty script.
Open Open an existing script from .py file.
Edit With… Edit script with another application.

Script Browser

The Script Browser is a collapsible side panel which makes it possible to navigate through all scripts in a chosen folder. Use the icon at the bottom left of the window to show or hide it.

choose a folder
click on the pop up button at the top left to choose a folder with scripts
open a script
double-click a script to open it in the editor

Scripts in the selected folder are also listed under the Scripts entry in the Application Menu.

Code interaction

The code editor offers special ways to interact with some types of values in your code. When selected, these values can be modified interactively by using modifier keys together with the mouse or the arrow keys.

bool

Boolean values can be toggled on/off like a switch with the mouse, or with the keyboard using the arrow keys.

modifiers ↑ or → or ↓ or ←
Toggle value on/off.
int / float

The value of integers and floats can be modified dynamically with the mouse like sliders, or with the keyboard using the arrow keys.

modifiers ↑ or → ↓ or ←
+1 -1
⌘ + ⌥ +0.1 -0.1
⌘ + ⇧ +10 -10
⌘ + ⌥ + ⇧ +0.01 -0.01
tuple

Selected pairs of numbers can be modified together with the mouse or with the keyboard, like a movement in xy space.

modifiers
+1 x -1 x +1 y -1 y
⌘ + ⌥ +0.1 x -0.1 x +0.1 y -0.1 y
⌘ + ⇧ +10 x -10 x +10 y -10 y
⌘ + ⌥ + ⇧ +0.01 x -0.01 x +0.01 y -0.01 y

RoboFont scripts may include a custom title and a keyboard shortcut. If available, the title is displayed in the Scripts menu instead of the file name.

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

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

print('hello world')

Shortcuts must be constructed with 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

Last edited on 02/06/2020