If you have some other way to weight your words, you can pass them to {@link #fromWords(Word[])}, and in that case, you can use {@link Word#setColor(int)}, {@link Word#setFont(PFont)}, {@link Word#setAngle(float)}, and/or {@link Word#setPlace(PVector)} tocontrol how any (or all) of your Words are drawn.
After all that, actually rendering the WordCram is simple. You can repeatedly call {@link #drawNext()} while the WordCram{@link #hasMore()} words to draw (probably once per Processingframe):
void draw() { if (wordCram.hasMore()) { wordCram.drawNext(); } } Or you can call {@link #drawAll()} once, and let it loop for you: void draw() { wordCram.drawAll(); } If you're having trouble getting your words to show up, you might want to {@link #getSkippedWords()}. Knowing which words were skipped, and why (see {@link Word#wasSkippedBecause()}), can help you size and place your words better.
You can also {@link #getWords()} to see the whole list, and{@link #getWordAt(float,float)} to see which word covers a given pixel. @author Dan Bernier
| |