RoboFont provides its own Scripting Window for writing and running scripts. Thanks to the RoboFont shell command, you can also use an external code editor to write your scripts and have them execute inside RoboFont.

Installing RoboFont as a shell command

In order to use your code editor’s build system with RoboFont, you’ll need to install the RoboFont shell command first. To do that, go to Preferences > Extensions > Shell and click on the Install button.

To check if the command is working: open the Terminal, type robofont -h and hit return. The command line help will be printed to the console.

For the RoboFont shell command to work correctly you’ll probably need to install PyObjC in Terminal using pip3.

Configuring your external editor

In order to run a script in RoboFont, you’ll need to save it first.

Sublime Text

Steps for setting up a RoboFont build system in SublimeText, contributed by Bahman Eslami.

{
    "cmd": ["robofont", "-p", "$file"],
    "file_regex": "^[ ]File \"(...?)\", line ([0-9]*)",
    "selector": "source.python",
}
  1. Save the file above inside the SublimeText user folder:

     Library/Application Support/Sublime Text 3/Packages/User
    
  2. In the SublimeText main menu, go to Tools > Build System and select RoboFont.

  3. Run the script using the standard keyboard shortcut ⌘ + b, and the code will be executed inside RoboFont.

Atom

Steps for setting up a RoboFont build system in Atom, contributed by Rafał Buchner.

"atom-shell-commands":
    commands: [
      {
        arguments: [
          "-p"
          "{FilePath}"
        ]
        command: "roboFont"
        name: "build robofont"
        options:
          keymap: "alt-r"
          pwd: "{FileDir}"
      }
    ]
  1. Install atom-shell-commands.

  2. In the Atom main menu, go to File > Open Your Config to open your config file.

  3. To add a command to your atom-shell-commands configurations, copy the above code after the line *:.

  4. Run the script, and the code will be executed inside RoboFont.

Visual Studio Code

Steps for setting up a RoboFont build system in VS Code, contributed by Stephen Nixon.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Run in RoboFont",
            "type": "shell",
            "command": "robofont",
            "args": [
                "-p",
                "${file}"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
  1. In VS Code, open a folder that you wish to run scripts from. This might be a type project, the central RoboFont scripts folder, or somewhere else. VS Code calls this a “workspace”, and you can give it specific settings in a .vscode folder.

  2. Use the shortcut ⌘ + ⇧ + p to open the Command Palette.

  3. Search for Tasks: Configure Default Build Task and select it.

  4. Select Create tasks.json file from template, and finally Other. This will create the file tasks.json in a .vscode workspace folder.

  5. Paste the above tasks.json code in place of the template.

  6. Run the script using the standard keyboard shortcut ⌘ + ⇧ + b, and the code will be executed inside RoboFont.

  • Yes, the version number is 2.0.0 because it refers to VS Code’s task system.
  • If you are managing the workspace as a Git project, you should probably add .vscode to your .gitignore file.

PyCharm

Steps for setting up a RoboFont build system in PyCharm, contributed by Rafał Buchner.

  1. In the PyCharm main menu, go to Preferences > External Tools.

  2. Click on the + button to create a new external tool.

  3. Fill in the Name field with the name of the tool, for example “RoboFont”.

  4. Fill in the remaining fields like this:

    Program
    roboFont
    Arguments
    -p $FilePath$
    Working directory
    $Projectpath$
  5. Optionally, you can choose the name of the group for this tool – it is set to External Tools by default.

  6. Click on OK and then on Apply to save your changes.

  7. Run the script using the main menu Tools > External Tools > RoboFont, or with External Tools > RoboFont from the contextual menu (use right click to display it).

You can define a keyboard shortcut for this command in the PyCharm Preferences.

VIM

Steps for setting up a RoboFont build system in VIM, contributed by Jan Šindler.

  1. Open your .vimrc config file.

  2. Add nnoremap <silent> <F3> :!robofont "%:p"<CR> to run your files from normal mode.

  3. Add inoremap <silent> <F3> <ESC> :!robofont "%:p"<CR> to run your files from insert mode.

  4. Save the changes.

  5. Run the script using the key to which the commands were assigned (in the example above, F3). The code will be executed inside RoboFont.

  • You can choose other keys to run your files in RoboFont.
  • In macOS, this example .vimrc file can be found in the ~ folder (user home directory).
Last edited on 01/09/2021