-
-
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
[p5.js 2.0 Beta Bug Report]: textFont() throws error when a p5.Font is applied #7491
Comments
Hi, I'm student coder at Paris 8 University and I'd like to try to contribute on p5.js. Does this issue still need someone to work on @davepagurek ? |
Thanks @seyko1, I'll assign this to you! This issue is for 2.0, which means branching off of the |
I looked into this very briefly and it seems that some of the old functions in the subclass p5.Renderer2D are being called (textWidth) in this case, rather than those in parent p5.Renderer itself. The solution is, I believe, to just remove those old functions from p5.Renderer2D (for example, anything mentioning opentype) |
I also got the same error from Except these two things about _textWidth, there are other functions that seem to be removed :
I will wait for your answers but I suppose It's better to firstly create a PR to fix this little issue with |
I'm not sure what changed in the last couple of weeks to cause these issues, but the updated/correct functions should be in There should be no 2d public text functions in the p5.Renderer2D.js file - some private functions are attached to the prototype in @davepagurek should be able to answer questions regarding these and First step is probably to add a test that fails on this case as current tests aren't catching it |
In general, anything defined in There are some methods that do need to be different per renderer, and It would be good, after fixing the bug, to clean up this structure a bit -- |
Most appropriate sub-area of p5.js?
p5.js version
2.0 beta 1
Web browser and version
Firefox
Operating system
MacOS
Steps to reproduce this
Steps:
textFont()
textWidth()
When no font is applied this works, but with a
p5.Font
applied, I getTypeError: this.states.textFont._textWidth is not a function
Snippet:
Live: https://editor.p5js.org/davepagurek/sketches/TuNtJ4gJt
The text was updated successfully, but these errors were encountered: