How to convert WOFF to TTF/OTF via command line?

2019-03-08 04:06发布

I know about services like Online Font Converter, but I am interested in offline solution, preferably over command line. Does anyone know a tool or workflow how to convert WOFF to OTF/TTF offline?

6条回答
Animai°情兽
2楼-- · 2019-03-08 04:21

Ive been looking for this too but, sorry i couldn't find an offline one but i found this:

http://orionevent.comxa.com/woff2otf.html - no longer available

its really good

EDIT: Found a command line tool

https://superuser.com/questions/192146/converting-from-woffweb-open-font-format

查看更多
仙女界的扛把子
3楼-- · 2019-03-08 04:27

EverythingFonts has an online tool that appears to work well.

If you wish to do it offline, following Erik Tjernlund's answer on Super User, you can downloaded the source and compile executables of woff2sfnt and sfnt2woff.

The latest version as of this writing was from 2009/09/09. Unfortunately I've discovered that it doesn't appear to work for all WOFF files, sometimes complaining of a bad signature and sometimes simply giving a broken OTF file.

查看更多
ら.Afraid
4楼-- · 2019-03-08 04:34

I wrote a simple tool for that:

https://github.com/hanikesn/woff2otf

Currently only tested with ttf files.

查看更多
可以哭但决不认输i
5楼-- · 2019-03-08 04:35

I used the python script linked above by barethon to write an online javascript converter of WOFF to OTF

查看更多
不美不萌又怎样
6楼-- · 2019-03-08 04:36

I realise this thread has been inactive for some time now, but with the help of a few stackoverflow users, I was able to use the above mentioned python script [woff2otf.py by @hanikesn] to create a workflow allowing batch conversion of woff files.

If not for the original poster's use, then for others who come across this thread in search of the same thing, check out my thread for details on how to do this:

Modify Python Script to Batch Convert all "WOFF" Files in Directory

Even if you don't need to batch convert, onlinefontconverter.com produces unreliable results, and everythingfonts.com has a 0.4 MB limit on conversions unless you upgrade to a paid account, and both are needlessly time consuming compared to offline solutions.

Good luck!

查看更多
【Aperson】
7楼-- · 2019-03-08 04:38

Here is the reference code for making WOFF files: http://people.mozilla.org/~jkew/woff/ I have a mirror: https://github.com/samboy/WOFF

To compile and install, make sure you have the zlib development libraries installed (e.g. in CentOS6 yum -y install zlib-devel as root), then

git clone https://github.com/samboy/WOFF
cd WOFF
make

Then, as root:

cp sfnt2woff /usr/local/bin

Once this is done, to make a webfont, enter the directory with the .ttf file, then run sfnt2woff

sfnt2woff Chortle2014f.ttf

This creates a Chortle2014f.woff webfont file. Replace “Chortle2014f.ttf” with the name of the actual webfont to convert.

The first link I provide has Windows and MacOS binaries for people who do not wish to install a compiler.

Here is the reference code for making WOFF2 files: https://github.com/google/woff2 Note that this code will not install in CentOS6, but compiles and installs just fine in CentOS7:

git clone --recursive https://github.com/google/woff2.git
cd woff2
make clean all

woff2 font generation is similar:

woff2_compress Chortle2014f.ttf
查看更多
登录 后发表回答