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.
IndexProgramming Questions & HelpSyntax Questions › Easy question: Rotating text
Page Index Toggle Pages: 1
Easy question: Rotating text? (Read 600 times)
Easy question: Rotating text?
Mar 20th, 2006, 12:52pm
 
Hi,

This should be really easy but I can't seem to get it to work.  In the following sketch, if I comment out the rotate line things are fine.  But when I try to rotate the text, I just get a blank sketch.  What am I missing?

Quote:

PFont myFont = loadFont("Georgia-BoldItalic-48.vlw");
size(200,200);
textFont(myFont);
rotate(-PI/2);
text("test",100,100);


Thanks,
James
Re: Easy question: Rotating text?
Reply #1 - Mar 20th, 2006, 1:20pm
 
This schould work:
Quote:


PFont myFont = loadFont("Georgia-BoldItalic-48.vlw");
size(200,200);
textFont(myFont);
pushMatrix();
translate(100,100);
rotate(-PI/2);
text("test",0,0);
popMatrix();


Re: Easy question: Rotating text?
Reply #2 - Mar 20th, 2006, 3:16pm
 
I knew I was missing something obvious.  For future readers who are wondering, the key step is translating the origin to the middle of your text; otherwise the text might be rotated about a far-away point until it's out of view.

Thanks!
Page Index Toggle Pages: 1