This commit is contained in:
Casey Reas
2011-09-18 06:31:29 +00:00
parent 76e9248e00
commit 5b0214704c
86 changed files with 95 additions and 178 deletions

View File

@@ -13,14 +13,14 @@
* http://en.wikipedia.org/wiki/Concordance_(publishing)
*/
// The next line is needed if running in JavaScript Mode with Processing.js
/* @pjs font="Georgia.ttf"; */
HashMap words; // HashMap object
String[] tokens; // Array of all words from input file
int counter;
PFont f;
void setup() {
size(640, 360);
words = new HashMap();
@@ -29,7 +29,9 @@ void setup() {
String[] lines = loadStrings("dracula.txt");
String allText = join(lines, " ");
tokens = splitTokens(allText, " ,.?!:;[]-");
f = createFont("Georgia", 36, true);
// Create the font
textFont(createFont("Georgia",24));
}
void draw() {
@@ -70,7 +72,7 @@ void draw() {
if (w.count > 3) {
// The size is the count
int fsize = constrain(w.count, 0, 100);
textFont(f, fsize);
textSize(fsize);
text(w.word, x, y);
// Move along the x-axis
x += textWidth(w.word + " ");