How can I convert TTF files to OTF format?

you can use TTF file format directly in css :

@font-face { 
font-family: Vinegar; 
src: url(http://www.4bit.co.uk/testing/design01/vinegar.ttf); 
}

h3 {
font-family: Vinegar, "Times New Roman", Times, serif;
}

It is working!

Or you can use this link to generate your font face!


It was painfully hard to find how to do it correctly. Here is how I got it to work on OS X

$ brew install fontforge
$ fontforge  -c 'Open("my.ttf"); Generate("my.otf")'

I was desperately looking for pip install fontforge which does not exist and I haven't got it to work with python - I guess you need to compile it with --enable-pyextension or something.


If you are on Linux, you can use FontForge, which can be scripted from Python.

#!/usr/bin/python
import fontforge
font = fontforge.open("STIXGeneral.otf")
font.generate("STIXGeneral.ttf")

Here is a longer python script that does this for a whole directory at a time:

http://fonts.fileformat.info/bin/otf2ttf.py


A quick Google search for ttf otf converter gave me a number of results, such as:

https://onlinefontconverter.com

http://www.freefontconverter.com

http://www.font2web.com

No idea how well they work, but you can try them.