We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am using the following text() signature:
text(str, x1, y1, x2, y2);
where: x1 and y2 are cordinates of the text box and x2 and y2 are width and height of text box
I would like the font to have the highest possible size for which it still fits entirely into the text box specified by x2 and y2. I cannot use trial and error to determine the right font size - the String length varies, so the font size must be adapted each time the String length is altered.
The width and height of the box are constant - so the font size depends on them, not the other way around.
I was wondering if there was a simple method to achieve this?
I tried finding a formula for the font size but didn't succeed since the text size in this context depends on many factors:
Do you know the solution to this problem? Maybe there is a built in Processing method that does that?