-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text Wrapping Behavior in p5.js doesn't match the documentation #7163
Comments
Thanks for your question! I should have included examples/screenshots to clarify. The issue is with the default behavior of p5.js being inconsistent with the
However the text doesn't wrap on characters but only on words by default. An extra In Processing, the text wraps on characters by default if setting the text box's width, without the need to call Since p5.js doesn't have the goal to match the behavior of Processing exactly, it could also be a case of updating the documentation to clarify that behavior. |
Understood. I'm wondering if this is a duplicate of #4652, which was marked as completed (but may not be). Is this only an issue when a single 'word' is wider than the bounding box, or are there other cases? |
I only noticed a discrepancy on those "long words". Also related is #5321 in which @limzykenneth said:
If that's the case then the documentation could make clearer that the default wrapping behavior is word-wise as opposed to character-wise, especially since this differs from the default behavior in Processing. |
The text wrapping behavior in p5.js does not match the documentation for
text()
(or the documentation is ambiguous). The documentation states that specifyingmaxWidth
andmaxHeight
in thetext()
function should automatically wrap text within those dimensions: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 thetext()
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.The text was updated successfully, but these errors were encountered: