]> de.git.xonotic.org Git - xonotic/mediasource.git/blobdiff - fonts/xolonium/tools/make-woff.py
Update Xolonium sources to version 4.2
[xonotic/mediasource.git] / fonts / xolonium / tools / make-woff.py
diff --git a/fonts/xolonium/tools/make-woff.py b/fonts/xolonium/tools/make-woff.py
new file mode 100755 (executable)
index 0000000..27ff8bc
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+# Creates woff or woff2 webfont.
+
+import sys
+from fontTools import subset
+from fontTools.ttLib import sfnt
+
+
+# Read arguments
+SOURCE = sys.argv[1] # *.ttf
+TARGET = sys.argv[2] # *.woff|*.woff2
+
+
+# Set zopfli iterations
+sfnt.ZOPFLI_LEVELS[sfnt.ZLIB_COMPRESSION_LEVEL] = 500
+
+
+# Save font
+subset.main([
+       SOURCE,
+       "--glyphs=*",
+       "--no-ignore-missing-unicodes",
+       "--notdef-glyph",
+       "--notdef-outline",
+       "--recommended-glyphs",
+       "--layout-features=*",
+       "--hinting",
+       "--no-desubroutinize",
+       "--no-legacy-kern",
+       "--name-IDs=*",
+       "--no-name-legacy",
+       "--no-glyph-names",
+       "--no-legacy-cmap",
+       "--no-symbol-cmap",
+       "--no-recalc-bounds",
+       "--no-recalc-timestamp",
+       "--canonical-order",
+       "--prune-unicode-ranges",
+       "--no-recalc-average-width",
+       "--with-zopfli",
+       "--flavor=%s" % TARGET.split(".")[-1],
+       "--output-file=%s" % TARGET
+       ])