Replace words with different synonyms and print each combination in a text file

(I am just referring to this part of the discussion, no mixing of words)

here is a version where you can hit a key to get a new screen

(text parts in different sizes)



PFont font;

String [] lines;
int index = 0;


void setup() {
  size(1700, 1000);
  font = createFont("Menlo-Regular", 20);
  // String [] s = loadStrings("DieLeidendesjungenWerther.txt");


  String everything; // = join(s, " ");
  everything = "Wie froh bin ich, daß ich weg bin! Bester Freund, was ist das Herz des Menschen! Dich zu verlassen, den ich so liebe, von dem ich unzertrennlich war, und froh zu sein!"; 

  println(everything);
  lines = splitTokens(everything, ",.?!;:");
  //  printArray(lines);
  textFont(font);
  frameRate(2);
}


void draw() {
  background(0);
  int y=7; 
  for (int index=0; index<lines.length; index++) {
    textSize(random(12, 200));
    float a1= textAscent() + textDescent();     // adding the textAscent() and textDescent() values will give you the total height of the line.

    y+=a1+13;
    text(lines[index], 10, y);
  }
  noLoop();
}

void keyPressed() {
  redraw();
}


In this version lines appear one by one

PFont font;

String [] lines;
int index = 0;

int y=7; 

boolean stopFlag=false;

void setup() {
  size(1700, 1000);
  font = createFont("Menlo-Regular", 20);
  // String [] s = loadStrings("DieLeidendesjungenWerther.txt");

  String everything; // = join(s, " ");
  everything = "Wie froh bin ich, daß ich weg bin! Bester Freund, was ist das Herz des Menschen! Dich zu verlassen, den ich so liebe, von dem ich unzertrennlich war, und froh zu sein!"; 

  println(everything);
  lines = splitTokens(everything, ",.?!;:");
  //  printArray(lines);
  textFont(font);
  frameRate(2);
  background(0);
}

void draw() {

  if ( ! stopFlag ) {
    textSize(random(12, 200));
    float a1= textAscent() + textDescent();     // adding the textAscent() and textDescent() values will give you the total height of the line.
    y+=a1+13;
    text(lines[index], 10, y);
  }

  if (index<lines.length-1) {
    index++;
  } else {
    stopFlag=true;
  }
}

void keyPressed() {
  // reset 
  println("key");
  background(0);
  clear();
  index=0;
  y=7;
  stopFlag=false;
}

line break is not when the
line is longer than the width of the screen
but I just display the content of the lines array item by item.

Chrisir