LogoPixi’VN
pixi-jsFunctions

Function: canvasTextSplit()

> canvasTextSplit(options): TextSplitOutput<Text>

Defined in: node_modules/pixi.js/lib/scene/text/utils/canvasTextSplit.d.ts:15

Internal

Splits a Text object into segments based on the text's layout and style, and adds these segments as individual Text objects to a specified container.

This function handles word wrapping, alignment, and letter spacing, ensuring that each segment is rendered correctly according to the original text's style. It uses the CanvasTextMetrics to measure text dimensions and segment the text into lines.

Parameters

options

Pick<SplitOptions, "text" | "style"> & object

Configuration options for the text split operation.

Returns

TextSplitOutput<Text>

An array of Text objects representing the split segments.