From a7d65d5d5ff8f76f6ea2a1468a134ff62e283988 Mon Sep 17 00:00:00 2001 From: Rasmus Andersson Date: Sun, 26 May 2019 16:38:36 -0700 Subject: [PATCH] tooling: Adds glyphs script for selecting empty glyphs --- misc/glyphs-scripts/select-empty-glyphs.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 misc/glyphs-scripts/select-empty-glyphs.py diff --git a/misc/glyphs-scripts/select-empty-glyphs.py b/misc/glyphs-scripts/select-empty-glyphs.py new file mode 100644 index 000000000..a990cd3e8 --- /dev/null +++ b/misc/glyphs-scripts/select-empty-glyphs.py @@ -0,0 +1,18 @@ +# +# Selects all glyphs which are empty +# +import sys + +def isEmpty(g): + for master in g.parent.masters: + layer = g.layers[master.id] + if layer.bounds is not None and layer.bounds.size.width > 0: + return False + return True + +font = Glyphs.font +font.disableUpdateInterface() +try: + font.selection = [g for g in font.glyphs if isEmpty(g)] +finally: + font.enableUpdateInterface()