Class

NSGlyph​Info

An NSGlyph​Info object represents a glyph attribute value (NSGlyph​Info​Attribute​Name) in an attributed string (NSAttributed​String). 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 (NSLayout​Manager) generates a stream of glyphs to be laid out, using character and font information specified by the attributed string and contained in the font file. NSGlyph​Info provides a means to override the standard glyph generation process and substitute a specified glyph over the attribute’s range.

Overview

Glyph attributes are integer values that the layout manager uses to denote special handling for particular glyphs during rendering. NSGlyph​Info 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).

Symbols

Creating an NSGlyphInfo Object

init?(character​Identifier:​ Int, collection:​ NSCharacter​Collection, base​String:​ String)

Instantiates and returns an NSGlyph​Info object using a character identifier and a character collection.

init?(glyph:​ NSGlyph, for:​ NSFont, base​String:​ String)

Instantiates and returns an NSGlyph​Info object using a glyph index and a specified font.

init?(glyph​Name:​ String, for:​ NSFont, base​String:​ String)

Instantiates and returns an NSGlyph​Info object using a glyph name and a specified font.

Getting Information About an NSGlyphInfo Object

var character​Identifier:​ Int

The receiver’s character identifier (CID).

var character​Collection:​ NSCharacter​Collection

an NSCharacter​Collection value specifying the glyph–to–character identifier mapping of the receiver.

var glyph​Name:​ String?

The receiver’s glyph name.

Constants

NSCharacter​Collection

The following values specify the mapping of character identifiers to glyphs, and are returned by character​Collection.