The 2D layer · function

runsFor

Fill out with disjoint, ordered, gap-free runs covering [0, text.length).

Explained in Sprites and tilemaps.

function runsFor(text: string, runs: readonly TextRun[], out: TextRun[]): number
import { runsFor } from '@driftengine/ui2d';

Parameters

ParameterTypeDescription
textstring
runsreadonly TextRun[]
outTextRun[]

In depth

Returns how many were written. With no input runs the answer is one run covering everything, which is what a plain string is.