<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSGlyphInfo",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSGlyphInfo"
  },
  "title" : "NSGlyphInfo"
}
-->

# NSGlyphInfo

A glyph attribute in an attributed string.

```
class NSGlyphInfo
```

## Overview

Glyphs are the graphic representations of characters, stored in a font, that the text system draws on a display or printed page. Before text can be laid out, the layout manager (<[`NSLayoutManager`](/documentation/AppKit/NSLayoutManager)) generates a stream of glyphs, using the character and font information specified by the attributed string and contained in the font file. [`NSGlyphInfo`](/documentation/AppKit/NSGlyphInfo) represents a glyph attribute value ([`NSGlyphInfoAttributeName`](/documentation/AppKit/NSGlyphInfoAttributeName)) in an attributed string (<doc://com.apple.documentation/documentation/Foundation/NSAttributedString>) and provides a means to override the standard glyph generation process and substitute a specified glyph over the attribute’s range.

Glyph attributes are integer values that the layout manager uses to denote special handling for particular glyphs during rendering. [`NSGlyphInfo`](/documentation/AppKit/NSGlyphInfo) enables you to override a font’s built-in mapping from a Unicode character code to a corresponding glyph ID. Overriding the mapping allows you to specify a variant glyph for a given character if the font contains multiple variations for that character or to specify a glyph that doesn’t have a standard mapping (such as some ligature glyphs).

## Topics

### Creating a glyph info object

[`+  glyphInfoWithCGGlyph:forFont:baseString:`](/documentation/AppKit/NSGlyphInfo/init(cgGlyph:for:baseString:))

Creates a glyph info object from the specified glyph identifier and font informaton.

[`init(CGGlyph:forFont:baseString:)`](/documentation/AppKit/NSGlyphInfo/init(CGGlyph:forFont:baseString:))

[`init(coder:)`](/documentation/AppKit/NSGlyphInfo/init(coder:))

[`+  glyphInfoWithGlyph:forFont:baseString:`](/documentation/AppKit/NSGlyphInfo/init(glyph:for:baseString:))

[`+  glyphInfoWithGlyphName:forFont:baseString:`](/documentation/AppKit/NSGlyphInfo/init(glyphName:for:baseString:))

### Getting information about a glyph info object

[`baseString`](/documentation/AppKit/NSGlyphInfo/baseString)

The string containing the character represented by the glyph.

[`glyphID`](/documentation/AppKit/NSGlyphInfo/glyphID)

The glyph identifier, specified as the index into the internal glyph table of the font.

### Deprecated

[`+  glyphInfoWithCharacterIdentifier:collection:baseString:`](/documentation/AppKit/NSGlyphInfo/init(characterIdentifier:collection:baseString:))

Instantiates and returns an `NSGlyphInfo` object using a character identifier and a character collection.

[`init(glyph:forFont:baseString:)`](/documentation/AppKit/NSGlyphInfo/init(glyph:forFont:baseString:))

Instantiates and returns a glyph information object using a glyph index and a specified font.

[`init(glyphName:forFont:baseString:)`](/documentation/AppKit/NSGlyphInfo/init(glyphName:forFont:baseString:))

Instantiates and returns a glyph information object using a glyph name and a specified font.

[`characterIdentifier`](/documentation/AppKit/NSGlyphInfo/characterIdentifier)

The receiver’s character identifier (CID).

[`characterCollection`](/documentation/AppKit/NSGlyphInfo/characterCollection)

A value specifying the glyph–to–character identifier mapping of the receiver.

[`glyphName`](/documentation/AppKit/NSGlyphInfo/glyphName)

The receiver’s glyph name.

[`NSCharacterCollection`](/documentation/AppKit/NSCharacterCollection)

Values that map character identifiers to glyphs.

## Relationships

### Conforms To

[`NSCopying`](/documentation/Foundation/NSCopying)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)