Description
The text wrapping behavior in p5.js does not match the documentation for text()
(or the documentation is ambiguous). The documentation states that specifying maxWidth
and maxHeight
in the text()
function should automatically wrap text within those dimensions:
"The fourth and fifth parameters, maxWidth and maxHeight, are optional. They set the dimensions of the invisible rectangle containing the text...Text will wrap to fit within the text box."
While word wrapping occurs when boundaries are set, character-wise wrapping requires the additional textWrap(CHAR)
call, which is not mentioned in the documentation.
This is also different from the way the text()
function works in Processing, where text character-wise wrapping is enabled by default when setting the fourth and fifth parameters of the text()
function (see: processing/processing-website#544)
Steps to Resolve
I can think of two ways to resolve this:
A) Set text()
to automatically wrap characters when setting the fourth and fifth parameters. This would have the advantage of matching the behavior of the function by the same name in Processing.
or
B) Update the documentation to clarify that "Text will wrap to fit within the text box" on words only and that an additional textWrap(CHAR)
will be required to wrap on characters.
Metadata
Metadata
Assignees
Type
Projects
Status