Skip to content

Improve WebGL font error message to suggest textFont() usage#8494

Merged
davepagurek merged 2 commits intoprocessing:mainfrom
yugalkaushik:font-fix
Feb 7, 2026
Merged

Improve WebGL font error message to suggest textFont() usage#8494
davepagurek merged 2 commits intoprocessing:mainfrom
yugalkaushik:font-fix

Conversation

@yugalkaushik
Copy link
Contributor

Improves the error message when rendering text in WebGL mode without properly setting a font.

Problem:
The current error "only Opentype (.otf) and Truetype (.ttf) fonts are supported" is misleading when users have loaded a valid font but forgot to call textFont().

Solution:
Added clarification: "Make sure to set the font using textFont() before drawing text."

PR Checklist

@welcome
Copy link

welcome bot commented Feb 4, 2026

🎉 Thanks for opening this pull request! For guidance on contributing, check out our contributor guidelines and other resources for contributors!
🤔 Please ensure that your PR links to an issue, which has been approved for work by a maintainer; otherwise, there might already be someone working on it, or still ongoing discussion about implementation. You are welcome to join the discussion in an Issue if you're not sure!
🌸 Once your PR is merged, be sure to add yourself to the list of contributors on the readme page !

Thank You!

@ksen0
Copy link
Member

ksen0 commented Feb 6, 2026

If the test runs, then this sounds reasonable and helpful! I checked the failing test and I'm not sure what was up, I reran. If it fails, then code would need to be updated so tests do pass.

Minor wording revision to keep the message same length:

WEBGL: requires Opentype (.otf) or Truetype (.ttf) font, loaded using textFont() before drawing text.

cc @davepagurek @perminder-17

@yugalkaushik
Copy link
Contributor Author

yugalkaushik commented Feb 7, 2026

@ksen0 all tests are passing now.

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Would you be interested in making a similar update to the dev-2.0 branch, which p5 2.x builds are made from?

@davepagurek davepagurek merged commit 846d1fe into processing:main Feb 7, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments