Well, with Processing 1.1 on Windows XP SP3, I tried:
Code:import processing.pdf.*;
PFont fontR;
PFont fontB;
void setup()
{
size(512, 512, PDF, "test.pdf");
background(255);
fontR = createFont("Bitstream Vera Sans", 48);
fontB = createFont("Bitstream Vera Sans Bold", 48);
fill(0);
}
void draw()
{
textFont(fontR);
text("This is a regular font", 20, 100);
textFont(fontB);
text("This is a bold font", 20, 200);
exit();
}
and the font of the second line was bold.
I tried also with the .ttf files in the data folder:
Code:import processing.pdf.*;
PFont fontR;
PFont fontB;
void setup()
{
size(512, 512, PDF, "test.pdf");
textMode(SHAPE);
g.textMode = SHAPE; // Should be done by textMode() call
background(255);
fontR = createFont("Vera.ttf", 48);
fontB = createFont("VeraBd.ttf", 48);
fill(0);
}
void draw()
{
textFont(fontR);
text("This is a regular font", 20, 100);
textFont(fontB);
text("This is a bold font", 20, 200);
exit();
}
I noticed a bug, textMode variable isn't set by textMode() method. I will report it. [EDIT: no need, I just updated my copy of the source to the latest version on SVN and saw it is corrected]