04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Tools menu<br />

Figure 5-7 shows a screenshot of <strong>Processing</strong>’s Tools menu.<br />

The Tools menu contains the following five comm<strong>and</strong>s:<br />

Auto Format (Cmd+T on OS X; Ctrl+T on Windows): This comm<strong>and</strong> attempts to<br />

format the code layout for optimal readability. Skipped lines, also referred to as<br />

whitespace, are retained. Syntax errors, such as missing semicolons, are not corrected.<br />

Auto Format was originally called “beautify,” which is the name of a similar<br />

function in <strong>Processing</strong>’s forebear, Design By Numbers (DBN). Here is an example of<br />

how Auto Format works. If I type the following code into the text editor <strong>and</strong> select<br />

Auto Format:<br />

void setup(){}void draw(){}<br />

then the code will be reformatted to the following:<br />

void setup(){<br />

}<br />

void draw(){<br />

}<br />

Figure 5-7. Screen capture of<br />

<strong>Processing</strong>’s Tools menu<br />

THE PROCESSING ENVIRONMENT<br />

Create Font: One of the challenges of designing for the Web is the incompatibility<br />

of system resources such as installed fonts, which will often be different from<br />

machine to machine <strong>and</strong> across platforms. One solution is to use only a very limited<br />

set of fonts that can be assumed to be installed on most systems—such as<br />

Arial, Times, <strong>and</strong> Sans. However, from a design perspective, this is pretty limiting.<br />

Another solution is to bundle bitmap glyphs (actual raster graphics of each character<br />

in a font family) with a project to allow the use of fonts that aren’t likely to be<br />

installed on a user’s machine. The Create Font comm<strong>and</strong> does just this. The comm<strong>and</strong><br />

opens the Create Font dialog box, which allows you to select any font<br />

installed within your system (see Figure 5-8). This dialog includes the options Size,<br />

Filename, Smooth (for anti-aliasing), <strong>and</strong> All Characters. The font generated is a copy<br />

of an existing font in your system, created in the VLW font format <strong>and</strong> installed<br />

within a data subdirectory in the current sketch directory. Similar to loading other<br />

media into <strong>Processing</strong>, a data directory is automatically created, if one doesn’t<br />

already exist. There are some memory concerns involved in creating fonts this way.<br />

The larger the font size you specify, the more memory the font will use, as each<br />

font includes the actual raster information needed to draw the individual characters;<br />

normally, fonts are created using vector data. In addition, the Smooth option<br />

also requires a little more memory, as does the All Character option, which includes<br />

155<br />

5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!