FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
      Language \ Environment \ Libraries \ Comparison
 
   
   
Abridged (A-Z) \ Complete (A-Z)  
   
  Reference for Processing (BETA) version 91+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.  
Name  

textWidth()

   
Examples  
PFont font; 
font = loadFont("FFScala-32.vlw"); 
textFont(font, 32); 
 
char c = 'T'; 
float cw = textWidth(c); 
text(c, 0, 40); 
line(cw, 0, cw, 50); 
 
String s = "Tokyo"; 
float sw = textWidth(s); 
text(s, 0, 85); 
line(sw, 50, sw, 100); 
Description   Calculates and returns the width of any character or text string.
   
Syntax  
textWidth(data)
   
Parameters  
data   char or String

   
Returns   Float
   
Usage   Web & Application
   
Related   loadFont()
PFont
text()
textFont()
 
 






   
 
Updated: Fri Jul 15 16:36:15 PDT 2005
 
 








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info