Reference textWrap()

textWrap()

Sets the style for wrapping text when text() is called.

The parameter, style, can be one of the following values:

WORD starts new lines of text at spaces. If a string of text doesn't have spaces, it may overflow the text box and the canvas. This is the default style.

CHAR starts new lines as needed to stay within the text box.

textWrap() only works when the maximum width is set for a text box. For example, calling text('Have a wonderful day', 0, 10, 100) sets the maximum width to 100 pixels.

Calling textWrap() without an argument returns the current style.

Examples

Syntax

textWrap(style)

Parameters

style
Constant:

text wrapping style, either WORD or CHAR.

Returns

String: style
This page is generated from the comments in src/typography/attributes.js . Please feel free to edit it and submit a pull request!

Related References