The 2D layer · interface
TextRun
Overlapping style runs, normalised into disjoint ones that cover every character once.
Explained in Sprites and tilemaps.
interface TextRunimport type { TextRun } from '@driftengine/ui2d';In depth
The normalisation is the whole job. A syntax highlighter emits overlapping runs — a rule for the string, a more specific one for the escape inside it — and a renderer needs disjoint runs in order with no gaps. Every consumer that skips this step draws a character twice or not at all, and both look like a font problem.
Later wins the overlap, because a later rule is the more specific one in every highlighter that emits them in that order.
Properties
| Name | Type | Description |
|---|---|---|
from | number | |
to | number | |
colour | number | |
bold | boolean | |
italic | boolean |