How to jump the line when it reaches the limit of a window?

I am working in processing and I have to print the following:

What I want to do is that when the limit of the window of a line break is reached and I write the letter just below the first P, I will make the line break but write the letter at the end and not at the beginning. I hope you can help me I leave the piece of code where I am trying to do this:

void letrero(int px,int py, String cadena)
   for (int i=0; i<cadena.length(); i++)
       if(sumatoria >=470 ){
         py = py+30;
         px = 10;  
        dibujaletra(px+20*i*escala, py, alfabeto[ int(cadena.charAt(i)) ] );         
        sumatoria = px+20*i*escala;       

px is not your writing position

The if clause is good

But increase px every time and use it as dibujaletra / text parameter

thanks for the idea Chrisir

1 Like