I don’t fully understand how your code works (since you didn’t post the whole version) but in general, you could change it with the help of
width & height variables. The simplest example would be:
textSize(width*0.1); //the larger the width, the larget the text
//but this doesn't take into accound height!
Or you could do something like this (if you have window size options available to user)
else if(width<200) textSize(10);
else if(width<300) textSize(15);
//and continue like this.
The 3rd option is to have everything automated. You let the user choose one of
Or you can automate this by using
//or using a function to get/calculate it
//(more flexible and no crashing
//since you can set default value even if preset is out of range)