[p5.js 2.0 Bug Report]: textToContours font loading error
A pull request for this has already been merged.
- #8083 by @perminder-17 — merged
- 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.3
Web browser and version
Chrome 138.0.7204.49 (Official Build) (arm64)
Operating system
MacOS
Steps to reproduce this
On occasion, loading a font and using textToContours produces the following error message when I click "play":
Error: No font data available for "f7a07e45-b775-4899-8ca2-552c06c273b5"
You may have encountered a CORS error
🌸 p5.js says: It looks like there was a problem loading your file. Try checking if the file path (https://assets.editor.p5js.org/5cf41a40044a33001e3eb90c/f7a07e45-b775-4899-8ca2-552c06c273b5.otf?v=1753048300953) is correct, hosting the file online, or running a local server.
+ More info: https://github.com/processing/p5.js/wiki/Local-server
WARN: No glyph data for 'f7a07e45-b775-4899-8ca2-552c06c273b5', retrying as FontFace
🌸 p5.js says: [sketch.js, line 22] An error with message "No font data available for "f7a07e45-b775-4899-8ca2-552c06c273b5"
Try downloading a local copy of the font file" occurred inside the p5js library when textToPaths was called. If not stated otherwise, it might be an issue with the arguments passed to textToPaths. (https://p5js.org/reference/p5/textToPaths)
Usually, stopping then replaying the sketch, or reloading the page will fix the issue. But about 10%-20% of the time when clicking "play", this occurs. Could this be an issue with await loadFont?
Tried it with multiple font files and the issue persists.
This is my code: https://editor.p5js.org/zekewattles/sketches/ASfMLKeel
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 by reproducing the linked p5.js Editor sketch, focusing on sketch.js line 22 and the loadFont/textToContours call. Review merged pull request #8083 and the reported font-loading and textToPaths errors; done means the intermittent failure no longer occurs when the sketch is played repeatedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100