# GSLayer Anchors

*API Collection*

Named attachment points on a layer.

## Overview

Anchors are named positions used for mark attachment, component alignment, cursive attachment, and other use cases.

Component traversal resolves anchors from components as if those components contributed their anchors to the layer. The resolved anchors use the component transform and component anchor settings.

## Topics

- [`GSAnchor`](/Core/GlyphsCore/GSAnchor) — A named point in a layer used for attachment and positioning.

### Anchors

- [`GSLayer.anchors`](/Core/GlyphsCore/GSLayer/anchors) — Layer anchors keyed by anchor name.
- [`GSLayer countOfAnchors`](/Core/GlyphsCore/GSLayer/countOfAnchors) — The number of anchors on the layer.
- [`GSLayer addAnchor:`](/Core/GlyphsCore/GSLayer/addAnchor:) — Adds or replaces an anchor by name.
- [`GSLayer setAnchorArray:`](/Core/GlyphsCore/GSLayer/setAnchorArray:) — Replaces all anchors with anchors from an array.
- [`GSLayer setAnchorArrayFast:`](/Core/GlyphsCore/GSLayer/setAnchorArrayFast:) — Replaces all anchors without undo registration or change notifications.
- [`GSLayer removeAnchor:`](/Core/GlyphsCore/GSLayer/removeAnchor:) — Removes an anchor from the layer.
- [`GSLayer removeAnchorWithName:`](/Core/GlyphsCore/GSLayer/removeAnchorWithName:) — Removes the anchor with a name.
- [`GSLayer switchAnchorFastName:withName:`](/Core/GlyphsCore/GSLayer/switchAnchorFastName:withName:) — Swaps two anchor names without undo registration or change notifications.
- [`GSLayer anchorChangedName:`](/Core/GlyphsCore/GSLayer/anchorChangedName:) — Updates layer anchor lookup after an owned anchor changes its name.

### Anchor Lookup

- [`GSLayer anchorForName:`](/Core/GlyphsCore/GSLayer/anchorForName:) — Anchor for a name.
- [`GSLayer anchorForName:traverseComponents:`](/Core/GlyphsCore/GSLayer/anchorForName:traverseComponents:) — Anchor for a name, optionally resolving component anchors.

### Component Anchors

- [`GSLayer anchorNamesTraversingComponents`](/Core/GlyphsCore/GSLayer/anchorNamesTraversingComponents) — Anchor names available after resolving component anchors.
- [`GSLayer anchorNamesTraversingComponentsStopAtComponent:`](/Core/GlyphsCore/GSLayer/anchorNamesTraversingComponentsStopAtComponent:) — Anchor names available before a component in shape order.
- [`GSLayer anchorsTraversingComponents`](/Core/GlyphsCore/GSLayer/anchorsTraversingComponents) — Anchors available after resolving component anchors.
- [`GSLayer anchorDictTraversingComponents`](/Core/GlyphsCore/GSLayer/anchorDictTraversingComponents) — Anchors available after resolving component anchors, keyed by anchor name.
- [`GSLayer copyAnchorsFromComponents`](/Core/GlyphsCore/GSLayer/copyAnchorsFromComponents) — Copies resolved component anchors into the layer.

### Anchor Utilities

- [`GSLayer anchorName:forScale:`](/Core/GlyphsCore/GSLayer/anchorName:forScale:) — Anchor name adjusted for a component scale.

### Anchor Locks

- [`GSLayer lockReadAnchors`](/Core/GlyphsCore/GSLayer/lockReadAnchors) — Acquires the read lock for anchors.
- [`GSLayer unlockReadAnchors`](/Core/GlyphsCore/GSLayer/unlockReadAnchors) — Releases the read lock for anchors.
- [`GSLayer lockWriteAnchors`](/Core/GlyphsCore/GSLayer/lockWriteAnchors) — Acquires the write lock for anchors.
- [`GSLayer unlockWriteAnchors`](/Core/GlyphsCore/GSLayer/unlockWriteAnchors) — Releases the write lock for anchors.

## See Also

- [GSLayer Kind](/Core/GlyphsCore/GSLayer-Kind) — The different roles that a layer can serve.
- [GSLayer Shapes](/Core/GlyphsCore/GSLayer-Shapes) — The paths and components that form the outline of a layer.
- [GSLayer Bounds](/Core/GlyphsCore/GSLayer-Bounds) — Bounding rectangles of outlines, selections, and metrics.
- [GSLayer Metrics](/Core/GlyphsCore/GSLayer-Metrics) — Side bearings, baseline offsets, layer box, and metrics keys.
- [GSLayer Grid](/Core/GlyphsCore/GSLayer-Grid) — Setting for rounding coordinates on a layer.
- [GSLayer Background](/Core/GlyphsCore/GSLayer-Background) — Background content and reference images associated with a layer.
- [GSLayer Hints](/Core/GlyphsCore/GSLayer-Hints) — Manual and generated hint data on a layer.
- [GSLayer Guides](/Core/GlyphsCore/GSLayer-Guides) — Layer-local guides used while editing outlines.
- [GSLayer Kerning](/Core/GlyphsCore/GSLayer-Kerning) — Spacing adjustment between specific layers.
- [GSLayer Annotations](/Core/GlyphsCore/GSLayer-Annotations) — Layer-local notes displayed with a glyph.
- [GSLayer Interpolation](/Core/GlyphsCore/GSLayer-Interpolation) — Axis coordinates and rules that place layers in a design space.
- [GSLayer Color](/Core/GlyphsCore/GSLayer-Color) — Colors used to draw a layer.
- [GSLayer Attributes](/Core/GlyphsCore/GSLayer-Attributes) — Additional values stored for a layer.
- [GSLayer Inspection](/Core/GlyphsCore/GSLayer-Inspection) — Intersections between layer outlines and line segments.
- [GSLayer Editing](/Core/GlyphsCore/GSLayer-Editing) — Operations for modifying outlines and other layer content.

