Instance Method

textContainer(forGlyphAt:effectiveRange:withoutAdditionalLayout:)

Returns the container in which the given glyph is laid out and (optionally) by reference the whole range of glyphs that are in that container.

Declaration

func textContainer(forGlyphAt glyphIndex: Int, effectiveRange effectiveGlyphRange: NSRangePointer?, withoutAdditionalLayout flag: Bool) -> NSTextContainer?

Parameters

glyphIndex

Index of a glyph in the returned container.

effectiveGlyphRange

If not NULL, on output, points to the whole range of glyphs that are in the returned container.

flag

If true, glyph generation and layout are not performed, so this option should not be used unless layout is known to be complete for the range in question, or unless noncontiguous layout is enabled; if false, both are performed as needed.

Return Value

The text container in which the glyph at glyphIndex is laid out.

Discussion

This method is primarily for use from within NSTypesetter, after layout is complete for the range in question, but before the layout manager's call to NSTypesetter has returned. In that case glyph and layout holes have not yet been recalculated, so the layout manager does not yet know that layout is complete for that range, and this variant must be used.

Overriding this method is not recommended. Any changes to the returned glyph range should be done at the typesetter level.

See Also

Managing the Text Containers

var textContainers: [NSTextContainer]

The receiver’s text containers.

func addTextContainer(NSTextContainer)

Appends the given text container to the series of text containers where the receiver arranges text.

func insertTextContainer(NSTextContainer, at: Int)

Inserts the given text container into the series of text containers at the given index.

func removeTextContainer(at: Int)

Removes the text container at the given index and invalidates the layout as needed.

func setTextContainer(NSTextContainer, forGlyphRange: NSRange)

Sets text container where the glyphs in the given range are laid out.

func textContainerChangedGeometry(NSTextContainer)

Invalidates the layout information, and possibly glyphs, for the given text container and all subsequent NSTextContainer objects.

func textContainerChangedTextView(NSTextContainer)

Updates information needed to manage NSTextView objects in the given text container.

func textContainer(forGlyphAt: Int, effectiveRange: NSRangePointer?) -> NSTextContainer?

Returns the container in which the given glyph is laid out and (optionally) by reference the whole range of glyphs that are in that container.

func usedRect(for: NSTextContainer) -> CGRect

Returns the bounding rectangle for the glyphs laid out in the given text container.

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