29. Text I

Post on 03-Jul-2015

71 views 1 download

Transcript of 29. Text I

From last time…

• Explored filters, blend modes, and masks!

• Wrapped up PImage, Capture, and Movie

Iteration 3 & Final• Your final project is 15% of your grade!

• Judged independently of your iterations on the following aspects:!

1. Visceral: how does it look and feel? Polished, professional, pleasant?!

2. Functional: is the code clean? Are there bugs, or does it run smoothly?!

3. Reflective: is it fun? Does it give me information? Is it interesting and does it make me think?

www.freemusicarchive.org

CAP 3032

Text I

Char’s & String’s• A char is a primitive type for a ‘character’ of text!

char myChar = ‘a’; // only single characters

• A String can be thought of as an array of char objects!

String myStr = “hi!”; // a string of text

println(myChar); println(myStr);

Basic String MethodscharAt(index)

equals(“hey”)

indexOf(“M”)

length()

substring(beginInd) OR substring(beginInd, endInd)

toLowerCase()

toUpperCase()

String Manipulationjoin(list[], separator)

split(str, delimiterString)

splitTokens(str, delimitersString)

trim(str) // removes white space from ends

nf(num, digits)

nfc() nfp() nfs() // comma, positive, space

Display & Loadingtext(text,x,y) // draws given text to x, y

PFont

.vlw // font file extension

loadFont() // loads existing .vlw

createFont() // create a .vlw on the fly

Create a vlw: Tools Menu, Create Font…

Setting Attributes

textFont() // sets the typeface

textSize() // sets the size

textAlign() // sets the alignment

textLeading() // sets the line spacing

Getting Attributes

textWidth(str) // returns width of line

.textAscent() // returns ascender height

.textDescent() // returns descender height

Text as Image

For next time…

• Reading: Shiffman, pp. 314–324 (Text II)!

• Homework 5: posted online (Text as Image)!

• Iteration 3: presentations about 1 week away