Created
January 1, 2021 11:28
-
-
Save wolkenschieber/6d5bc93a99d8f918f82953310b232824 to your computer and use it in GitHub Desktop.
Convert WOFF and WOFF2 to TTF using fontforge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o nounset | |
shopt -s nullglob | |
function convertFont() { | |
fontfile="${1}" | |
filename=$(basename -- "$fontfile") | |
extension="${filename##*.}" | |
filename="${filename%.*}" | |
targetfontfile="${filename}.ttf" | |
echo "Converting ${fontfile} to ${targetfontfile}" | |
fontforge -lang=ff -c 'Open($1); Generate($2)' "${fontfile}" "${targetfontfile}" | |
} | |
function main() { | |
for wofffile in *.woff; do | |
convertFont "${wofffile}" | |
done; | |
for woff2file in *.woff2; do | |
convertFont "${woff2file}" | |
done; | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment