]> gitweb.michael.orlitzky.com - charm-bypass.git/commitdiff
sfd2woff: new script to convert sfd source files to woff2 webfonts
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 19 Oct 2023 00:52:39 +0000 (20:52 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 19 Oct 2023 01:16:01 +0000 (21:16 -0400)
sfd2woff [new file with mode: 0755]

diff --git a/sfd2woff b/sfd2woff
new file mode 100755 (executable)
index 0000000..2b2f497
--- /dev/null
+++ b/sfd2woff
@@ -0,0 +1,32 @@
+#!/usr/bin/env fontforge
+#
+# FontForge script to convert its argument (some font file) to
+# woff2. The base name of the file is kept the same and a .woff2
+# extension is added. See,
+#
+#   https://fontforge.org/docs/tutorial/scripting-tutorial.html
+#
+# and the additional documentation for Generate() at
+#
+#   https://fontforge.org/docs/scripting/scripting-alpha.html#Generate
+#
+# Specifically:
+#
+#   fmflags&4 => generate a short "post" table with no glyph name info
+#   in it
+#
+#   fmflags&8 => do not include ttf instructions
+#
+#   fmflags&0x8000 => do not generate an FFTM table
+#
+#   fmflags&0x40000 => do not do flex hints
+#
+#   fmflags&0x80000 => do not include postscript hints
+#
+# And, according to python,
+#
+#   >>> 0x4 + 0x8 + 0x8000 + 0x40000 + 0x80000
+#   819212
+#
+Open($1)
+Generate($1:r + ".woff2","",819212)