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
Notice any errors or typos? Please let us know. Please feel free to edit src/typography/attributes.js and open a pull request!