1
votes

I've mastered command-line font conversion to and from all the main formats in use these days with one exception. Certain woff2 files just wont decompress using the official tools on GitHub. I know they are not corrupt and I know the file-type is correct. I had the same problems when trying some of the top commercial converters, as well as many free online utilities. For some reason, the only one that works with these problematic woff2 files is EverythingFonts. My best guess WHY is that perhaps some woff2 fonts may employ experimental bleeding-edge features that aren't compatible with the stable public decoders currently available on GitHub.

The metadata in output indicates the conversion makes use of the "AFDKO" package of command-line tools (Adobe's Font Development Kit for Opentype), which are also available for free on GitHub or Adobe's site.

I dislike the online converters because most impose size restrictions, limit the number of conversions, and only convert a single file at a time. Plus I'm not always online. So, to clarify, my foremost question is:

What is the proper command and syntax to use when trying to input a woff2 file and output a ttf or otf file, using the makeotf binary within AFDKO? I'm open to answers that don't require this Adobe kit, if anyone has suggestions that I haven't tried.

My goal is to write a script that will automate batch-conversion, as I have for other font formats. Once that is achieved I plan on sharing my work with the world and launch an online font-info and conversion site free to all, without limitations. My server is Linux based if anyone has input toward that end. I'll also make the offline binaries available for free, but that will take time.

1
We can't trust you when you say "I know they are not corrupt". What did you use to verify that? Because the tools you used for that may themselves not be correct. "They work" is not proof enough: browsers can be lenient when it comes to fonts that do not adhere to the WOFF2-wrapped OpenType spec, in the same way they'll often load pages with broken-according-to-the-spec HTML code. AFDKO is not so kind: it will not accept malformed fonts, even if they "work".Mike 'Pomax' Kamermans
On a secondary note, this is a pretty font-specific question, so asking on typedrawers.com is going to yield an answer in hours where on Stackoverflow it'll take days before someone with any expertise discovers it.Mike 'Pomax' Kamermans

1 Answers

1
votes

If all you need is conversion to/from specific formats, the first port of call is TTX, a Python-based utility found over on https://github.com/fonttools/fonttools (note: it will need the brotli package installed separately if you're going to work with WOFF2 files).

It also comes with better error reporting than the AFDKO command line utilities, so that if things still don't work, you'll know where in the parsing of the font things go wrong.