<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.11.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutManager/insertGlyph(_:atGlyphIndex:characterIndex:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutManager(im)insertGlyph:atGlyphIndex:characterIndex:"
  },
  "title" : "insertGlyph(_:atGlyphIndex:characterIndex:)"
}
-->

# insertGlyph(_:atGlyphIndex:characterIndex:)

Inserts a single glyph into the glyph stream at the given index and maps it to the character at the given character index.

```
func insertGlyph(_ glyph: NSGlyph, atGlyphIndex glyphIndex: Int, characterIndex charIndex: Int)
```

## Parameters

`glyph`

The glyph to insert.

`glyphIndex`

The index at which to insert the glyph.

`charIndex`

The index of the character to which the glyph is mapped.

## Discussion

If the glyph is mapped to several characters, `charIndex` should indicate the first character it’s mapped to.

This method is for use by the glyph-generation mechanism and doesn’t perform any invalidation or generation of the glyphs or layout. This method should be invoked only during glyph generation and typesetting, in almost all cases only by the glyph generator or typesetter. For example, a custom glyph generator or typesetter might invoke it.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)