# GSLayer Editing

*API Collection*

Operations for modifying outlines and other layer content.

## Overview

Selection-sensitive operations apply to the selected elements when the layer has a selection and otherwise apply to all applicable elements. Fast operations are intended for controlled bulk changes and omit parts of normal edit bookkeeping.

## Topics

### Connecting Paths

- [`GSLayer connectPathsWithNode:andNode:`](/Core/GlyphsCore/GSLayer/connectPathsWithNode:andNode:) — Connects two path endpoints.
- [`GSLayer connectPathsWithNode:andNode:extendPath:`](/Core/GlyphsCore/GSLayer/connectPathsWithNode:andNode:extendPath:) — Connects two path endpoints and optionally adjusts their adjacent segments.
- [`GSLayer dividePathAtNode:`](/Core/GlyphsCore/GSLayer/dividePathAtNode:) — Opens or divides the path at a node.
- [`GSLayer reconnectNodesAtNode1:node2:offset:`](/Core/GlyphsCore/GSLayer/reconnectNodesAtNode1:node2:offset:) — Divides paths at two on-curve nodes and reconnects the resulting endpoints crosswise.
- [`GSLayer reconnectNodes:`](/Core/GlyphsCore/GSLayer/reconnectNodes:) — Reconnects four on-curve nodes according to their tangent directions.
- [`GSLayer connectAllOpenPaths`](/Core/GlyphsCore/GSLayer/connectAllOpenPaths) — Connects coincident endpoints of open paths.
- [`GSLayer closeOpenPaths:`](/Core/GlyphsCore/GSLayer/closeOpenPaths:) — Connects the nearest endpoints of a collection of open paths.

### Cleaning Paths

- [`GSLayer cleanUpPaths`](/Core/GlyphsCore/GSLayer/cleanUpPaths) — Removes empty and negligible paths and simplifies the remaining paths.
- [`GSLayer checkConnections`](/Core/GlyphsCore/GSLayer/checkConnections) — Updates node connections to match the geometry of their paths.
- [`GSLayer correctPathDirection`](/Core/GlyphsCore/GSLayer/correctPathDirection) — Sets closed path directions according to containment and puts the outer path first.
- [`GSLayer checkForCoincidentPaths`](/Core/GlyphsCore/GSLayer/checkForCoincidentPaths) — Finds paths whose nodes have coincident positions.

### Rounding Coordinates

- [`GSLayer roundSelectedCoordinates:`](/Core/GlyphsCore/GSLayer/roundSelectedCoordinates:) — Rounds selected element coordinates to a grid.
- [`GSLayer roundCoordinates`](/Core/GlyphsCore/GSLayer/roundCoordinates) — Rounds path, component, and anchor coordinates using the associated font master settings.
- [`GSLayer roundCoordinatesToGridWithSettings:`](/Core/GlyphsCore/GSLayer/roundCoordinatesToGridWithSettings:) — Rounds path, component, and anchor coordinates to a grid.
- [`GSLayer roundCoordinatesFastToGridWithSettings:`](/Core/GlyphsCore/GSLayer/roundCoordinatesFastToGridWithSettings:) — Rounds path, component, and anchor coordinates to a grid without normal edit bookkeeping.
- [`GSLayer roundCoordinatesToGrid:`](/Core/GlyphsCore/GSLayer/roundCoordinatesToGrid:) — Rounds shape and anchor coordinates to a uniform grid and rounds the layer width to at most unit precision.
- [`GSLayer roundCoordinatesToGridFast:`](/Core/GlyphsCore/GSLayer/roundCoordinatesToGridFast:) — Rounds shape and anchor coordinates to a uniform grid without normal edit bookkeeping.

### Adding Path Nodes

- [`GSLayer addExtremePoints`](/Core/GlyphsCore/GSLayer/addExtremePoints) — Adds nodes at extrema of all path segments where needed.
- [`GSLayer addExtremePointsForce:checkSelection:`](/Core/GlyphsCore/GSLayer/addExtremePointsForce:checkSelection:) — Adds nodes at extrema of path segments.
- [`GSLayer addInflectionPoints`](/Core/GlyphsCore/GSLayer/addInflectionPoints) — Adds nodes at inflection points of cubic segments.

### General Transformations

- [`GSLayer transformSelection:`](/Core/GlyphsCore/GSLayer/transformSelection:) — Applies an affine transform to the selected elements.
- [`GSLayer transform:checkForSelection:`](/Core/GlyphsCore/GSLayer/transform:checkForSelection:) — Applies an affine transform to editable layer content.
- [`GSLayer transform:checkForSelection:doComponents:`](/Core/GlyphsCore/GSLayer/transform:checkForSelection:doComponents:) — Applies an affine transform to editable layer content.
- [`GSLayer transform:checkForSelection:doComponent:`](/Core/GlyphsCore/GSLayer/transform:checkForSelection:doComponent:) — Applies an affine transform to editable layer content and conditionally transforms components.
- [`GSLayer transformFast:`](/Core/GlyphsCore/GSLayer/transformFast:) — Applies an affine transform to the complete layer without normal edit bookkeeping.
- [`GSLayer transformFast:doComponent:`](/Core/GlyphsCore/GSLayer/transformFast:doComponent:) — Applies an affine transform to the complete layer and conditionally transforms components without normal edit bookkeeping.

### Shifting Content

- [`GSLayer horizontalShift:otherShifts:`](/Core/GlyphsCore/GSLayer/horizontalShift:otherShifts:) — Shifts layer content horizontally while compensating components for shifts of their base glyphs.
- [`GSLayer verticalShift:otherShifts:`](/Core/GlyphsCore/GSLayer/verticalShift:otherShifts:) — Shifts layer content vertically while compensating components for shifts of their base glyphs.
- [`GSLayer moveContent:`](/Core/GlyphsCore/GSLayer/moveContent:) — Moves the shapes, anchors, guides, and background image by an offset.

### Slanting

- [`GSLayer slantX:origin:doCorrection:checkSelection:`](/Core/GlyphsCore/GSLayer/slantX:origin:doCorrection:checkSelection:) — Slants content horizontally around an origin.
- [`GSLayer slantX:origin:correctContrast:correctShape:correctThickness:checkSelection:`](/Core/GlyphsCore/GSLayer/slantX:origin:correctContrast:correctShape:correctThickness:checkSelection:) — Slants content horizontally with configurable outline corrections.
- [`GSLayer slantY:origin:checkSelection:`](/Core/GlyphsCore/GSLayer/slantY:origin:checkSelection:) — Slants content vertically around an origin.
- [`GSLayer doSlantingCorrectionWithAngle:checkSelection:`](/Core/GlyphsCore/GSLayer/doSlantingCorrectionWithAngle:checkSelection:) — Corrects stem contrast for a horizontal slant.
- [`GSLayer doSlantingCorrectionWithAngle:correctContrast:correctShape:correctThickness:checkSelection:`](/Core/GlyphsCore/GSLayer/doSlantingCorrectionWithAngle:correctContrast:correctShape:correctThickness:checkSelection:) — Corrects outlines for a horizontal slant using associated font master stems.
- [`GSLayer doSlantingCorrectionWithAngle:checkSelection:correctContrast:correctShape:correctThickness:horizontalStem:verticalStem:center:`](/Core/GlyphsCore/GSLayer/doSlantingCorrectionWithAngle:checkSelection:correctContrast:correctShape:correctThickness:horizontalStem:verticalStem:center:) — Corrects outlines for a horizontal slant using explicit stem dimensions and a correction center.

### Boolean Operations

- [`GSLayer removeOverlapCheckSelection:error:`](/Core/GlyphsCore/GSLayer/removeOverlapCheckSelection:error:) — Removes overlaps between applicable paths.
- [`GSLayer removeOverlapCheckSelection:keepOpenPaths:grid:error:`](/Core/GlyphsCore/GSLayer/removeOverlapCheckSelection:keepOpenPaths:grid:error:) — Removes overlaps between applicable paths using explicit open-path and grid settings.
- [`GSLayer removeOverlap:grid:error:`](/Core/GlyphsCore/GSLayer/removeOverlap:grid:error:) — Removes overlaps between paths according to a set of options.
- [`GSLayer pathSubtract:`](/Core/GlyphsCore/GSLayer/pathSubtract:) — Subtracts selected paths from unselected paths.
- [`GSLayer pathSubtractKeepOverlaps:error:`](/Core/GlyphsCore/GSLayer/pathSubtractKeepOverlaps:error:) — Subtracts selected paths from unselected paths.
- [`GSLayer pathSubtract:from:keepOverlaps:error:`](/Core/GlyphsCore/GSLayer/pathSubtract:from:keepOverlaps:error:) — Subtracts one mutable path collection from another.
- [`GSLayer pathIntersect:`](/Core/GlyphsCore/GSLayer/pathIntersect:) — Intersects selected paths with unselected paths.
- [`GSLayer pathIntersectCheckSelection:error:`](/Core/GlyphsCore/GSLayer/pathIntersectCheckSelection:error:) — Intersects applicable selected and unselected paths.

### Flattening Outlines

- [`GSLayer flattenOutlines`](/Core/GlyphsCore/GSLayer/flattenOutlines) — Replaces the layer contents with their flattened path outlines and removes overlaps.
- [`GSLayer flattenOutlinesRemoveOverlap:origHints:secondaryPath:extraHandles:error:`](/Core/GlyphsCore/GSLayer/flattenOutlinesRemoveOverlap:origHints:secondaryPath:extraHandles:error:) — Replaces the layer contents with their flattened path outlines.
- [`GSLayer flattenOutlinesRemoveOverlap:origHints:supporting:secondaryPath:extraHandles:error:`](/Core/GlyphsCore/GSLayer/flattenOutlinesRemoveOverlap:origHints:supporting:secondaryPath:extraHandles:error:) — Replaces the layer contents with flattened path outlines for a drawing feature set.

### Synced Editing

- [`GSLayer enumerateSyncedLayerGroupMembersUsingBlock:`](/Core/GlyphsCore/GSLayer/enumerateSyncedLayerGroupMembersUsingBlock:) — Invokes a block for the layers in the same layer group that participate in synced editing.
- [`GSLayer enumerateSyncedLayersUsingBlock:`](/Core/GlyphsCore/GSLayer/enumerateSyncedLayersUsingBlock:) — Invokes a block for the layers of the glyph that participate in synced editing.
- [`GSLayer enumerateSyncedLayerGroupAssociatesUsingBlock:`](/Core/GlyphsCore/GSLayer/enumerateSyncedLayerGroupAssociatesUsingBlock:) — Invokes a block for the other layers in the same layer group that participate in synced editing.

## 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 Anchors](/Core/GlyphsCore/GSLayer-Anchors) — Named attachment points on 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.

