Phaser API Documentation

  Version: 
basicWordWrap(text, context, wordWrapWidth)

Description:

Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal bounds. Spaces are not collapsed and whitespace is not trimmed.

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