pub fn coloured(
text: &str,
spans: &[(Range<usize>, HighlightKind)],
base: &TextRun,
palette: &SyntaxPalette,
) -> Vec<TextRun>Expand description
One run per span, the text between them in the field’s own colour.
The runs a field paints TextField::set_spans as, public for the same
reason next_boundary is: anything shaping the same text with the same
palette wants the same answer, and this is where it is decided.
The spans are whatever the caller last handed over, which may describe text
this frame no longer holds — see TextField::set_spans. A range that runs
past the end, overlaps the one before it, or cuts a character in half is
dropped rather than shifting the runs after it: shaping needs the lengths to
add up to the text, and a colour that is wrong for one frame is cheaper than
a panic.
base.len is ignored: every run is measured off text.