Class
GSLayer
The drawing and editing representation of a glyph.
Declaration
class GSLayerDeclaration
@interface GSLayer : NSObjectDeclaration
class GSLayer(NSObject)Overview
A master layer provides the glyph drawing associated with a font master. An Intermediate layer supplies interpolation data between masters. An Alternative layer replaces the associated master layer when its axis rules match. Color layers provide color-specific representations. Smart layers describe variations along glyph-local axes. Additional layers (backup layers) hold working or historical drawings without participating in export.
A layer belongs to a glyph, which in turn belongs to a font. This ownership gives the layer access to font axes, masters, and other glyphs. Detached layers are supported, but APIs that require font or glyph context can return no result or provide only partial behavior. Assign a parent to a layer without adding it to a glyph to keep it temporary but still connected to a glyph and font.
Shapes form the graphical content of a layer. Paths describe contours, components reference other glyphs, and shape groups organize shapes hierarchically. Anchors provide named attachment positions, hints store outline instructions and path components, and guides assist editing without forming part of the outline.
Layer metrics describe the advance and spacing around the graphical content. Horizontal metrics include the width and side bearings, while vertical metrics include the vertical advance, origin, and side bearings. Metrics and metrics keys can depend on the associated font master and related glyphs.
A layer can produce Bézier paths, emit its content to a pen, or preserve richer paint and composition information in a draw stack. Its grid is derived from the associated master and controls coordinate rounding during editing and geometry operations.
A layer maintains the current selection and provides editing operations for its shapes and other selectable elements. Many editing methods operate on the selection when one exists and on all applicable content otherwise.
A layer can also have a background layer as an editable companion and a separate background image as reference.
Topics
The different roles that a layer can serve.
The paths and components that form the outline of a layer.
Bounding rectangles of outlines, selections, and metrics.
Side bearings, baseline offsets, layer box, and metrics keys.
Setting for rounding coordinates on a layer.
Background content and reference images associated with a layer.
Named attachment points on a layer.
Manual and generated hint data on a layer.
Layer-local guides used while editing outlines.
Spacing adjustment between specific layers.
Layer-local notes displayed with a glyph.
Axis coordinates and rules that place layers in a design space.
Colors used to draw a layer.
Additional values stored for a layer.
Intersections between layer outlines and line segments.
Operations for modifying outlines and other layer content.
Access and modify the elements selected in a layer.
Create render representations and emit layer contents to pens.
Layer state management.
Encoding and decoding for layer data.
Creating a Layer
Creates a layer from a property-list representation.
Identity
The identifier under which the layer is stored in its glyph.
A derived key that distinguishes the layer by its role and attributes.
Invalidates the derived layer key after information used to form it changes.
A derived key used to group corresponding special and color layers.
Ownership
The glyph containing the layer, or
nilwhile the layer is detached.The glyph containing the layer, or
nilwhile the layer is detached.The font containing the layer through its glyph, or
nilwhile the layer is detached.
Associated Master
The identifier of the font master that supplies metrics and other master-specific values.
The master that supplies master-specific values for the layer.
Resolves the associated master with control over the amount of interpolated master data.
Directly looks up the associated master by its identifier.
Naming
A custom name for the layer.
A name suitable for presenting the layer in the user interface.
Color Label
A custom color label, or
nilwhen the layer has no custom color label.A standard color label, or GSLabelColor.noColorGSLabelColorNoColorGSLabelColorNoColor when no standard label is assigned.
Copying
Creates an independent copy with the requested optional content.
Creates an independent copy with the requested optional content and selection handling.
Equality and Comparison
Whether another layer has equal metrics, attributes, shapes, anchors, hints, guides, and background content.
A signature describing the interpolation-relevant structure of the layer.
A signature describing selected parts of the interpolation-relevant structure.
The individual parts that form a structural compatibility signature.
Instance Properties
Whether automatic alignment controls the layer width. just checking, not updating
Instance Methods
Add the anchors form the list
Add the anchors form the list without undo and KVO
same as
checkConnectionsbut without notifying and undo. Good when loading the pathA stable key of the Alternative-layer axis rules.
Internal fast anchor setter.
The next time the layer is drawn, align the components.
same as
setWidth:but without notifying and undo. Good when loading the layer
Type Methods
A stable key for an axis rule.
Relationships
Inherits From
NSObject
Inherited By
Conforms To
NSCodingNSCopying- GSContainerProtocol
- GSUserDataProtocol
ObjectiveC.NSObjectProtocolSwift.CVarArgSwift.CustomDebugStringConvertibleSwift.CustomStringConvertibleSwift.EquatableSwift.Hashable
Relationships
Inherits From
NSObject
Inherited By
Conforms To
- GSContainerProtocol
- GSUserDataProtocol
NSCodingNSCopying
See Also
Essentials
The top-level model object of a Glyphs document.
A named glyph and its layer collection in a font.
GSAxisrepresents an axis in aGSFontobject.