[p5.js 2.0 Beta Bug Report]: Confusing log when loading font with callback
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 24k
- Forks
- 3.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 25
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
2.0.0 beta 2
Web browser and version
Chrome 132.0.6834.111
Operating system
MacOSX Sequoia 15.2
Steps to reproduce this
When loading a font with a callback in 2.0, a message is generated to the console that says:
🌸 p5.js says: Expected at most 1 argument, but received more in loadFont(). For more information, see https://p5js.org/reference/p5/loadFont..
Unless the docs are out of date, I thought callbacks were still supported, so we probably shouldn't be logging this message. If I'm wrong about the api changes, then maybe we should log a message about the callback api being no longer supported. I'm not super up to date on all the changes in 2.0 so feel free to close if this is a non-issue!
Steps:
- Call
loadFont("myfont.ttf", font => {}) - Observe the warning in the console
Snippet:
https://editor.p5js.org/aferriss/sketches/dEb0fiahL
function setup() {
createCanvas(400, 400);
loadFont("Arial.ttf", font => {
textFont(font);
// Check console
})
}
function draw() {
background(220);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the loadFont() entry point and reproduce the warning using the linked p5.js Editor sketch in Chrome. Check whether the callback form is still supported in p5.js 2.0.0 beta 2 and identify the expected console behavior; the issue is done when valid callback usage no longer produces a misleading warning, or the message clearly explains that callbacks are unsupported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100