Returns the smallest contiguous range for glyphs that are laid out wholly or partially within the given rectangle in the given text container.
SDKs
- iOS 7.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Frameworks
- UIKit
- App
Kit
Declaration
- (NSRange)glyphRangeForBoundingRectWithoutAdditionalLayout:(CGRect)bounds inTextContainer:(NSText Container *)container;
- (NSRange)glyphRangeForBoundingRectWithoutAdditionalLayout:(NSRect)bounds inTextContainer:(NSText Container *)container;
Parameters
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
Unlike glyph
, this variant of the method doesn’t perform glyph generation or layout. Its results, though faster, can be incorrect. This method is primarily for use by NSText
; you should rarely need to use it yourself.
Bounding rectangles are always in container coordinates.