# GSLayer Metrics

*API Collection*

Side bearings, baseline offsets, layer box, and metrics keys.

## Overview

Side bearings describe the distance between layer content and the layer advance. Horizontal layout uses left and right side bearings with [`GSLayer.width`](/Core/GlyphsCore/GSLayer/width). Vertical layout uses top and bottom side bearings with [`GSLayer.vertWidth`](/Core/GlyphsCore/GSLayer/vertWidth) and [`GSLayer.vertOrigin`](/Core/GlyphsCore/GSLayer/vertOrigin).

Metrics keys link a metric to another glyph, layer, side, or fixed value. Layer metrics keys override glyph metrics keys when present.

## Topics

### Horizontal Metrics

- [`GSLayer.width`](/Core/GlyphsCore/GSLayer/width) — Advance width for horizontal text layout.
- [`GSLayer.LSB`](/Core/GlyphsCore/GSLayer/LSB) — Horizontal distance from the origin to the left outline edge.
- [`GSLayer.LSBFast`](/Core/GlyphsCore/GSLayer/LSBFast) — Cached left side bearing without updating metrics.
- [`GSLayer LSBPlain`](/Core/GlyphsCore/GSLayer/LSBPlain) — Left side bearing without normalizing the no-outline value.
- [`GSLayer.RSB`](/Core/GlyphsCore/GSLayer/RSB) — Horizontal distance from the right outline edge to the advance width.
- [`GSLayer.RSBFast`](/Core/GlyphsCore/GSLayer/RSBFast) — Cached right side bearing without updating metrics.
- [`GSLayer RSBPlain`](/Core/GlyphsCore/GSLayer/RSBPlain) — Right side bearing without normalizing the no-outline value.
- [`GSLayer lsbAtHeight:`](/Core/GlyphsCore/GSLayer/lsbAtHeight:) — Left side bearing measured at a y coordinate.
- [`GSLayer setLsb:atHeight:`](/Core/GlyphsCore/GSLayer/setLsb:atHeight:) — Sets the left side bearing measured at a y coordinate.
- [`GSLayer rsbAtHeight:`](/Core/GlyphsCore/GSLayer/rsbAtHeight:) — Right side bearing measured at a y coordinate.
- [`GSLayer setRsb:atHeight:`](/Core/GlyphsCore/GSLayer/setRsb:atHeight:) — Sets the right side bearing measured at a y coordinate.

### Vertical Metrics

- [`GSLayer.TSB`](/Core/GlyphsCore/GSLayer/TSB) — Distance from the top metric to the top outline edge.
- [`GSLayer.TSBFast`](/Core/GlyphsCore/GSLayer/TSBFast) — Cached top side bearing without updating metrics.
- [`GSLayer TSBPlain`](/Core/GlyphsCore/GSLayer/TSBPlain) — Top side bearing without normalizing the no-outline value.
- [`GSLayer.BSB`](/Core/GlyphsCore/GSLayer/BSB) — Distance from the bottom outline edge to the vertical advance.
- [`GSLayer.BSBFast`](/Core/GlyphsCore/GSLayer/BSBFast) — Cached bottom side bearing without updating metrics.
- [`GSLayer BSBPlain`](/Core/GlyphsCore/GSLayer/BSBPlain) — Bottom side bearing without normalizing the no-outline value.
- [`GSLayer.vertWidth`](/Core/GlyphsCore/GSLayer/vertWidth) — Advance width for vertical text layout.
- [`GSLayer.vertOrigin`](/Core/GlyphsCore/GSLayer/vertOrigin) — Vertical origin offset for vertical text layout.
- [`GSLayer tsbAtHeight:`](/Core/GlyphsCore/GSLayer/tsbAtHeight:) — Top side bearing measured at an x coordinate.
- [`GSLayer setTsb:atHeight:`](/Core/GlyphsCore/GSLayer/setTsb:atHeight:) — Sets the top side bearing measured at an x coordinate.
- [`GSLayer bsbAtHeight:`](/Core/GlyphsCore/GSLayer/bsbAtHeight:) — Bottom side bearing measured at an x coordinate.
- [`GSLayer setBsb:atHeight:`](/Core/GlyphsCore/GSLayer/setBsb:atHeight:) — Sets the bottom side bearing measured at an x coordinate.

### Master Metrics

- [`GSMetricStore`](/Core/GlyphsCore/GSMetricStore)
- [`GSLayer metrics`](/Core/GlyphsCore/GSLayer/metrics) — Vertical metrics for the associated master.
- [`GSLayer metricsForMaster:`](/Core/GlyphsCore/GSLayer/metricsForMaster:) — Vertical metrics for a master.
- [`GSLayer metricForType:`](/Core/GlyphsCore/GSLayer/metricForType:) — Master metric value for a metrics type.
- [`GSLayer metricForName:`](/Core/GlyphsCore/GSLayer/metricForName:) — Master metric value for a metric name.
- [`GSLayer isSecondaryMetric:`](/Core/GlyphsCore/GSLayer/isSecondaryMetric:) — Whether a metric is secondary for the layer’s glyph case.
- [`GSValueStore`](/Core/GlyphsCore/GSValueStore)
- [`GSLayer stemsForMaster:`](/Core/GlyphsCore/GSLayer/stemsForMaster:) — Stem values for a master.

### Common Master Metrics

- [`GSLayer.ascender`](/Core/GlyphsCore/GSLayer/ascender) — Ascender value from the associated master.
- [`GSLayer.descender`](/Core/GlyphsCore/GSLayer/descender) — Descender value from the associated master.
- [`GSLayer.italicAngle`](/Core/GlyphsCore/GSLayer/italicAngle) — Italic angle from the associated master.
- [`GSLayer.slantHeight`](/Core/GlyphsCore/GSLayer/slantHeight) — Slant height from the associated master.
- [`GSLayer.topHeight`](/Core/GlyphsCore/GSLayer/topHeight) — Top height from the associated master.

### Glyph Metrics

- [`GSGlyphMetrics`](/Core/GlyphsCore/GSGlyphMetrics)
- [`GSLayer glyphMetrics`](/Core/GlyphsCore/GSLayer/glyphMetrics) — Glyph metrics for left-to-right layout.
- [`GSLayer glyphMetricsForDirection:`](/Core/GlyphsCore/GSLayer/glyphMetricsForDirection:) — Glyph metrics for a writing direction.

### Metric Values

- [`GSMetricNumbers`](/Core/GlyphsCore/GSMetricNumbers)
- [`GSLayer metricsValue:atHeight:`](/Core/GlyphsCore/GSLayer/metricsValue:atHeight:) — Metric value for a side at a measurement height.
- [`GSLayer metricsValue:forKey:`](/Core/GlyphsCore/GSLayer/metricsValue:forKey:) — Value described by a metrics key for a metric side.
- [`GSLayer metricsValue:forKey:value:atHeight:`](/Core/GlyphsCore/GSLayer/metricsValue:forKey:value:atHeight:) — Evaluates a metrics key for a metric side.

### Metrics Keys

- [`GSLayer.widthMetricsKey`](/Core/GlyphsCore/GSLayer/widthMetricsKey) — Layer-specific metrics key for the advance width.
- [`GSLayer.leftMetricsKey`](/Core/GlyphsCore/GSLayer/leftMetricsKey) — Layer-specific metrics key for the left side bearing.
- [`GSLayer.rightMetricsKey`](/Core/GlyphsCore/GSLayer/rightMetricsKey) — Layer-specific metrics key for the right side bearing.
- [`GSLayer.topMetricsKey`](/Core/GlyphsCore/GSLayer/topMetricsKey) — Layer-specific metrics key for the top side bearing.
- [`GSLayer.bottomMetricsKey`](/Core/GlyphsCore/GSLayer/bottomMetricsKey) — Layer-specific metrics key for the bottom side bearing.
- [`GSLayer.vertWidthMetricsKey`](/Core/GlyphsCore/GSLayer/vertWidthMetricsKey) — Layer-specific metrics key for the vertical advance width.
- [`GSLayer.vertOriginMetricsKey`](/Core/GlyphsCore/GSLayer/vertOriginMetricsKey) — Layer-specific metrics key for the vertical origin.
- [`GSLayer metricsKey:name:operator:value:oppositeSite:atHeight:master:`](/Core/GlyphsCore/GSLayer/metricsKey:name:operator:value:oppositeSite:atHeight:master:) — Parses a metrics key into its referenced glyph, operator, numeric value, opposite side, height, and master.

### Metrics Key Alignment

- [`GSLayer.hasAlignedWidth`](/Core/GlyphsCore/GSLayer/hasAlignedWidth) — Whether automatic alignment controls the layer width.
- [`GSLayer hasAlignedSideBearings`](/Core/GlyphsCore/GSLayer/hasAlignedSideBearings) — Whether automatic alignment controls side bearings.
- [`GSLayer.isAligned`](/Core/GlyphsCore/GSLayer/isAligned) — Whether components are currently aligned by automatic alignment.
- [`GSLayer.isAligning`](/Core/GlyphsCore/GSLayer/isAligning) — Whether an automatic alignment operation is in progress.
- [`GSLayer checkIfAlign`](/Core/GlyphsCore/GSLayer/checkIfAlign) — Whether automatic component alignment can be applied to the layer.
- [`GSLayer doAlignWidth`](/Core/GlyphsCore/GSLayer/doAlignWidth) — Applies automatic width alignment.
- [`GSLayer metricKeyOffsetLeft:right:width:`](/Core/GlyphsCore/GSLayer/metricKeyOffsetLeft:right:width:) — Metrics key offsets used by automatic component alignment.

### Metrics Sync

- [`GSLayer syncMetricsThreshold:`](/Core/GlyphsCore/GSLayer/syncMetricsThreshold:) — Tolerance used when deciding whether metrics need synchronization.
- [`GSLayer syncMetrics`](/Core/GlyphsCore/GSLayer/syncMetrics) — Applies all available metrics keys.
- [`GSLayer syncLeftMetrics`](/Core/GlyphsCore/GSLayer/syncLeftMetrics) — Applies the left side-bearing metrics key.
- [`GSLayer syncWidthMetrics`](/Core/GlyphsCore/GSLayer/syncWidthMetrics) — Applies the advance-width metrics key.
- [`GSLayer syncRightMetrics`](/Core/GlyphsCore/GSLayer/syncRightMetrics) — Applies the right side-bearing metrics key.
- [`GSLayer syncTopMetrics`](/Core/GlyphsCore/GSLayer/syncTopMetrics) — Applies the top side-bearing metrics key.
- [`GSLayer syncBottomMetrics`](/Core/GlyphsCore/GSLayer/syncBottomMetrics) — Applies the bottom side-bearing metrics key.
- [`GSLayer syncVertWidthMetrics`](/Core/GlyphsCore/GSLayer/syncVertWidthMetrics) — Applies the vertical advance-width metrics key.
- [`GSLayer reinterpolateMetrics:`](/Core/GlyphsCore/GSLayer/reinterpolateMetrics:) — Reinterpolates the horizontal metrics of an Alternative layer or interpolated layer.
- [`GSLayer updateMetrics`](/Core/GlyphsCore/GSLayer/updateMetrics) — Recalculates side bearings from the layer contents.

### Horizontal Metrics Keys UI

- [`GSLayer.leftMetricsKeyUI`](/Core/GlyphsCore/GSLayer/leftMetricsKeyUI) — Display and editing string for the left metrics key.
- [`GSLayer leftMetricsKeyState`](/Core/GlyphsCore/GSLayer/leftMetricsKeyState) — State flags for the left metrics key.
- [`GSLayer leftMetricsKeyState:`](/Core/GlyphsCore/GSLayer/leftMetricsKeyState:) — Display string for the left metrics key and its state.
- [`GSLayer leftPlainMetricsKey`](/Core/GlyphsCore/GSLayer/leftPlainMetricsKey) — Plain effective metrics key for the left side bearing.
- [`GSLayer.widthMetricsKeyUI`](/Core/GlyphsCore/GSLayer/widthMetricsKeyUI) — Display and editing string for the width metrics key.
- [`GSLayer widthMetricsKeyUIFast`](/Core/GlyphsCore/GSLayer/widthMetricsKeyUIFast) — Fast display string for the width metrics key.
- [`GSLayer widthMetricsKeyState`](/Core/GlyphsCore/GSLayer/widthMetricsKeyState) — State flags for the width metrics key.
- [`GSLayer widthMetricsKeyState:`](/Core/GlyphsCore/GSLayer/widthMetricsKeyState:) — Display string for the width metrics key and its state.
- [`GSLayer widthPlainMetricsKey`](/Core/GlyphsCore/GSLayer/widthPlainMetricsKey) — Plain effective metrics key for the advance width.
- [`GSLayer.rightMetricsKeyUI`](/Core/GlyphsCore/GSLayer/rightMetricsKeyUI) — Display and editing string for the right metrics key.
- [`GSLayer rightMetricsKeyState`](/Core/GlyphsCore/GSLayer/rightMetricsKeyState) — State flags for the right metrics key.
- [`GSLayer rightMetricsKeyState:`](/Core/GlyphsCore/GSLayer/rightMetricsKeyState:) — Display string for the right metrics key and its state.
- [`GSLayer rightPlainMetricsKey`](/Core/GlyphsCore/GSLayer/rightPlainMetricsKey) — Plain effective metrics key for the right side bearing.

### Vertical Metrics Keys UI

- [`GSLayer.topMetricsKeyUI`](/Core/GlyphsCore/GSLayer/topMetricsKeyUI) — Display and editing string for the top metrics key.
- [`GSLayer topMetricsKeyState`](/Core/GlyphsCore/GSLayer/topMetricsKeyState) — State flags for the top metrics key.
- [`GSLayer topMetricsKeyState:`](/Core/GlyphsCore/GSLayer/topMetricsKeyState:) — Display string for the top metrics key and its state.
- [`GSLayer topPlainMetricsKey`](/Core/GlyphsCore/GSLayer/topPlainMetricsKey) — Plain effective metrics key for the top side bearing.
- [`GSLayer.bottomMetricsKeyUI`](/Core/GlyphsCore/GSLayer/bottomMetricsKeyUI) — Display and editing string for the bottom metrics key.
- [`GSLayer bottomMetricsKeyState`](/Core/GlyphsCore/GSLayer/bottomMetricsKeyState) — State flags for the bottom metrics key.
- [`GSLayer bottomMetricsKeyState:`](/Core/GlyphsCore/GSLayer/bottomMetricsKeyState:) — Display string for the bottom metrics key and its state.
- [`GSLayer bottomPlainMetricsKey`](/Core/GlyphsCore/GSLayer/bottomPlainMetricsKey) — Plain effective metrics key for the bottom side bearing.
- [`GSLayer vertWidthUI`](/Core/GlyphsCore/GSLayer/vertWidthUI) — Vertical advance width for display.
- [`GSLayer.vertWidthMetricsKeyUI`](/Core/GlyphsCore/GSLayer/vertWidthMetricsKeyUI) — Display and editing string for the vertical width metrics key.
- [`GSLayer vertWidthMetricsKeyState`](/Core/GlyphsCore/GSLayer/vertWidthMetricsKeyState) — State flags for the vertical width metrics key.
- [`GSLayer vertWidthMetricsKeyState:defaultKey:`](/Core/GlyphsCore/GSLayer/vertWidthMetricsKeyState:defaultKey:) — Display string for the vertical width metrics key and its state.
- [`GSLayer vertWidthPlainMetricsKey`](/Core/GlyphsCore/GSLayer/vertWidthPlainMetricsKey) — Plain effective metrics key for the vertical advance width.
- [`GSLayer.vertOriginMetricsKeyUI`](/Core/GlyphsCore/GSLayer/vertOriginMetricsKeyUI) — Display and editing string for the vertical origin metrics key.
- [`GSLayer vertOriginMetricsKeyState`](/Core/GlyphsCore/GSLayer/vertOriginMetricsKeyState) — State flags for the vertical origin metrics key.
- [`GSLayer vertOriginMetricsKeyState:`](/Core/GlyphsCore/GSLayer/vertOriginMetricsKeyState:) — Display string for the vertical origin metrics key and its state.
- [`GSLayer vertOriginPlainMetricsKey`](/Core/GlyphsCore/GSLayer/vertOriginPlainMetricsKey) — Plain effective metrics key for the vertical origin.

### Metrics Keys Utilities

- [`GSLayer plainMetricsKeyUI:`](/Core/GlyphsCore/GSLayer/plainMetricsKeyUI:) — Plain metrics key for display and editing.
- [`GSLayer attributedMetricsKey:fontSize:state:`](/Core/GlyphsCore/GSLayer/attributedMetricsKey:fontSize:state:) — Attributed display string for a metrics key.
- [`GSLayer alignedMetricsValueForKey:`](/Core/GlyphsCore/GSLayer/alignedMetricsValueForKey:) — Numeric offset encoded in an aligned metrics key.
- [`GSLayer metricsKeysOutOfSync`](/Core/GlyphsCore/GSLayer/metricsKeysOutOfSync) — Whether any horizontal metrics key is out of sync.
- [`GSLayer metricsKeysInvalid`](/Core/GlyphsCore/GSLayer/metricsKeysInvalid) — Whether any horizontal metrics key is invalid.
- [`GSLayer metricsLabelForSide:`](/Core/GlyphsCore/GSLayer/metricsLabelForSide:) — Localized label for a metric side.
- [`GSLayer colorForMetricsState:`](/Core/GlyphsCore/GSLayer/colorForMetricsState:) — Display color for metrics key state flags.

### Metrics Locks

- [`GSLayer lockReadMetrics`](/Core/GlyphsCore/GSLayer/lockReadMetrics) — Acquires the read lock for metrics.
- [`GSLayer unlockReadMetrics`](/Core/GlyphsCore/GSLayer/unlockReadMetrics) — Releases the read lock for metrics.
- [`GSLayer lockWriteMetrics`](/Core/GlyphsCore/GSLayer/lockWriteMetrics) — Acquires the write lock for metrics.
- [`GSLayer unlockWriteMetrics`](/Core/GlyphsCore/GSLayer/unlockWriteMetrics) — Releases the write lock for metrics.

### Alignment Locks

- [`GSLayer lockReadAlignInfo`](/Core/GlyphsCore/GSLayer/lockReadAlignInfo) — Acquires the read lock for alignment information.
- [`GSLayer unlockReadAlignInfo`](/Core/GlyphsCore/GSLayer/unlockReadAlignInfo) — Releases the read lock for alignment information.
- [`GSLayer lockWriteAlignInfo`](/Core/GlyphsCore/GSLayer/lockWriteAlignInfo) — Acquires the write lock for alignment information.
- [`GSLayer unlockWriteAlignInfo`](/Core/GlyphsCore/GSLayer/unlockWriteAlignInfo) — Releases the write lock for alignment information.

## 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 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.
- [GSLayer Editing](/Core/GlyphsCore/GSLayer-Editing) — Operations for modifying outlines and other layer content.

