Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Visualize long texts and edit the content in Processing

$
0
0

i'm trying to recreate this poster to understand how to visualize long texts in processing. For the moment that is what i wrote:

import processing.pdf.*;

PFont f;
String txt [];
String myData [];
ArrayList romeopos = new ArrayList();
ArrayList julietpos  = new ArrayList();



void setup() {
  size(600, 800, P2D);
  background(255);
  f = createFont("Garamond", 9);
  txt=loadStrings("test.txt");


  myData = new String[txt.length];
  myData = txt[0].split(" ");
}



void draw() {
  noLoop();
  fill(50);
  textFont(f);

  for (int i=0; i<myData.length; i++) {

    if ( myData[i].toLowerCase().contains("romeo"))
      romeopos.add(i);
    if ( myData[i].toLowerCase().contains("juliet"))
      julietpos.add(i);
  }

  // text(txt[0], 10, 10, width-20, height-10);
  // println (myData);
}

i don't know how to continue, could you help me? the .txt is Romeo and Juliet written in one line.


Viewing all articles
Browse latest Browse all 2896

Trending Articles