Generating outline fonts with 5 lines of code

Contrary to popular belief, free software has its own gems which easily outshine their proprietary counterparts. One of our favourite examples of this is Fontforge.

Though one might be misled by its peculiar user interface, Fontforge is a very elegant and powerful tool for type design. However, we think the real killer feature of Fontforge is its Python scripting interface. It means you can write your own scripts calling on Fontforge operations, dispensing with the GUI and allowing for some very interesting batch-processing approaches. Plus, the Python bindings are exhaustively documented.

Douar Outline

The window on the left is the GNOME font previewer showing an outline version of VTF Foundry's Douar font, which is licensed with the Open Font License, allowing us to hack it without mercy.

The real kicker is that the font was generated using a 5-line script.

import fontforge
font = fontforge.open('douar.sfd')
for glyph in font:
    font[glyph].stroke('circular',  30, 'square', 'bevel', ('cleanup',))
font.generate('douar-new.ttf')

This outline effect can now be applied to any font file. Not bad!