Hi, I am new to Processing and I was wondering if anyone could help me with this:
I have this text file uploaded into a string array and it runs over 4 lines (elements 0,1,2,3)
I have to center the first two lines
And format the [3] 4th line so that it runs over many lines and is left aligned.
here is a some copies of my setup and draw:
void setup()
{
size(600, 600);
//this is the information used for the text and font
font = loadFont("Tahoma-48.vlw");
textFont(font, 16);
textAlign(LEFT);
smooth();
prose = loadStrings("prose.txt");
lineHeight = textDescent() + textAscent();
x = 10;
y = lineHeight;
}
void draw()
{
background(32);
fill(255);
y = lineHeight;
for(int i = 0; i < prose.length; i++)
{
text(prose[i], x, y);
float lineWidth = textWidth(prose[i]);
y += lineHeight;
//formatting the first two lines
prose[0] = prose[0].toUpperCase();
stroke(255);
line(x,lineHeight,textWidth(prose[0]),lineHeight);
prose[1] = prose[1].toLowerCase();
}