Finding Text Height from a Text Area
in
Programming Questions
•
1 year ago
Hello.
I have looked the forum but no clear answer.
How is it possible to create a text area based on the lines of the text? As in the following example, you may notice that I enter the variables for the text area (x, y, width, height). However, in my case, I would like to know if there is a specific method of calculating the height of the text area automatically based on the number of lines.
Any ideas?
- String a1;
- String a2;
- size(200, 200);
- a1 = "This is a message written in Processing and it is displayed on the main window";
- a2 = "Another message written in Processing and it is displayed on the main window";
- text(a1, 10, 10, 150, 100);
- text(a2, 10, 100, 150, 100, 101);
1