Process text as shapes?

Hi guys,

Is there a way to code a program that proceses text and displays them as specific shapes in processing?

An example of this is the work of Leslie Roberts
https://leslierobertsart.com/section/425019-Recent-works-on-panel.html

we’ve tried making an array with the keyboard keys and the shapes as classes but so far nothing has worked.

thanks!

1 Like

show your code then

that’s the most simple:

int lowerRightCornerX; 
String list="asd"; 

//
// ---------------------------------------------------------------
//
void setup()
{
  // init
  size(800, 600);

  lowerRightCornerX=86 ;
} // func 

void draw() 
{ 
  background(255);

  int x=1; 

  for (char c : list.toCharArray()) {

    switch (c) {

    case 'a':
      triangle(60*x+4, 75, 
        58*x+4, 20, 
        lowerRightCornerX*x*1+4, 75);
      break; 

    case 's':
      rect(60*x+4, 20, 
        33, 56);  
      break; 

    case 'd':
      ellipse(60*x+4, 20+33, 
        33, 33);
      break; 

    default: 
      break;
    }//switch
    x++;
  }//for
} // func 
//
// =====================================================================
1 Like

Wow, by now I improved it greatly!

Also see P.3 in here: http://www.generative-gestaltung.de/1/code

1 Like

Agreed that Generative Gestaltung is a great resource for projects like yours. Note that they have a little “EN” link if you want the English version of the pages, or direct link:

http://www.generative-gestaltung.de/1/lang/en

You should share what you have attempted!

Do you want something more like an interactive shape typewriter, or do you want to load a text file and display an image?

Here is a very, very simple example of an interactive “shape typer” – no classes, just a core concept.

/**
 * SimpleShapeTyper
 * 2019-04 Processing 3.4
 * discourse.processing.org/t/process-text-as-shapes/10006/4
 **/
PVector cursor;
int dim = 20;

void setup() {
  cursor = new PVector(0, 0);
}
void draw() {
}
void keyPressed() {
  if (key%2==0) {
    rect(cursor.x, cursor.y, dim, dim);
  } else {
    ellipse(cursor.x+dim/2, cursor.y+dim/2, dim, dim);
  }
  cursor.add(dim, 0);
  if (cursor.x >= width) {
    cursor.add(-cursor.x, dim);
  }
  if (cursor.y >= height) {
    cursor.set(0, 0);
    background(192);
  }
}

08%20AM