Installing Custom Fonts with Pythonista

Until today, I was completely unaware that it's possible to install custom fonts on iOS, even though this is officially documented by Apple. In a nutshell, it works pretty much like installing custom homescreen shortcuts, i.e. via configuration profiles that contain the TTF file's data as a payload.

There's a $1.99 app called AnyFont that makes this pretty convenient, and MyFonts has also enabled installing your purchases on iOS in the same way.

I've experimented with creating configuration profiles via Pythonista before, so I thought it might be fun to write a simple script for installing fonts as well, and here it is:

→ [GitHub]

This is also a nice use case for Pythonista's Open in... menu integration. You can select this script in Pythonista's settings as the handler for opening files from other apps. Then just download a TTF file with Safari, and open it in Pythonista, which will automatically launch the script to install the font (the script gets the file path as a command-line argument).

If you launch the script directly, without using the Open in... menu integration, you'll simply be asked for the URL of a TTF file you'd like to install.

The script creates a configuration profile (basically just an xml file) with the font data, and lets Safari download it by starting a local HTTP server.

After installing a custom font, you can just use it in a lot of apps (e.g. the iWork suite). Before you ask: Editorial does not support custom fonts at the moment.