Type + Code: Processing For Designers

Page 28

Type + Code page >L< even {4} page Yeohyun Ahn. Viviana Cordova.

2.0

text( ) Letter and word The function text( ) is essential for typography in Processing, since it is used to designate the letters and words that the other functions can transform. The example below shows how the function can be used. First, myFont = createFont("Univers", 32) calls for the desired font, in this case Univers at a point size of 32. Secondly, textFont(myFont) assigns that font (Univers, 32pt) to the text that we wish to have displayed. While the final function, text ("T"), calls and displays the content; here it is the capital letter "T".

PFont myFont; void setup() { //size has to be placed always at //the beginning size(200, 200); //create a white background background(255,255,255); //loading a font from your computer and size myFont = createFont("Univers", 32); textFont(myFont); //fill the text color to black fill(0,0,0); //text written and location for //x:55 and y:90 translate(55,90); //text function text("T"); }

In case of errors, look for an updated version of the application at the Processing Web site. For more information, please visit www.processing.org/ reference/PFont.html.


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.