Forked from schriftgestalt/Show Glyphs with this Anchor.py
Created
December 6, 2015 22:37
-
-
Save weiweihuanghuang/c5dc566c9cba35f2fb8d to your computer and use it in GitHub Desktop.
Show Glyphs with this Anchor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MenuTitle: Show Glyphs with this Anchor | |
# -*- coding: utf-8 -*- | |
__doc__=""" | |
New Tab with all Glyphs that have the selected anchor. | |
""" | |
thisFont = Glyphs.font # frontmost font | |
selectedLayer = thisFont.selectedLayers[0] | |
selection = selectedLayer.selection | |
editString = "" | |
for i, anchor in enumerate(selection): | |
if i > 0: | |
editString += "\n\n" | |
if type(anchor) == GSAnchor: | |
anchorName = anchor.name | |
editString += "%s:\n" % anchorName # add anchor name to the text string | |
for glyph in thisFont.glyphs: | |
thisLayer = glyph.layers[selectedLayer.associatedMasterId] | |
if anchorName in thisLayer.anchors.keys(): | |
editString += "/" + glyph.name | |
if len(editString) > 0: | |
thisFont.newTab(editString) ### Open Tab with all Characters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment