-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathRemove Extraneous Mark Anchors.py
More file actions
35 lines (32 loc) · 1.1 KB
/
Remove Extraneous Mark Anchors.py
File metadata and controls
35 lines (32 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#MenuTitle: Remove Extraneous Mark Anchors
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__ = """
Remove anchors from marks which don't belong
"""
def process(thisGlyph):
for thisLayer in thisGlyph.layers:
if thisLayer.anchors["_top"]:
del thisLayer.anchors["bottom"]
if thisLayer.anchors["_bottom"]:
del thisLayer.anchors["top"]
thisFont = Glyphs.font # frontmost font
selectedLayers = thisFont.selectedLayers # active layers of selected glyphs
Glyphs.clearLog() # clears log in Macro window
thisFont.disableUpdateInterface() # suppresses UI updates in Font View
try:
for thisLayer in selectedLayers:
thisGlyph = thisLayer.parent
print("🔠 %s" % thisGlyph.name)
thisGlyph.beginUndo() # begin undo grouping
process(thisGlyph)
thisGlyph.endUndo() # end undo grouping
except Exception as e:
Glyphs.showMacroWindow()
print("\n⚠️ Error in script: Shine Through Anchors\n")
import traceback
print(traceback.format_exc())
print()
raise e
finally:
thisFont.enableUpdateInterface() # re-enables UI updates in Font View