Instance Method

lineFragmentRect(forGlyphAt:effectiveRange:withoutAdditionalLayout:)

Returns the line fragment rectangle containing the glyph at the given glyph index.

Declaration

iOS, tvOS
func lineFragmentRect(forGlyphAt glyphIndex: Int, effectiveRange effectiveGlyphRange: NSRangePointer?, withoutAdditionalLayout flag: Bool) -> CGRect
macOS
func lineFragmentRect(forGlyphAt glyphIndex: Int, effectiveRange effectiveGlyphRange: NSRangePointer?, withoutAdditionalLayout flag: Bool) -> NSRect

Parameters

glyphIndex

The glyph for which to return the line fragment rectangle.

effectiveGlyphRange

If not NULL, on output, the range for all glyphs in the line fragment.

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 line fragment in which the given glyph 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. If the the line fragment rectangle needs to be modified, that should be done at the typesetter level or by calling setLineFragmentRect(_:forGlyphRange:usedRect:).

See Also

Getting Layout Information

func attachmentSize(forGlyphAt: Int) -> CGSize

For a glyph corresponding to an attachment, returns the size for the attachment cell to occupy.

func drawsOutsideLineFragment(forGlyphAt: Int) -> Bool

Indicates whether the glyph draws outside of its line fragment rectangle.

var extraLineFragmentRect: CGRect

The rectangle defining the extra line fragment for the insertion point at the end of a text (either in an empty text or after a final paragraph separator).

var extraLineFragmentTextContainer: NSTextContainer?

The text container that contains the extra line fragment rectangle.

var extraLineFragmentUsedRect: CGRect

The rectangle enclosing the insertion point drawn in the extra line fragment rectangle.

func firstUnlaidCharacterIndex() -> Int

The index for the first character in the layout manager that has not been laid out.

func firstUnlaidGlyphIndex() -> Int

The index for the first glyph in the layout manager that has not been laid out.

func getFirstUnlaidCharacterIndex(UnsafeMutablePointer<Int>?, glyphIndex: UnsafeMutablePointer<Int>?)

Returns the indexes for the first character and glyph that have invalid layout information.

func lineFragmentRect(forGlyphAt: Int, effectiveRange: NSRangePointer?) -> CGRect

Returns the rectangle for the line fragment in which the given glyph is laid out and (optionally), by reference, the whole range of glyphs that are in that fragment.

func lineFragmentUsedRect(forGlyphAt: Int, effectiveRange: NSRangePointer?) -> CGRect

Returns the usage rectangle for the line fragment in which the given glyph is laid and (optionally) by reference the whole range of glyphs that are in that fragment.

func lineFragmentUsedRect(forGlyphAt: Int, effectiveRange: NSRangePointer?, withoutAdditionalLayout: Bool) -> CGRect

Returns the usage rectangle for the line fragment in which the given glyph is laid and (optionally) by reference the whole range of glyphs that are in that fragment.

func location(forGlyphAt: Int) -> CGPoint

Returns the location for the given glyph within its line fragment.

func notShownAttribute(forGlyphAt: Int) -> Bool

Indicates whether the glyph at the given index is one that isn’t shown.

func truncatedGlyphRange(inLineFragmentForGlyphAt: Int) -> NSRange

Returns the range of truncated glyphs for a line fragment containing the specified index.