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  

createFont()

   
Examples  
PFont myFont; 
 
void setup() { 
  size(200, 200); 
  // Uncomment the following two lines to see the available fonts 
  //String[] fontList = PFont.list(); 
  //println(fontList); 
  myFont = createFont("FFScala", 32); 
  textFont(myFont); 
  text("!@#$%", 10, 50); 
} 
 

Description   Dynamically converts a font to the format used by Processing from either a font name that's installed on the computer, or from a .ttf or .otf inside the data folder of the sketch. Use the PFont.list() method to first determine the names for the fonts recognized by the computer. If you're going to be sharing the program with other people or posting it on the web, it's important to include a .ttf or .otf version of your font the the data directory of the sketch because other people might not have the font installed on their computer.

Use the PFont.list() method to first determine the names for the fonts recognized by the computer. The size parameter states the font size you want to generate. The charset parameter is an array of chars which specifies the characters to generate and the smooth parameter specifies if the font should be antialiased or not. Processing displays fonts using the .vlw font format, which uses images for each letter, rather than defining them through vector data.
   
Syntax  
createFont(name, size)
createFont(name, size, charset)
createFont(name, size, smooth)
createFont(name, size, charset, smooth)
   
Parameters  
name   String: name of the font to load

size   float: point size of the font

charset   char[]: array containing characters to be generated

smooth   boolean: true for an antialiased font, false for aliased

   
Returns   PFont
   
Usage   Web & Application
   
Related   PFont
 
 






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








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