LogoPixi’VN
pixi-jsFunctions

Function: wordWrap()

> wordWrap(text, style, canvas, measureTextFn, canBreakWordsFn, canBreakCharsFn, wordWrapSplitFn): string

Defined in: node_modules/pixi.js/lib/scene/text/canvas/utils/wordWrap.d.ts:22

Internal

Applies newlines to a string to have it optimally fit into the horizontal bounds set by the Text object's wordWrapWidth property.

Parameters

text

string

String to apply word wrapping to

style

TextStyle

the style to use when wrapping

canvas

ICanvas

specification of the canvas to use for measuring.

measureTextFn

MeasureTextFn

Function to measure text width

canBreakWordsFn

CanBreakWordsFn

Function to check if words can be broken

canBreakCharsFn

CanBreakCharsFn

Function to check if characters can be broken

wordWrapSplitFn

WordWrapSplitFn

Function to split words into characters

Returns

string

New string with new lines applied where required