Converting Ttf to Woff

Converting Ttf to Woff

I have been trying to convert TTF to WOFF using various command line and online tools. I have tried following :

Command line :

  • sfntwoff :
  • ttf2woff :
  • ruby gem :

Online :

  • font squirrel :
  • transfonter :

I have ttf file of size ~220KB. All these tools generate woff file of size around 100KB except for font-squirrel which generates a size optimized file of ~20KB.

I am curious as to what font-squirrel does which no other command-line (read open source) tool is able to do. And if possible how can I do the same via command-line, even if it involves writing or hacking some code.

3 Answers

I'm using Jonathan Kew's sfnt2woff program and am amazed to see how small the .woff files are.

I couldn't believe that compression is lossless. Thus I tried:

sfnt2woff CharisSIL-R.ttf
woff2sfnt CharisSIL-R.woff > CharisSIL-R_converted.ttf 
cmp CharisSIL-R.ttf CharisSIL-R_converted.ttf
echo $?

according to cmp(1) there is no difference between the font converted to woff and back to ttf and the original ttf file.

1

Simply doing WOFF compression should yield very similar file sizes, regardless of tool used.

I expect Font Squirrel is doing more to account for that extra 80kB savings, like stripping hints, dropping OpenType features like small caps, or subsetting to support only western languages.

You could use TTX/FontTools to inspect the files before and after conversion, and see what's changed.

1

You can use the Fontdrop website to compare the original font set against the new one generated by FontSquirrel. In my case, the converted font set had support for 64 languages in comparison to 99 languages on the original file. Also, the converted version had fewer features than the original.

The information provided by Fontdrop will probably help you make a decision if the converted set from FontSquirrel is enough for you or if you should try another conversion tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.