summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2020-03-23 03:03:13 +0300
committerRasmus Andersson <rasmus@notion.se>2020-03-23 03:03:13 +0300
commit381291fe47dbc9fdd1dfd3bad824cfdaad531050 (patch)
tree5b4afbb14018ff2de29c3a385da7b47f4e7e7abd
parenta7ca5079e583f577d79504744f6656f8c65be0d8 (diff)
downloadinter-381291fe47dbc9fdd1dfd3bad824cfdaad531050.tar.xz
tooling: add guide copy script
-rw-r--r--misc/glyphs-scripts/copy-guides.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/misc/glyphs-scripts/copy-guides.py b/misc/glyphs-scripts/copy-guides.py
new file mode 100644
index 000000000..b444ab585
--- /dev/null
+++ b/misc/glyphs-scripts/copy-guides.py
@@ -0,0 +1,43 @@
+#MenuTitle: Copy guides from Regular & Italic to other masters
+# -*- coding: utf-8 -*-
+import GlyphsApp
+import copy
+
+Glyphs.clearLog()
+font = Glyphs.font
+
+romanMasterName = "Regular"
+italicMasterName = "Italic"
+
+guidesRoman = None
+guidesItalic = None
+
+guideNames = [
+ "cap center", # 0
+ "low center", # 1
+ "",
+ "",
+]
+
+for master in font.masters:
+ if master.name == "Regular":
+ guidesRoman = master.guides
+ if master.name == "Italic":
+ guidesItalic = master.guides
+
+# rename guides (order is horizontal top to bottom, then vertical)
+for i in range(0, len(guidesRoman)):
+ guidesRoman[i].name = guideNames[i]
+ guidesItalic[i].name = guideNames[i]
+
+if regularGuides is None:
+ print("mainMasterName=%r master not found" % mainMasterName)
+else:
+ for master in font.masters:
+ print(master.name)
+ if master.name.find("Italic") != -1:
+ if master.name != guidesItalic:
+ master.guides = [copy.copy(u) for u in guidesItalic]
+ else:
+ if master.name != guidesRoman:
+ master.guides = [copy.copy(u) for u in guidesRoman]