Using another text renderer

test
Another way to do it

String s = "The quick brown fox";
PGraphics pg;

void setup() {
  size(200, 100, P2D);
  background(200, 255, 200);
  // P2D text
  textSize(12);
  fill(128, 0, 128);
  text(s, 0, 20);
  // Now for the alternative
  pg = createGraphics(200, 30, JAVA2D);
  pg.beginDraw();
  pg.clear();
  pg.textSize(12);
  pg.fill(128, 0, 128);
  pg.text(s, 0, 20);
  pg.endDraw();
  image(pg, 0, 24);
}
2 Likes