Phaser API Documentation

wordWrapCallback: TextStyleWordWrapCallback | null


A custom function that will be responsible for wrapping the text. It will receive two arguments: text (the string to wrap), textObject (this Text instance). It should return the wrapped lines either as an array of lines or as a string with newline characters in place to indicate where breaks should happen. Setting this directly will not re-run the word wrapping algorithm. To change the callback and re-wrap, use Phaser.GameObjects.TextStyle#setWordWrapCallback.

TextStyleWordWrapCallback | null
Default: null
Since: 3.24.0