Class
GSAnchor
A named point in a layer used for attachment and positioning.
Declaration
class GSAnchorDeclaration
@interface GSAnchor : GSElementDeclaration
class GSAnchor(GSElement)Overview
Anchor names determine how an anchor is used. A base anchor such as top pairs with the corresponding mark anchor _top. Other naming schemes support ligatures, cursive attachment, component placement, and contextual mark attachment.
The position is expressed in layer coordinates. The inherited orientation can make the horizontal position relative to the layer width.
A layer identifies its anchors by name and can contain at most one anchor for each name. Use the layer anchor APIs to attach or detach an anchor, and use name to rename an attached anchor so that the layer lookup remains consistent.
Anchor Naming
Anchors are defined by their name. The following list covers naming schemes and names for which Glyphs provides specialized handling.
Built-in Naming Schemes
Base anchors use names such as
top; mark anchors use the same name with a leading underscore, such as_top.Ligature anchors append a one-based component index after an underscore, such as
top_1andtop_2.Ligature caret anchors use
caret_N, such ascaret_1.Cursive attachment anchors use
entryandexit. Cursive anchors can use the same suffix after each name to form separate cursive lookups, such asentry.medialandexit.medial. Use cursive attachment inside the Glyphs source file without exposing the anchors to the exported font files by prefixing the anchor name with#:#entryand#exit.Component connection anchors use
connecton both the containing layer and the component glyph. Unlike mark attachment, the matching anchor on the component glyph has no leading underscore. Connection anchors are not treated as mark attachment anchors during anchor propagation.Context anchors are designated by prefixing the name with
*, such as*top. A period suffix on a context anchor separates the mark class name from a local disambiguation suffix, such as*top.case.Mirrored components swap directional anchor names such as
leftandright,topandbottom,entryandexit, andogonekandogonekabove.
Well-known Anchor Names
top,bottom,_top, and_bottomhave special behavior during component anchor traversal.left,right,top,bottom,center,ogonek,ogonekabove,nukta,candra,imatra, andiimatraare recognized by built-in anchor placement.topleft,topright,bottomleft,bottomright,bindu, andcandrabinduare recognized when generating Indic mark positioning.top_cantillation_finalandbottom_cantillationhave special handling for Hebrew mark positioning.LSB,RSB,TSB,BSB,HALT,VHAL,lfbd, andrtbdare used to generate spacing feature code.*originis reserved for component origin adjustment and is not a context anchor.dotbelowand names containingbottomhave special handling for Myanmar mark-to-mark positioning.Corner glyphs use fixed anchor names such as
left,right,origin,node1,node2,start,end, anddirection.
Topics
Creating an Anchor
Creates a detached anchor.
Anchor Identity
The name that determines the attachment role.
Sets the name without copying it or updating an owning layer.
Context Anchors
The OpenType feature context for a context anchor, or
nilwhen none is specified.
Equality
Whether another anchor has the same position, name, attachment role, lock state, orientation, and attributes.
Relationships
Inherits From
Conforms To
NSCodingNSCopying- GSSelectableElementProtocol
- GSUserDataProtocol
ObjectiveC.NSObjectProtocolSwift.CVarArgSwift.CustomDebugStringConvertibleSwift.CustomStringConvertibleSwift.EquatableSwift.Hashable
Relationships
Inherits From
Conforms To
NSCodingNSCopying