Processing js will handle fonts different to Processing Java. In Processing Java fonts are pulled from your machine. Too see a list of your fonts run this.
size(200, 200);
String[] fontList = PFont.list();
printArray(fontList);
As a designer I like to use custom fonts that not everyone will have installed. Because of this, you will need to upload a version of the font to your server so all users will have the same experience on the web.
First add this to the top of your sketch and add your font to the data folder. Depending on your project setup you might need to add it in the top of your directory.
/* @pjs
crisp=true;
font=/yourfont.ttf;
*/
Next, in your setup reference the font. ( This is where i had a few problems ) I was loading lineto-brown-pro-bold.ttf
and had to reference it under Brown
even tho in my fontlist it was Brown-bold
. Add this line to your setup.
font_name = createFont("/yourfont.ttf", 32);
and in your draw use
textFont(font_name);
So the code all together is
/* @pjs
crisp=true;
font=/yourfont.ttf;
*/
PFont font_name;
void setup() {
size (200, 330);
background (34);
font_name = createFont("/yourfont", 32);
smooth();
}
void draw() {
background (34);
textFont(font_name);
textSize(100);
fill(255);
text ("futura in pjs", 20, 310);
}
For more information check out the processing.js docs http://processingjs.org/reference/font/
and also a good example and write up on http://alsoko.net/processing.js-custom-fonts/