We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Vertical text? (Read 2222 times)
Vertical text?
Feb 12th, 2010, 5:13am
 
How can I display text flowing vertically? That is to say...

L
i
k
e

T
h
i
s
Re: Vertical text?
Reply #1 - Feb 12th, 2010, 5:27am
 
By displaying the letters one by one with proper positioning.
Re: Vertical text?
Reply #2 - Feb 12th, 2010, 12:45pm
 
Like This

Code:
String message;
PFont font;

void setup(){
 size(200,200);
 font = createFont("Arial",12);
 textFont(font);
 message = "Like This";
 background(0);
 stroke(255);
 for(int i = 1; i <= message.length(); i++){
   text(message.substring(i-1,i), 20, 20 + i *18);
 }
}
Re: Vertical text?
Reply #3 - Feb 13th, 2010, 11:05am
 
How can this code also be applied to more than one character per line...

Can I somehow define it to show ...say two characters at a time per line?
Re: Vertical text?
Reply #4 - Feb 13th, 2010, 11:19am
 
Well yeah. You'd just have to change the looping conditions and which substring it's printing. It might be helpful if you made sure your string's length was a multiple of how many characters you wanted on each line...
Re: Vertical text?
Reply #5 - Feb 13th, 2010, 2:32pm
 
Is it possible to display the letters vertically as well.  Ie.  like the original post except each letter would be rotated 90 degrees clockwise?

Thanks!
Re: Vertical text?
Reply #6 - Feb 14th, 2010, 1:28am
 
Just use rotate().
Re: Vertical text?
Reply #7 - Mar 25th, 2010, 6:33pm
 
I tried putting rotate in just in front of text but it just made the text disappear. Any ideas? The code is below.

 textFont (labelFont);
 textAlign(LEFT, TOP);
 text(xLabel[0], Xposition, GraphBottom+10);
 rotate(PI/3.0);
 text(xLabel[1], Xposition2, GraphBottom + 10);

The first label is there, but the second after the rotation is gone.
Re: Vertical text?
Reply #8 - Mar 25th, 2010, 9:20pm
 
bjorn?
Re: Vertical text?
Reply #9 - Mar 26th, 2010, 2:02am
 
In general, rotate() must be used along with translate() to reposition the coordinates on screen.
Page Index Toggle Pages: 1