-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
TextToPoints() ignores text alignment #6893
Comments
This is not a bug from p5 code, it is an issue from textAlign property. Please reach out to developers for textAlign for this problem! More info can be found here [https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign] |
@RuimingShen I'm not sure I understand your answer. What's the issue with My report refers to
I updated the sketch to make it clearer. Please let me know if that makes sense. |
@RuimingShen may be confused about how textAlign works. But to provide some clarity on the issue, when textToPoints() was initially written, it did not include support for multiple text lines. If you needed multiple lines, you would call it multiple times. At some point, support for splitting a string on line breaks was added, but without corresponding support for the various alignments. Fixing this would require only (I think) using the existing _handleAlignment() function from textBounds() in textToPoints() as well |
I'd like to work on this. |
Most appropriate sub-area of p5.js?
p5.js version
1.9.1
Web browser and version
Chrome 122.0.6261.129
Operating system
macOS
Steps to reproduce this
Steps:
\n
)textAlign(CENTER, BASELINE)
and thentextToPoints
on that string.Snippet:
see https://editor.p5js.org/araid/sketches/S7DRlqtvP
The text was updated successfully, but these errors were encountered: