Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mekkablue/c7edf672856700d5292a81203007c310 to your computer and use it in GitHub Desktop.
Save mekkablue/c7edf672856700d5292a81203007c310 to your computer and use it in GitHub Desktop.
Insert #exit and #entry at Baseline
#MenuTitle: Insert #exit and #entry at Baseline
# -*- coding: utf-8 -*-
__doc__="""
Adds #exit and #entry anchors at the sidebearings on the baseline. Useful for glyphs like period that are reused in glyphs like ellipsis.
"""
def process( thisLayer ):
for thisAnchorInfo in (("#entry",0),("#exit",1),):
newAnchor = GSAnchor()
newAnchor.name = thisAnchorInfo[0]
newAnchor.position = NSPoint( thisLayer.width * thisAnchorInfo[1], 0.0 )
thisLayer.anchors.append(newAnchor)
thisFont.disableUpdateInterface() # suppresses UI updates in Font View
thisFont = Glyphs.font # frontmost font
for thisLayer in thisFont.selectedLayers:
thisGlyph = thisLayer.parent
print "Processing %s" % thisGlyph.name
thisGlyph.beginUndo() # begin undo grouping
for thatLayer in thisGlyph.layers:
process( thisLayer )
thisGlyph.endUndo() # end undo grouping
thisFont.enableUpdateInterface() # re-enables UI updates in Font View
@justanotherfoundry
Copy link

Thanks for sharing this!

What exactly is the benefit of building an ellipsis with #exit and #entry rather than using plain Automatic Alignment?

Is it to allow for additional space between the dots? But it would not be applied to the sidebearings of the ellipsis glyph, which is not acceptable. My understanding is that typing the ellipsis several times (like this: ………) must result in a regular spacing of all dots, or at least not be tighter spaced across the glyph border.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment