Contents

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?) -> NSRange

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 if glyphRange encloses only the first or second glyph, then actualGlyphRange is 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

Related Documentation

Performing advanced layout queries