dimanche 20 mars 2011

Text research

In database visualisation we can have a dataset which consists of numbers or of text.
In case of numbers we can easily do some graphics. Text is more versatile, but coding properties of text requires a bit of knowledge of the functions around Strings.
A wonderful text and string tutorial is found here:

http://processing.org/learning/text/

possibly we also need to know the pixel position of a word in a piece of text:
we start searching the position of the word, indicating the character number, if the word is found,
String myText = "we always cry out for love";
int lovePosition = myText.indexOf("love");//indexOf is the JAVA function

then to have the word "love" made special, colored or bold, we can use the tricks mentioned in this link using textWidth, looping through the string, with charAt.

Aucun commentaire:

Enregistrer un commentaire