Returns the range of characters that generated the glyphs in the given glyph range.
SDKs
- iOS 7.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Frameworks
- UIKit
- App
Kit
Declaration
- (NSRange)characterRangeForGlyphRange:(NSRange)glyphRange actualGlyphRange:(NSRange Pointer)actualGlyphRange;
Parameters
glyphRange
The glyph range for which to return the character range.
actualGlyphRange
If not
NULL
, on output, points to the full range of glyphs generated by the character range returned. This range may be identical or slightly larger than the requested glyph range. For example, if the text storage contains the character “Ö
” and the glyph cache contains the two atomic glyphs “O
” and “¨
”, and ifglyph
encloses only the first or second glyph, thenRange actual
is set to enclose both glyphs.Glyph Range
Return Value
The range of characters that generated the glyphs in glyph
.
Discussion
If the length of glyph
is 0
, the resulting character range is a zero-length range just after the character(s) corresponding to the preceding glyph, and actual
is also zero-length. If glyph
extends beyond the text length, the method truncates the result to the number of characters in the text.
If noncontiguous layout is not enabled, this method forces the generation of glyphs for all characters up to and including the end of the returned range.