Instance Method

setTextContainer(_:forGlyphRange:)

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

Declaration

func setTextContainer(_ container: NSTextContainer, forGlyphRange glyphRange: NSRange)

Parameters

aTextContainer

The text container to set.

glyphRange

The range of glyphs to lay out.

Discussion

The layout within the container is specified with the setLineFragmentRect(_:forGlyphRange:usedRect:) and setLocation(_:forStartOfGlyphRange:) methods.

This method is used by the layout mechanism and should be invoked only during typesetting, in almost all cases only by the typesetter. For example, a custom typesetter might invoke it.

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 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 textContainer(forGlyphAt: Int, effectiveRange: NSRangePointer?, withoutAdditionalLayout: Bool) -> 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.