Convert in command line an sfd file (fontforge) to ttf, otf, woff, svg
You can do it with Fontforge, see here:
-c script-string
If FontForge's first (or second, if the first is -lang) argument is "-c" then the argument that follows will be treated as a string containing scripting commands, and those commands will be executed. All remaining arguments will be passed to the script.
$ fontforge -c 'Open($1); Generate($2)' foo.sfd foo.ttf
Will read a font from "foo.sfd" and then generate a truetype font from it called "foo.ttf"
In your case you can create a script, say convertsfd
, like this
#!/bin/bash
fontforge -lang=ff -c 'Open($1); Generate($2)' "$1" "$2"
make it executable, and call it like this:
$ ./convertsfd foo.sfd foo.ttf
Change the second argument to foo.otf
or to other formats as needed, I only tested with ttf
and otf
.
To call the script from anywhere, just place it in your ~/.local/bin
, or some other directory in your PATH
.