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 › textWidth() , textSize()
Page Index Toggle Pages: 1
textWidth() , textSize() (Read 340 times)
textWidth() , textSize()
Apr 7th, 2008, 2:23am
 
textWidth() returns the width of a text string.

Is there a function returning the height of a text string?

textSize() sets the current font size, it doesn't return the value.
Re: textWidth() , textSize()
Reply #1 - Apr 7th, 2008, 2:54am
 
if you add textDescent() and textAscent() you get a pretty good result. But depending on the font it can be a couple of pixels out.
Re: textWidth() , textSize()
Reply #2 - Apr 7th, 2008, 3:20am
 
In the reference, they do say:
"adding the textAscent() and textDescent() values give the total height of the line"
which is surprising based on the reference definitions of textAscent() and textDescent().
Page Index Toggle Pages: 1