I have been using a great open-source python script by GitHub user @hanikesn (see below) that converts a single WOFF file back into OTF format via command line (Terminal on Mac OS X).
As it is now, I drag-and-drop the script to Terminal, then drag-and-drop a WOFF file to Terminal, press Enter, and the script creates an OTF in the same directory. The script can be invoked manually, but I find it much easier and much faster to drag-and-drop. However as a typographer, I work with large font-families, some of them have over 100 styles each, so I need a batch conversion tool. I know there are some tools online, but these usually have a size limit unless you pay for the service, and the results are never as consistent as this script. Besides, I would like to have an offline tool.
I would like to modify it to run on a directory (folder of WOFFs) rather than a single file. Ideally I would like to drag-and-drop the script into terminal, and then drag-and-drop a folder. The script should only attempt to convert files with the .woff extension.
When I asked the creator of the script, he said "This can easily be done with a simple one line shell script:
for file in *.woff; do woff2otf.py $file; done
However I don't know how to implement this. I am not a programmer, but I've had to work with some basic python scripting in my typography projects. So, please explain it to me like I'm 5.
If you want create an Drag&drop app, you could:
Filter Finder Items
actionextenstion is
woff conditionRun Shell Script
actionPass input
popup to as argumentswoff2otf.py
into the place of the echo (you will get it's full path name)woff2otf.app
Just drag the woff
files into the application icon and it should convert them. I can't test it, because i havent installed python3
.
The final app should be as in the following screenshot:
EDIT:
If your python3
command isn't in the standard command search $PATH
, you must change the line:
/path/to/the/woff2otf.py "$f"
to/path/to/your/python3 /path/to/the/woff2otf.py "$f"
I installed python3
using anyenv
- e.g. it wont help you. Therefore my python3 is:
$ type python3
python3 is /opt/anyenv/envs/pyenv/shims/python3
so the line in the shell script (for me) looks like:
/opt/anyenv/envs/pyenv/shims/python3 ~/bin/woff2otf.py "$f"
But, your installation is surely different.
Also could help: