29. Text I
-
Upload
joseph-murphy -
Category
Education
-
view
66 -
download
1
Transcript of 29. Text I
![Page 1: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/1.jpg)
From last time…
• Explored filters, blend modes, and masks!
• Wrapped up PImage, Capture, and Movie
![Page 2: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/2.jpg)
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?
![Page 4: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/4.jpg)
CAP 3032
Text I
![Page 5: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/5.jpg)
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);
![Page 6: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/6.jpg)
Basic String MethodscharAt(index)
equals(“hey”)
indexOf(“M”)
length()
substring(beginInd) OR substring(beginInd, endInd)
toLowerCase()
toUpperCase()
![Page 7: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/7.jpg)
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
![Page 8: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/8.jpg)
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…
![Page 9: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/9.jpg)
Setting Attributes
textFont() // sets the typeface
textSize() // sets the size
textAlign() // sets the alignment
textLeading() // sets the line spacing
![Page 10: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/10.jpg)
Getting Attributes
textWidth(str) // returns width of line
.textAscent() // returns ascender height
.textDescent() // returns descender height
![Page 11: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/11.jpg)
Text as Image
![Page 12: 29. Text I](https://reader033.fdocuments.in/reader033/viewer/2022052311/559635041a28abbd068b45d5/html5/thumbnails/12.jpg)
For next time…
• Reading: Shiffman, pp. 314–324 (Text II)!
• Homework 5: posted online (Text as Image)!
• Iteration 3: presentations about 1 week away