protip: the java docs are amazing.
So i did a lot of reading in the java docs and managed to make this from what i could find:
- import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;
PFont font;
float lastx ;
float lasty ;
float[] coords = {0,0,0,0,0,0};
PathIterator pi;
String test;
void setup(){
size(1000,200);
background(255);
test = "Type Something: ";
font = createFont("Arial",40);
GlyphVector v = font.getFont().createGlyphVector(new FontRenderContext(font.getFont().getTransform(),true,false),test);
Shape s = v.getGlyphOutline(0);
pi = s.getPathIterator(font.getFont().getTransform());
pi.currentSegment(coords);
lastx = coords[0];
lasty = coords[1];
pi.next();
smooth();
}
int k;
void draw(){
translate(0,100);
if(!pi.isDone()){
if(pi.currentSegment(coords)!= pi.SEG_MOVETO){
line(coords[0],coords[1],lastx,lasty);
}
lastx = coords[0];
lasty = coords[1];
pi.next();
}
else if( k < test.length()){
GlyphVector v = font.getFont().createGlyphVector(new FontRenderContext(font.getFont().getTransform(),true,false),test);
Shape s = v.getGlyphOutline(k++);
pi = s.getPathIterator(font.getFont().getTransform());
pi.currentSegment(coords);
lastx = coords[0];
lasty = coords[1];
pi.next();
}
}
void keyTyped(){
test += key;
}
you have to figure out how to use it for yourself :) also this is clearly not finished but it should be a start.
Things to read in order to understand this:
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Font.html
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/font/GlyphVector.html
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Shape.html
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/PathIterator.html
If you are really want to make the program that you are describing you should seriously read all of that otherwise it's a lost
cause.
On a unrelated note, there seems to be something wrong with your enter key... All of your posts that i have seen have like 3 lines of text with like 2-7 line breaks between them...