Home arrow Python Scripting
FontLab Products
Home
Font Editors
Font Converters
Font Utilities
Photofont
All Products
About Fontlab Ltd.
About Fontlab
Press Releases
Contact Fontlab Ltd.
Fontlab EULA
Purchase Options
Buy Online
Academic Purchases
Worldwide Distributors
For Developers
Associates
Earn Money as a FontLab Associate
Edit Account
Sales Summary
Python Scripting

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. 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, 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.:

  1. Log in as administrator into Mac OS X.
  2. Download and install the latest Python 2.4 or 2.5 release for Mac OS X.
  3. Open the Terminal application.
  4. Enter the following lines:
    cd /System/Library/Frameworks/Python.framework/Versions
    sudo mv 2.3 2.3.bak

    (enter your administrator password)
  5. If you installed Python 2.4, enter
    sudo ln -s /Library/Frameworks/Python.framework/Versions/2.4 2.3
    or if you installed Python 2.5, 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.

  1. Download the latest Python 2.4 release for Windows.
  2. Run the setup.
  3. We also recommend that you download and install the Python for Windows extensions. Remember to pick the version that matches your Python version.
  4. 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.


A more detailed explanation of how FontLab applications use the Python macro language and some examples of scripts by users.

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 FontLab/Python API is documented at:
The Unofficial FontLab/Python API Reference


RoboFab

is an excellent impressive Python library the builds upon FontLab and can be used for font, glyph and metrics manipulation. RoboFab works with FontLab, although it can also to some extent work in "pure Python." RoboFab was developed by Tal Leming, Erik van Blokland and Just van Rossum.


Python Background

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 language web site. This site has or has links to everything you could possibly want to know about Python, including some fine tutorials.


Python FontLab macro demos

Roger Dawkins writes a macro to create an outline version of a font

The development
Finished script

Adam Twardoch's "FontLab on Steroids" script set (includes Rename glyphs by scheme [TTG] macro)
Windows version  Macintosh version

Vince Fitter has made some nice little macros for special effects:
Windows version Macintosh version


Gustavo Ferreira made a pixel brush to draw outline bitmap fonts in Fontlab.

 

Python Books and Resources:

Macro Programming, FontLab Studio manual

Python Programming for the Absolute Beginner

FontLab Scripting discussion list

The Python Bookstore

Python Shareware for FontLab

Do you have a script that others might find useful? Share it here!

Python Freeware for FontLab

want to donate a script to the community? Send it in!