Instance Method

layoutManager(_:shouldGenerateGlyphs:properties:characterIndexes:font:forGlyphRange:)

Enables customizing the initial glyph generation process.

Declaration

iOS, Mac Catalyst, tvOS
optional func layoutManager(_ layoutManager: NSLayoutManager, shouldGenerateGlyphs glyphs: UnsafePointer<CGGlyph>, properties props: UnsafePointer<NSLayoutManager.GlyphProperty>, characterIndexes charIndexes: UnsafePointer<Int>, font aFont: UIFont, forGlyphRange glyphRange: NSRange) -> Int
macOS
optional func layoutManager(_ layoutManager: NSLayoutManager, shouldGenerateGlyphs glyphs: UnsafePointer<CGGlyph>, properties props: UnsafePointer<NSLayoutManager.GlyphProperty>, characterIndexes charIndexes: UnsafePointer<Int>, font aFont: NSFont, forGlyphRange glyphRange: NSRange) -> Int

Parameters

layoutManager

The layout manager doing the layout.

glyphs

A pointer to the layout manager's glyph cache.

props

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

charIndexes

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

aFont

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

glyphRange

The range of glyphs in the glyph cache to set.

Return Value

The actual glyph range stored in this method. By returning 0, it can indicate for the layout manager to do the default processing.

Discussion

This message is sent whenever the layout manager is about to store the initial glyph information via setGlyphs(_:properties:characterIndexes:font:forGlyphRange:). To customize the initial glyph generation process, this method can invoke setGlyphs(_:properties:characterIndexes:font:forGlyphRange:) with modified glyph information.

See Also

Invalidating Glyphs and Layout

func layoutManagerDidInvalidateLayout(NSLayoutManager)

Informs the delegate that the given layout manager has invalidated layout information (not glyph information).

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