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 › Getting data for text length
Page Index Toggle Pages: 1
Getting data for text length (Read 454 times)
Getting data for text length
Jun 6th, 2007, 4:32am
 
Hi,
Quick and simple question, one that's probably really easy, but I'm just getting used to Processing and programming in general, so I'm hoping someone can help me out.

I'm trying to build a simple program that will take a user's text input, render it as one continuos line, and then save that to a graphics file. As part of that, I'm wondering what the easiest way to get the length the text being rendered to the screen in pixels...if that made any sense. I'm not even sure if I'm going about this the right way at all, so any comments in general would be appreciated.

Thanks for your help Smiley
Re: Getting data for text length
Reply #1 - Jun 6th, 2007, 9:07am
 
Processing has a nice built-in function to do exactly what you want:
http://processing.org/reference/textWidth_.html
Page Index Toggle Pages: 1