characterRange(forGlyphRange:actualGlyphRange:)
Returns the range of characters that correspond to the glyphs in the specified glyph range.
Declaration
func characterRange(forGlyphRange glyphRange: NSRange, actualGlyphRange: NSRangePointer?) -> NSRangeParameters
- 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 ifglyphRangeencloses only the first or second glyph, thenactualGlyphRangeis set to enclose both glyphs.
Return Value
The range of characters that generated the glyphs in glyphRange.
Discussion
If the length of glyphRange is 0, the resulting character range is a zero-length range just after the character(s) corresponding to the preceding glyph, and actualGlyphRange is also zero-length. If glyphRange 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.
See Also
Performing advanced layout queries
boundingRect(forGlyphRange:in:)characterIndex(for:in:fractionOfDistanceBetweenInsertionPoints:)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(forBoundingRect:in:)glyphRange(forBoundingRectWithoutAdditionalLayout:in:)glyphRange(for:)glyphRange(forCharacterRange:actualCharacterRange:)range(ofNominallySpacedGlyphsContaining:)