Basics of Python scripting in FontLab Studio 5

Video tutorial

The 70-minute tutorial Basics of Python scripting in FontLab Studio 5 has beed recorded in February 2015 by Adam Twardoch. The tutorial is primarily intended for users who have never written any Python code before, although some tips and tricks for more advanced users are given. Topics include: basics of Python, scripting-related user interface elements of FontLab Studio, installing Python, RoboFab and FontLab Python macros, writing simple scripts that modify a font and speed up the type design process. See below for additional resources.

Installing Python and pip

FontLab Studio 5.1.x on Mac OS X and 5.2.x on Windows works with Python 2.7. In addition to Python, it’s best to also have pip, the Python package installer, which will simplify installing many additional handy Python-based tools.

On Windows

Regardless of whether you use the 32-bit or the 64-bit version of Windows, download Python 2.7.9 for Windows x86 (32 bit version) and install it. You can follow ShowMeDo’s Running Python 2.5 on Windows XP video for instructions (note, however, that the Python version you’ll be installing is 2.7, not 2.5). Python 2.7.9 for Windows already includes pip.

On Mac OS X

On Mac OS X, Python 2.7.6 is already installed but you need to install pip yourself. To do that, download get​-pip​.py to your Desktop, then open /Applications/Utilities/ and type:

cd Desktop
sudo python

(Enter your Administrator password, press Enter, and the installation should be complete.)

Installing RoboFab, fontTools/TTX

Thomas Phinney has written a step-by-step guide for installing two popular Python packages which are essential to Python scripting within FontLab Studio 5:
How do I install Python, RoboFab, TTX/FontTools and other add-ons so I can run scripts (or write my own) with FontLab Studio?

Resources for learning Python

I recommend watching these video videos by ShowMeDo:

Python in FontLab Studio 5 Resources

FontLab Studio 5 has a “Python API”, i.e. a set of modules, classes and objects which you can access and manipulate using Python. You need to run Python scripts (macros) within FontLab Studio in order to access the FontLab Python API. Please refer to the resources below for more information.

Useful FontLab Studio 5 macro packages

Note: Some of those packages expect that you have Adobe FDK for OpenType and RoboFab (along with the other dependencies) installed.

Tags: ,

Adam Twardoch

Adam Twardoch is Director of Products at FontLab, and a font consultant specializing in font technology, multilingual typography, CSS webfonts, Unicode and OpenType. Co-designer of Lato, the world’s most-popular independently made font family (by Łukasz Dziedzic), and of Milka (by Botio Nikoltchev). Co-creator of OpenType Font Variations and CSS Fonts specs. In 2000–2014, technical and linguistic consultant at MyFonts, the world’s largest online font distributor, and board member of Association Typographique Internationale (ATypI). Adam regularly teaches workshops in font creation. He lives and works in Warsaw and Berlin.