[cantarell-fonts: 105/109] Simplify fontmake wrapper



commit 34c6da7381fda9b95c479c894fd6407e5c069dd2
Author: Nikolaus Waxweiler <madigens gmail com>
Date:   Sat Feb 3 00:52:03 2018 +0000

    Simplify fontmake wrapper

 scripts/fm.py              |   30 ++++++++++++++++++++++++++++++
 scripts/fontmakewrapper.py |   36 ------------------------------------
 2 files changed, 30 insertions(+), 36 deletions(-)
---
diff --git a/scripts/fm.py b/scripts/fm.py
new file mode 100644
index 0000000..a34a5f9
--- /dev/null
+++ b/scripts/fm.py
@@ -0,0 +1,30 @@
+#!/bin/env python3
+#
+# This wrapper works around fontmake's limitation (at the time of this writing)
+# of not being able to specify the output directory for the generated font
+# binaries. The Meson build system's custom target function has fixed
+# expectations about where files must show up. Also, autohint the binaries
+# while we're at it.
+
+from pathlib import Path
+import argparse
+import subprocess
+
+
+parser = argparse.ArgumentParser()
+parser.add_argument("fontmake", type=str, help="The path to fontmake.")
+parser.add_argument("psautohint", type=str, help="The path to psautohint.")
+parser.add_argument("font_source", help="The path to the font source.")
+parser.add_argument("output_dir", help="The full target output path.")
+args = parser.parse_args()
+
+subprocess.run([
+    args.fontmake, "-g", args.font_source, "-i", "-o", "otf", "--verbose",
+    "WARNING"
+])
+
+for otf in Path("./instance_otf").glob("*.otf"):
+    subprocess.run([args.psautohint, "-qq", str(otf)])
+    output_dir = Path(args.output_dir)
+    output_dir.mkdir(exist_ok=True)
+    otf.rename(output_dir / otf.name)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]