glyphRange(forBoundingRect:in:)
Returns the smallest contiguous range for glyphs lying wholly or partially within the specified rectangle of the text container.
Declaration
func glyphRange(forBoundingRect bounds: NSRect, in container: NSTextContainer) -> NSRangeParameters
- bounds:
The bounding rectangle for which to return glyphs.
- container:
The text container in which the glyphs are laid out.
Return Value
The range of glyphs that would need to be displayed in order to draw all glyphs that fall (even partially) within the given bounding rectangle. The range returned can include glyphs that don’t fall inside or intersect bounds, although the first and last glyphs in the range always do. At most this method returns the glyph range for the whole container.
Discussion
This method is used to determine which glyphs need to be displayed within a given rectangle.
Performs glyph generation and layout if needed. Bounding rectangles are always in container coordinates.
See Also
Performing advanced layout queries
boundingRect(forGlyphRange:in:)characterIndex(for:in:fractionOfDistanceBetweenInsertionPoints:)characterRange(forGlyphRange:actualGlyphRange:)enumerateEnclosingRects(forGlyphRange:withinSelectedGlyphRange:in:using:)enumerateLineFragments(forGlyphRange:using:)fractionOfDistanceThroughGlyph(for:in:)getLineFragmentInsertionPoints(forCharacterAt:alternatePositions:inDisplayOrder:positions:characterIndexes:)glyphIndex(for:in:)glyphIndex(for:in:fractionOfDistanceThroughGlyph:)glyphRange(forBoundingRectWithoutAdditionalLayout:in:)glyphRange(for:)glyphRange(forCharacterRange:actualCharacterRange:)range(ofNominallySpacedGlyphsContaining:)