Skip to content

Instantly share code, notes, and snippets.

@benjaminblack
Last active September 10, 2018 15:00
Show Gist options
  • Save benjaminblack/acb56e59404af73dc8d70a211cd910fa to your computer and use it in GitHub Desktop.
Save benjaminblack/acb56e59404af73dc8d70a211cd910fa to your computer and use it in GitHub Desktop.
Converting fonts to WOFF

For some reason, font foundries still do not routinely include web font files, even when the font face is specifically licensed for use on the web, and will only provide the fonts in TrueType (TTF) format.

There is no need to use a sketchy online converter that might illegally save a copy of your expensively-licensed font.

Google maintains free software (MIT) command-line utilities to compress and decompress WOFF2 files.

"Converting" (really, just encoding and compressing) TTF to WOFF is as simple as:

$ woff2_compress myfont.ttf

If supporting IE is necessary, ttf2woff is a free software (MIT) legacy library available in NPM and is similarly easy to use:

$ npx ttf2woff myfont.ttf myfont.woff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment