function CharacterIndexToTextIndex(Index: Integer): Integer;
| Index | Integer. Zero-based character index on the current page |
| Result | Integer. Zero-based offset of that character within the extracted text, or -1 when the character contributes nothing to it |
The character list and the extracted string are not the same sequence: generated characters such as inserted spaces and hyphens appear in one and not the other. This maps from the character list to the string
It is what turns a hit reported against character indexes - a search result, a click - into an offset a caller can use to slice the string from Text
A result of -1 means the character has no representation in the extracted text, which is normal for characters flagged by CharacterGenerated