Basics of Python scripting in FontLab Studio 5
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.
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/Terminal.app and type:
sudo python get-pip.py
(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:
- First 5 Minutes with Python
- What Does Python Look Like? series
- Resources for Python Newbies series
- Common Variables and Containers series
- Loops and Iteration series
- The Python standard library series
- Functions series
- the ‘if’ statement series
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.
- Chapter 12, Macro Programming of the FontLab Studio 5 User’s Manual (download the PDF)
- Unofficial FontLab API Reference
- Python scripting section of fontlab.com
- Python scripting board on the FontLab Forum
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.
- FMX: Freemix Tools by Tim Ahrens (free)
- RMX: Font Remix Tools by Tim Ahrens (free for non‐commercial use)
- Autopsy by Yanone (free)
- FontQA by FontFont (free)
- FontLab Scripts by Adobe Type Department
- FontLab Scripts by Ben Kiel
- FontLab Scripts by Pablo Impallari
- FontLab Scripts by David Brezina
- FontLab Scripts by Thomas Phinney
- FontStep by Stefan Huber
- Batch Font Info by Retype
Trackback from your site.