feat: add FES warning for zero or negative textSize by YuktiNandwana · Pull Request #8655 · processing/p5.js

Hi everyone!

This PR adds a Friendly Error System (FES) warning when textSize() is called with a value of 0 or less.

Why this change?
While looking into issue #8649, I noticed that if a user accidentally sets textSize(0), the textLeading also becomes 0. If this text is constrained by a width, it wraps but draws all lines exactly on top of each other at the same Y-coordinate. This creates a confusing overlapping effect for users.

Adding this warning helps beginners quickly realize the typo instead of getting stuck on why their text looks broken.

What was done:

  • Added a validation check inside p5.prototype.textSize in src/typography/attributes.js.
  • It now triggers p5._friendlyError if theSize <= 0.

I've tested this locally and the FES warning shows up correctly in the console. Let me know if any changes are needed!

Fixes #8649