Skip to content

feat: add FES warning for zero or negative textSize#8655

Open
YuktiNandwana wants to merge 2 commits intoprocessing:mainfrom
YuktiNandwana:main
Open

feat: add FES warning for zero or negative textSize#8655
YuktiNandwana wants to merge 2 commits intoprocessing:mainfrom
YuktiNandwana:main

Conversation

@YuktiNandwana
Copy link

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

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.

Issue with wrapping text with a width

1 participant