Type Alias TextDataUpdate
TextDataUpdate:
| { runs?: GlyphRun[]; storage?: GlyphStorage; update: "reset" }
| { insertBefore?: number; run: GlyphRun; update: "addRun" }
| { run: GlyphRun | number; update: "removeRun" }
| { previous: GlyphRun | number; run: GlyphRun; update: "replaceRun" }
| { runs?: GlyphRun[]; storage?: GlyphStorage; update: "reset" }
| { insertBefore?: number; run: GlyphRun; update: "addRun" }
| { run: GlyphRun | number; update: "removeRun" }
| { previous: GlyphRun | number; run: GlyphRun; update: "replaceRun" }
Type Declaration
- { runs?: GlyphRun[]; storage?: GlyphStorage; update: "reset" }
-
Optionalruns?: GlyphRun[] -
Optionalstorage?: GlyphStorage -
update: "reset"
Rebuild runs and/or swap to a different storage. Both
runsandstorageare optional; missing fields default to the TextData's current value, so{ update: "reset" }with neither performs a pure compaction pass that re-lays-out the slot allocator without dead slots or gaps. Invalidates any previously-passedGlyphRunreferences whenrunsis set.
-
- { insertBefore?: number; run: GlyphRun; update: "addRun" }
-
OptionalinsertBefore?: numberIndex in
data.runsto insert before. Default = append at end. -
run: GlyphRun
-
update: "addRun"
Append a new run to the live runs list, or insert it before the run currently at
insertBefore. The run'scurveSetmust already exist in the bound storage.
-
- { run: GlyphRun | number; update: "removeRun" }
-
run: GlyphRun | number
-
update: "removeRun"
Remove a previously-added run. Accepts either the
GlyphRunreference or its current index indata.runs.
-
- { previous: GlyphRun | number; run: GlyphRun; update: "replaceRun" }
Discriminated union driving
updateTextData. Each variant'supdatefield is the discriminator. Arrays/maps passed inside any variant are adopted by theTextDataand must not be read or mutated by the caller afterward.