Skip to content
Dan Bernier edited this page Sep 9, 2017 · 9 revisions

Can't find the answer you need? Send me a note at wordcram-at-gmail, or ask me on twitter.

What can it do?

Are words "clickable"?

Yes. Save a reference to the wordcram, and in your sketch's mouseClicked events, ask the wordcram whether there's a word at the mouse-click's coordinates. Something like this:

WordCram wordCram;

void setup() {
  wordCram = new WordCram(this)...
  wordCram.drawAll();
}

void mouseClicked() {
  Word word = wordCram.getWordAt(mouseX, mouseY);
  if (word != null) {
    ...
  }
}

For a complete running example sketch, check out File > Examples > Contributed Libraries > WordCram > tutorial > L_clickableWords.

Can it write to PDF?

Yes! It was added in the 0.5 release, and announced here.

To make a word cloud PDF, make your word cram sketch like you normally would, except:

  • add import processing.pdf.*; to the top
  • set up your sketch with size(<yourWidth>, <yourHeight>, PDF, "path/to/your.pdf");

You can see a full example under File > Examples > Contributed Libraries > WordCram > OtherExamples > renderToPdf.

Does it work with Processing.js?

No, but I'm looking into it. It depends on whether javascript can "sense" the shape of the words to detect collisions. But it would be really cool to see word clouds in the browser.

If you know anything about turning fonts or words into something like a java.awt.Shape, let me know!

Something's not working right

Why do my words come out fuzzy?

If you're loading your fonts with loadFont, try using createFont instead. loadFont doesn't work as well for rendering characters at different sizes.

Why don't any of my words show up?

Are you using something like Colorers.pickFrom(0) or Colorers.pickFrom(255)? Try using Colorers.pickFrom(color(0)) and Colorers.pickFrom(color(255)) instead.

Processing internally stores colors as integers, with the alpha in the highest bits, so it sees the integer 0 as colorless and completely transparent. A WordCram created with Colorers.pickFrom(0) will render the words, they'll just be invisible.

Colorers.pickFrom() takes a bunch of colors, so it treats each integer it gets as a Processing color/integer. This is really a misleading API, and it should be sorted out.

Why don't all of my words show up?

Long story short: there probably isn't enough room to place all the words where you want them to go. Try making them smaller, or moving them around. You can read more about it on the blog.