Python in FontLab Studio
FontLab Studio 5 for Mac OS X
FontLab Studio 5 and AsiaFont Studio 5 on Mac OS X works with the native "Framework" Python that is pre-installed in Mac OS X. Mac OS X 10.4 Tiger comes with pre-installed Python 2.3 and this is the version that FontLab Studio works with. Mac OS X 10.5 Leopard comes with pre-installed Python 2.3 and 2.5, but unfortunately, FontLab Studio is currently hard-wired to work with version 2.3 only.
Please check our note about Python compatibility in Intel-based Mac OS X. Visit python.org to download additional modules and documentation.
Even though you can install Python 2.4 or 2.5 on Mac OS X 10.4 and 10.5 already has Python 2.5 pre-installed, FontLab Studio will not work with it, at least not officially.
Inofficially, it is not possible to get FontLab Studio to work with Python 2.4 or 2.5, but this means "hiding" Python 2.3 from the system, which may influence the stability of your system (though we have not seen any actual proof that something bad would happen). Below are some instructions how to do this, but this is not supported and not recommended by Fontlab Ltd.:
- Log in as administrator into Mac OS X.
- Download and install the latest Python 2.4 or 2.5 release for Mac OS X.
- Open the Terminal application.
- Enter the following lines:
sudo mv 2.3 2.3.bak
(enter your administrator password)
- If you installed Python 2.4, enter
sudo ln -s /Library/Frameworks/Python.framework/Versions/2.4 2.3
If you installed Python 2.5 or you're on Mac OS X 10.5 Leopard, enter
sudo ln -s /Library/Frameworks/Python.framework/Versions/2.5 2.3
FontLab Studio 5 for Windows
FontLab Studio 5 and AsiaFont Studio 5 for Windows work with Python 2.4. You need to download and install it on Windows. Python 2.2 and 2.3 will also work. Python 2.5 will not work.
- Download the latest Python 2.4 release for Windows.
- Run the setup.
- We also recommend that you download and install the Python for Windows extensions. Remember to pick the version that matches your Python version.
- Visit python.org to download additional modules and documentation.
Python in FontLab 4.6
FontLab 4.6 for Mac OS 9 and Mac OS X
FontLab 4.6 for Mac and AsiaFont Studio 4 for mac work with MacPython-OS9 2.3.x (not 2.2 or 2.4!). Then do not work with the "framework" version of Python that is included in Mac OS X but require a separate installation of the so-called Carbon Python (MacPython). Therefore, all users of FontLab 4.6 for Mac OS 9 and for Mac OS X must install MacPython-OS9 2.3.x.
1. Download MacPython-OS9 2.3.3
2. Perform the following steps to complete the installation:
Close FontLab. Install Python by starting the installer. Ignore error messages such as "Installation on Mac OS X will probably fail."
Go to YourHardDisk/Application/Python 2.3.3 and run ConfigurePythonCarbon. Start FontLab. Python should work now but if it isn't, perform additional steps as follows.
Go to YourHardDisk/Library and select the folder called CFMSupport. Select File / Get Info so the CFMSupport Info windows opens. Go to Ownership & Permissions and change Owner from System to your log in. Close this window. Remember to change this permission back to System later when this session ends.
Go to YourHardDisk/Application/Python 2.3.3 and run ConfigurePythonCarbon.
Change the permissions back to System and start FontLab.
FontLab 4.6 for Windows
FontLab 4.6 for Windows and AsiaFont Studio 4 for Windows work with Python 2.2.x (not 2.3 or 2.4!): Download and install Python 2.2.3 for Windows.
How FontLab applications use the Python macro language - and some useful scripts
The Python macro language is a really powerful tool that can save you loads of time in performing tedious tasks. Need to add a bevel to all the characters in your font? A Python macro can do it in a flash. Want to rename all your fonts to add your foundry intials? Do the whole library in seconds with a macro. Got an idea for a new FontLab tool? Write it in Python and add it to the FontLab menus.
The Unofficial FontLab/Python API Reference documents the FontLab/Python scripting API
FontLab Scripting described at Wikibooks
FontLab Macro Setup at Wikibooks
RoboFab extensive documentation
Useful Python-based Software
- RoboFab by Tal Leming, Erik van Blokland and Just van Rossum
Python library that provides an independent font development environment that integrates with FontLab Studio and can be used for font, glyph and metrics manipulation. Free for Mac OS X and Windows. RoboFab requires NumPy (Mac installer on PythonMac) and FontTools TTX.
- FontTools TTX by Just van Rossum
?Low-level? OpenType table editing package written purely in Python. Free for Mac OS X and Windows.
- Adobe FDK for OpenType (AFDKO) by Adobe Systems
Set of high-quality OpenType conversion, editing, production and quality assurance tools, partly written in Python and integrated with FontLab Studio. Free for Mac OS X and Windows.
- FontQA by FontShop International
Font quality assurance framework and test suite for FontLab Studio written in Python and published by FontShop International, allows performing consistency checks across fonts within a font family. Free for Mac OS X and Windows.
- Autopsy by Yanone
A FontLab Studio add-on written in Python for analyzing design consistency across multiple fonts. It visualizes a selection of letters side by side and puts it into a PDF for visual comparison. If visual comparison isn?t enough for you, it dissects what?s there and what?s not and puts that into simple graphs. Free for non-commercial use, licenses 69?399 EUR, for Mac OS X and Windows. Requires ReportLab.
- FeatureProof by Tal Leming
FeatureProof is an application for testing built on top of Compositor that makes it easy for type designers to test OpenType Layout features in fonts. Free for Mac OS X.
- Font Remix Tools by Just Another Foundry
A set of plug-ins for FontLab Studio written in Python that allow scaling of glyphs without affecting the stroke weight.Free for non-commercial use, licenses 99?396 EUR, for Mac OS X and Windows. a set of plug-ins for FontLab Studio, that allow scaling of glyphs without affecting the stroke weight. They allow to:
- tune the width, height and weight of
single letters interactively
- automatically generate small caps
- generate superiors, inferiors, numerators and denominators
- create true condensed and extended versions
- generate tabular figures with only a couple of clicks
- slant glyphs while keeping vertical tangents straight
- Superpolator by Erik van Blokland
Professional typedesign is complex enough as it is: Superpolator breaks free from the conceptual constraints of Multiple Master: work with any number of axes, insert masters where you need them and define, generate all the weights you want. Glyph specific axes, split locations, intermediates, powerful extrapolation. Licenses 250 EUR and up, for Mac OS X. Requires RoboFab.
- PixelBrush by Gustavo Ferreira
A simple tool to draw outline pixel fonts in FontLab Studio. Free for Mac OS X and Windows.
- Compositor by Tal Leming
An OpenType Layout engine. Free for Mac OS X and Windows.
- feaTools by Tal Leming
A collection of tools for working with OpenType Layout feature definition source files in AFDKO .fea format. Free for Mac OS X and Windows.
- Scripts and tools by Tal Leming
A collection of useful FontLab Studio scripts and Python tools. Free for Mac OS X and Windows.
- dialogKit A humane way to build interfaces in FontLab.
- fontAppTools A small collection of tools useful in font editing applications.
- fontMath A collection of objects that implement fast font and glyph math.
- defcon A set of UFO based objects for use in font editing applications.
- defconAppKit A collection of Vanilla objects for use in font editing applications.
- Scripts by Typo.cz
Two sets of macros for FontLab Studio by Typo.cz (Filip Blazek), written in Python. Both sets contain some handy scripts for relabelling of glyphs and for control of the process. The macros will be available near the end of 2008.
- OpenType features set automates generating of special OpenType functions.
- OpenType kerning simplifies the setting of kerning pairs for accented characters.
- Scripts by Ben Kiel. Free for Mac OS X and Windows, optional donation.
- placeAnchor will place anchors on selected glyphs with a name and height of your choosing.
- removeAnchors and removeSelectedAnchors remove either all the anchors from a font or the anchors on selected glyphs in a font.
- buildAccents will build accented characters from glyphs which have anchors.
- betterGenerateFont will make a copy of the font you are working on, remove its overlaps and decompose its characters, then give you the choice of font type to generate.
- Guidelines show how one can add and remove guidelines to a vfb file.
- copySidebearings will copy the sidebearing values from one vfb to another. copySidebearingsToMaster will copy the sidebearings from a font to a specified master in a MM vfb.
- multipleMasterTools will quickly generate any number of instances of a MM face, either as font files or vfb files (or both).
- SVH Helper Script for RoboFab by Brook Elgie
Python script that integrates SVN version control with RoboFab. Free for Mac OS X and Windows.
- RemoteTCP for RoboFab and FontLab by William Lamberta
RemoteTCP is a cross-platform implementation of the RoboFab Remote package that allows FontLab to respond to calls from other applications over a network connection.
- Python Imaging Library by Pythonware
Essential image processing package for Python. Free for Mac OS X and Windows. Mac installer on PythonMac. Windows installer on Pythonware.
- FontLab on Steroids macros by Adam Twardoch
Script for FontLab Studio written in Python, includes Rename glyphs by scheme macro. Free for Mac OS X and Windows.
- Outline Font by Roger Dawkins
Macro to create an outline version of a font: development, script.
- Special Effects by Vince Fitter
Some nice little macros for special effects: Windows version, Macintosh version
- Scripts by Christian Robertson
- Corner Mitring - subtly mitres any extra sharp corners that are created when removing overlaps.
- "Build" scripts - used to assemble font from components.
- Interpolated Nudge - simply moves control points proportionally with the anchor points.
- Auto Add Anchors - adds anchors to the tops/bottoms of common letters.
Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, Perl, Scheme or Java. Originally developed by Guido van Rossum in 1990 it is an open source language and has gained popularity rapidly. For this reason we chose it as the scripting language for FontLab 4 macros.
www.python.org is the official Python website
Python Books and Resources:
Macro Programming, FontLab Studio manual
Python Programming for the Absolute Beginner
FontLab Scripting discussion list
The Python Bookstore