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 › How do I outline/stroke text
Page Index Toggle Pages: 1
How do I outline/stroke text? (Read 542 times)
How do I outline/stroke text?
Dec 3rd, 2008, 3:44pm
 
I've tried setting strokeWeight() but that's not working.

I've got white text on top of a changing background.  When the background is dark you can read it, but when the background lightens up the text becomes hard to read if not impossible.  So I'd like to outline the text in black to define it better on light backgrounds.  How do I do this?
Re: How do I outline/stroke text?
Reply #1 - Dec 3rd, 2008, 6:04pm
 
Text in Processing is bitmap based, so stroke attributes are ignored.
A way to do something like what you want is the classical "draw text twice with offset":

 // Dark
 fill(#224488);
 text(message, 18, 98);
 // Optional
 text(message, 22, 102);
 // Clear
 fill(#9977EE);
 text(message, 20, 100);
Page Index Toggle Pages: 1