RoboFont extensions are macOS packages – folders which act like single files. They have a standard folder structure and the file extension .roboFontExt.

You can view the contents of a package by right-clicking it in Finder, and selecting Show Package Contents.

Extension Folder Structure

Version 3.0

Extension packages must have the following internal structure:

myExtension.robofontExtension ├── info.plist ├── lib │ └── *.py or *.pyc ├── (html) │ ├── index.html │ └── (*.html) ├── (resources) │ └── (any type of file) ├── (license) └── (requirements.txt)

Files and folders in parentheses are optional.

info.plist

The info.plist is a XML property list file containing extension metadata.

key value
name

Name of the extension.

string

required

developer

Name of the developer.

string

required

developerURL

Site URL of the developer.

string

required

html

Indicates if the extension contains an html folder.

0 (zero) is False, 1 (one) is True.

If set to True, an index.html file is required inside the given html directory.

integer

not required

launchAtStartUp

Indicates if code is executed during RoboFont start up.

0 (zero) is False, 1 (one) is True.

integer

not required

mainScript

Path to the .py file (relative to the lib folder) which is executed during RoboFont start up.

can be an empty string

string

required when launchAtStartUp is True

uninstallScript

Path to the .py file (relative to the lib folder) which is executed while uninstalling the extension.

can be an empty string

string

not required

addToMenu

A list of menu descriptions for inclusion in the Extension menu.

see Menu Item Description (below)

can be an empty list

list

required

timeStamp

The extension’s build date.

float

required

version

The extension’s version number.

string

required

requiresVersionMajor

The major version number of the minimum RoboFont version required by the extension.

string

not required

requiresVersionMinor

The minor version number of the minimum RoboFont version required by the extension.

string

not required

expireDate

The expiration date for the extension in the format YYYY-MM-DD.

new in RoboFont 3.3b

string

not required

com.robofontmechanic.mechanic

A dictionary containing two required keys: summary and repositoryURL.

(see Mechanic and the note below)

dictionary

deprecated

Custom keys

The info.plist may include custom keys if needed.

Custom entries should use reverse domain names as keys to avoid namespace conflicts with other extensions.

Example: com.myDomain.myExtension.myCustomKey

In RoboFont 1, extension metadata for Mechanic was stored in the info.plist of each extension under the custom key com.robofontmechanic.mechanic.

This custom key is no longer used in RoboFont 3 / Mechanic 2.

Mechanic 2 introduces a different system for publishing extensions, with centralized storage of extension metadata in the Mechanic 2 Server.

See Publishing extensions on Mechanic 2 for more information.

lib

The lib folder contains all .py or .pyc files needed by the extension.

When an extension is installed, its lib folder is added to the sys.path – so all the other files and folders in the extension can be imported as modules with Python. To avoid namespace conflicts with other extensions, it is recommended to use reverse domain names without dots to prefix extension modules.

Example: comMyDomainMyExtensionMyModule

Compiled .pyc files must be created using the built-in Python, and are not compatible with other major versions of Python. For example, .pyc files generated with Python 3.6.2 will work in 3.6.1, 3.6.2 and 3.6.8, but not in 3.7.2.

RoboFont 3.3

Extensions containing .pyc files may include multiple lib folders for different versions of Python. Additional folders must follow the naming scheme lib.X.Y, where X.Y is the major Python version.

Example:

myExtension.robofontExtension ├── info.plist ├── lib ← default Python (ex: 3.6) │ └── *.pyc ├── lib.3.7 ← Python 3.7 │ └── *.pyc ├── html └── license

Python files assigned to mainScript or addToMenu are not converted to .pyc, as RoboFont needs to be able to read and execute them.

When creating compiled extensions, separate code in UI files (main script and menu files, will be kept as .py) and the actual lib files (will be converted to .pyc).

See the Boilerplate Extension for a working example.

html

not required

If an html folder is declared in the info.plist, then it must contain a file named index.html. This file must be a plain html file.

Use the Help link in the extension’s submenu to open the html help in RoboFont’s Help Window (a simple WebKit browser).

resources

not required

The resources folder is a place to store any additional files needed for your extension. It is commonly used for assets (such as images for toolbar icons and cursors), or for additional compiled command-line tools.

license

not required

The license file contains the full license text for the extension.

This file must be either in .txt or .html format.

requirements

not required

The requirements.txt file contains a list of other extensions which also need to be installed for the current extension to work.

For example, an extension which requires DrawBot and Batch should include a requirements.txt file with the names of both extensions, one per line:

Batch
DrawBot

When installed, an extension can add entries to the Extensions menu. These entries are defined as a list of menu item descriptions.

Each menu item description is a dictionary with the following keys:

key value
path

Path to the .py file (relative to the lib folder) to be executed when the menu item is clicked.

string

required

preferredName

The preferred name of the menu item. Used only when displaying the item in the menu.

string

required

shortKey

string: a single keystroke that can be attached to the menu item.

tuple : (<modifierFlag> integer, <keyStroke> string)

can be an empty string

string or tuple

required

  • Modifier flags are macOS native input masks which can be imported from AppKit. See the Boilerplate Extension’s build script for an example.
  • If no modifiers are given, ⌃ Ctrl and ⌘ Cmd are assigned to the short key.
  • If a short key is already in use, it will not be added to the menu item.
Last edited on 01/09/2021