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 › Flipping text horizontally
Page Index Toggle Pages: 1
Flipping text horizontally (Read 1004 times)
Flipping text horizontally
Oct 23rd, 2009, 7:32am
 
I've seen similar topics about flipping an image horizontally but is it possible to do the same thing with text elements without converting them to an image beforehand?

Much thanks in advance.
Re: Flipping text horizontally
Reply #1 - Oct 23rd, 2009, 7:53am
 
Yes.
Use scale(-1.0, 1.0); and put a negative x coordinate to the text() call.

[EDIT] Demo:
Code:
void setup()
{
 size(400, 400);
 PFont font = createFont("Verdana", 24);
 textFont(font);
}

void draw()
{
 background(255);


fill(#008080);
text("X coordinate: " + mouseX, 200, 100);

fill(#8000FF);
pushMatrix();
scale(-1.0, 1.0);
text("Y coordinate: " + mouseY, -200, 200);
popMatrix();

fill(#00FF80);
pushMatrix();
scale(1.0, -1.0);
text("Time: " + (millis() / 1000), 200, -300);
popMatrix();
}
Re: Flipping text horizontally
Reply #2 - Oct 23rd, 2009, 8:57am
 
Brilliant - I didn't know you could do that!  Cheesy
Re: Flipping text horizontally
Reply #3 - Oct 24th, 2009, 6:39am
 
Works great.

Thank you.
Page Index Toggle Pages: 1