Instance Method


Stores the initial glyphs and glyph properties for a character range.


iOS, Mac Catalyst, tvOS
- (void)setGlyphs:(const CGGlyph *)glyphs properties:(const NSGlyphProperty *)props characterIndexes:(const NSUInteger *)charIndexes font:(UIFont *)aFont forGlyphRange:(NSRange)glyphRange;
- (void)setGlyphs:(const CGGlyph *)glyphs properties:(const NSGlyphProperty *)props characterIndexes:(const NSUInteger *)charIndexes font:(NSFont *)aFont forGlyphRange:(NSRange)glyphRange;



A pointer to the layout manager's glyph cache.


A pointer to a buffer containing glyph properties for the glyphs in the cache.


A pointer to the starting index for the characters in the text storage for which glyphs are generated.


A font to override the font attributes in the text storage for the specified character range.


The range of glyphs in the glyph cache to set.


This method is invoked by text system during the glyph generation process. The only place apps are allowed to call this method directly is from an implementation of the NSLayoutManagerDelegate protocol method layoutManager:shouldGenerateGlyphs:properties:characterIndexes:font:forGlyphRange:.

Each array has glyphRange.length items. The specified charIndexes must be contiguous (no skipped indexes), enabling multiple items to have a same character index (as when one character index generates multiple glyph IDs). Due to font substitution, aFont passed into this method might not match the font in the attributes dictionary. Calling this method for a character range that has previously calculated layout information invalidates the layout and display.

See Also

Accessing Glyphs

- getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels:

Fills a passed-in buffer with a sequence of glyphs.

- CGGlyphAtIndex:

Returns the glyph at the specified index.

- CGGlyphAtIndex:isValidIndex:

Returns the glyph at the specified index and information about whether the glyph index is valid.

- characterIndexForGlyphAtIndex:

Returns the index in the text storage for the first character associated with the given glyph.

- glyphIndexForCharacterAtIndex:

Returns the index of the first glyph associated with the character at the specified index.

- isValidGlyphIndex:

Indicates whether the specified index refers to a valid glyph, otherwise NO.


The number of glyphs in the receiver.

- propertyForGlyphAtIndex:

Returns the glyph property associated with the glyph at the specified index.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software