Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Convert woff to ttf in python

Apparently it's so hard on the Internet to search for the answer to query "convert woff to ttf python". But an important nugget of information is available on a random github issue, where anthrotype said:

Or via python code, you can

from fontTools import ttLib

font = ttLib.TTFont("MyFont.woff")
font.flavor = None  # was "woff"; `None` restores the default value, for

non-compressed OpenType font.save("MyFont.ttf")

Use system package python3-fonttools. This is for a woff version 1 (not woff2) file specifically, but this library supports multiple filetypes so it will probably do woff2 just fine.

Comments