Caret-to-offset - Function Summary
Returns the offset position relative to the face of the character position.
caret-to-offset face offset
face - The face containing the text. (must be: object)
offset - The offset in the text. (must be: any-string)
This function is provided to convert from a string character index position to an X-Y offset within the text of a face. This is used primarily for text editing or for text mapping operations such as for creating colored or hyperlinked text.
Note that the resulting offset (xy) was added to the face position (tx/offset) to find the correct position to locate the box (bx).
In the above example the caret-to-offset function was used on a face that have not yet been shown, but it can also be used after a face has been shown.
Remember that when making changes to the contents of strings that are longer than 200 characters, you must set the text face line-list to NONE to force the recomputation of all line breaks.
See the offset-to-caret function for the reverse conversion.
This function can also work on faces that have never been shown. This makes pre-display processing, colored text, and hyperlinking possible using this function in combination with SIZE-TEXT.