# TextIndexMap
Class
## About
`TextIndexMap` translates between Xojo string offsets and the grapheme-aware indices used by canvas text editing. Custom editable nodes should use it whenever emoji, combining marks, or other multi-code-unit characters can appear.
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| BoundaryAt | index As Integer | Integer | Returns the text-storage index of the grapheme at the specified zero-based position. |
| CharacterAt | index As Integer | String | Returns the complete grapheme that begins at or contains the supplied text-storage index. |
| ClampToBoundary | index As Integer | Integer | Returns the nearest valid grapheme boundary at or before the supplied text-storage index. |
| Constructor | source As String | (None) | Creates and caches grapheme and UTF-16 boundary mappings for the supplied text. |
| Length | (None) | Integer | Returns the storage length of the source text without rescanning the String. |
| NextBoundary | index As Integer | Integer | Returns the first valid grapheme boundary after the supplied text-storage index. |
| PreviousBoundary | index As Integer | Integer | Returns the valid grapheme boundary immediately before the supplied text-storage index. |
| StringToUTF16Index | index As Integer | Integer | Converts a text-storage index to the corresponding UTF-16 code-unit offset used by native text services. |
| UTF16ToStringIndex | index As Integer | Integer | Converts a native UTF-16 code-unit offset to the nearest preceding text-storage grapheme boundary. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| Count | Integer | (None) | Returns the number of visually distinct grapheme clusters in the source text. |
| Source | String | (None) | Returns the source text used to construct this boundary map. |