diff --git a/scripts/fontforge/ttc2ttf.pe b/scripts/fontforge/ttc2ttf.pe new file mode 100644 index 0000000..080ff9c --- /dev/null +++ b/scripts/fontforge/ttc2ttf.pe @@ -0,0 +1,27 @@ +#!/usr/local/bin/fontforge +# Usage: fontforge -script ttc2ttf.pe /path/to/font.ttc + +# Source: https://gist.github.com/fatum12/941a10f31ac1ad48ccbc + +fonts = FontsInFile($1) +n = SizeOf(fonts) +i = 0 +while (i < n) + Open($1 + "(" + fonts[i] + ")", 1) + + index = ToString(i + 1) + if (i < 9) + index = "0" + index + endif + + ext = ".ttf" + if ($order == 3) + ext = ".otf" + endif + + filename = $fontname + "-" + index + ext + Generate(filename) + Print(filename) + Close() + ++i +endloop