-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[p5.js 2.0 Beta Bug Report]: Document difference between textWidth and fontWidth with respect to whitespace #7745
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
Comments
Looks like maybe a conditional logic issue, with the empty string not getting evaluated? If the space is between characters, it is counted: With 2.0:
Volunteers welcome to work on fixing this issue! Specifically, |
Hi! I would like to be assigned to this issue. |
Thanks @HughJacks ! I'll assign this to you. |
Maybe @dhowe has some more info on what the difference between Some possible options I could see here:
|
|
It sounds like we do want space to be significant in that case? Since a single space character would still have a bounding box. So would it sound right to you to take the width returned by the current implementation of |
Here is the current behavior (which is consistent) for the two varieties of xWidth and xBounds, noting that
So it may be that we only need to make this clear in the reference (?) |
ok, I think that makes sense! In probably the references for both text and font width, we could briefly explain that one is tight and one is loose, and possibly show a comparison example on both references too (could be the same one on both.) |
Thank you so much for the explanation and investigation @HughJacks @dhowe and @davepagurek! @HughJacks so the current behavior is actually the expected/correct behavior, but it the documentation + examples could really benefit from updates as suggested above:
Are you still interested in addressing this issue? If so, please feel free to go ahead and put together a PR updating the documentation for these 2 functions. |
Hey @ksen0 sorry for slightly delayed response. Yes I would be interested in updating the documentation and examples. I will get on that soon. Thanks to everyone for their help. |
No worries and no rush @HughJacks ! Thanks for taking this on |
Most appropriate sub-area of p5.js?
p5.js version
Latest dev-2.0
Web browser and version
Firefox
Operating system
MacOS
Steps to reproduce this
This logs 0 in 2.0 but something around 5 in 1.x:
Live: https://editor.p5js.org/davepagurek/sketches/xlqZOPgIR
The text was updated successfully, but these errors were encountered: