[cantarell-fonts] Add normalization script
- From: Nikolaus Waxweiler <nwaxweiler src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cantarell-fonts] Add normalization script
- Date: Tue, 22 Dec 2020 21:41:03 +0000 (UTC)
commit a725d7263691ca66c0e65f4ddc6b8df1ae436b72
Author: Nikolaus Waxweiler <madigens gmail com>
Date: Tue Dec 22 21:40:39 2020 +0000
Add normalization script
scripts/normalize.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
---
diff --git a/scripts/normalize.py b/scripts/normalize.py
new file mode 100644
index 00000000..85b96b43
--- /dev/null
+++ b/scripts/normalize.py
@@ -0,0 +1,48 @@
+from pathlib import Path
+
+import ufoLib2
+
+
+source_directory = Path(__file__).parent.parent / "src"
+for ufo_path in source_directory.glob("*.ufo"):
+ ufo = ufoLib2.Font.open(ufo_path)
+
+ layer_names = [l.name for l in ufo.layers]
+ for name in layer_names:
+ if name != "public.default":
+ del ufo.layers[name]
+
+ ufo.layers.defaultLayer.lib = {
+ k: v for k, v in ufo.layers.defaultLayer.lib.items() if k.startswith("public.")
+ }
+
+ for glyph in ufo:
+ glyph.lib = {
+ k: v
+ for k, v in glyph.lib.items()
+ if (
+ k.startswith("public.")
+ or k.startswith("com.schriftgestaltung.Glyphs.")
+ or k == "com.schriftgestaltung.componentsAlignment"
+ )
+ and k != "public.markColor"
+ }
+
+ ufo.lib = {
+ k: v
+ for k, v in ufo.lib.items()
+ if k.startswith("public.")
+ or k.startswith("com.github.googlei18n.ufo2ft.")
+ or (
+ k
+ in {
+ "com.schriftgestaltung.fontMasterID",
+ "com.schriftgestaltung.customParameter.GSFont.disablesLastChange",
+ "com.schriftgestaltung.customParameter.GSFontMaster.paramArea",
+ "com.schriftgestaltung.customParameter.GSFontMaster.paramDepth",
+ "com.schriftgestaltung.customParameter.GSFontMaster.paramOver",
+ }
+ )
+ }
+
+ ufo.save()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]