Functions & Hooks
rectsForRange
function rectsForRange(
text: string,
style: TextStyle,
start: number,
end: number): TextBox[];The boxes a UTF-8 byte range occupies, one per line it crosses - a selection highlight, or one glyph's bounds when the range is one glyph long. Same coordinates and the same per-call layout cost as measureText.
Not every offset has a box: the space a line wraps at, a newline, and the
ellipsis a truncated line ends with all draw nothing, so a range over one
comes back empty. A caret drawn from [index, index + 1) needs
[index - 1, index) as its fallback.
Parameters
text
string
style
start
number
end
number
Returns
TextBox[]