text height problem
in
Programming Questions
•
2 years ago
hi,
i've allready looked at some examples for text height, but i have a text with a few rows. I think it doesn't get the right amounts. Here's my code:
i've allready looked at some examples for text height, but i have a text with a few rows. I think it doesn't get the right amounts. Here's my code:
- translate(width/2,windowPosition);
hint(DISABLE_DEPTH_TEST);
// text(stringdata, x, y, width, height, z)
//text(questionShow,BeginXVisualisatie, 100,500,99999);
int marges = 10;
float TotalValText = 0;
for (int x = 0; x< showWords.length; x++) {
// gevonden woorden
textFont(fontResults);
textLeading(7);
float sw = textWidth(showQuestionNot[x]);
float textHeightInPixels = textAscent() + textDescent() ;
float textWidthVal = 400;
float numRowsText = sw/textWidthVal;
float textHeightVal = numRowsText*textHeightInPixels;
float totalBeginText = TotalValText+5;
println("x "+x+" textWidth " + sw+ " asc: "+textHeightInPixels+ "total "+numRowsText*textHeightInPixels);
text(showWords[x],BeginXVisualisatie, TotalValText,textWidthVal,textHeightVal);
TotalValText = TotalValText+(numRowsText*textHeightInPixels+marges); - }
1
