Phaser API Documentation

  Version: 
advancedWordWrap(text, context, wordWrapWidth)

Description:

Advanced wrapping algorithm that will wrap words as the line grows longer than its horizontal bounds. Consecutive spaces will be collapsed and replaced with a single space. Lines will be trimmed of white space before processing. Throws an error if wordWrapWidth is less than a single character.

Parameters:

name type description
text string

The text to perform word wrap detection against.

context CanvasRenderingContext2D

The Canvas Rendering Context.

wordWrapWidth number

The word wrap width.

Returns:
Description:

The wrapped text.

Type:
  • string
Since: 3.0.0