We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I would like to export a pdf from a drawing sketch that uses a controlP5 knob, but an error occurs.
The below code's error message is "Use createFont() instead of loadFont() when drawing text using the PDF library."
Would you suggest using an external window (ControlFrame) for the knob?
import processing.pdf.*;
import controlP5.*;
int knobValue = 100;
ControlP5 cp5;
Knob myknobValue;
void setup() {
size(400, 400);
beginRecord(PDF, "filename.pdf");
cp5 = new ControlP5(this);
myknobValue = cp5.addKnob("knobValue")
.setRange(0, 100)
.setValue(0)
.setPosition(20, 170)
.setRadius(50)
.setNumberOfTickMarks(20)
.setTickMarkLength(4)
.snapToTickMarks(true)
.setColorForeground(color(255))
.setColorBackground(color(0, 160, 100))
.setColorActive(color(255, 255, 0))
.setDragDirection(Knob.VERTICAL)
;
}
void draw() {
strokeWeight(knobValue);
line(mouseX, mouseY, mouseX, mouseY);
if (keyPressed) {
endRecord();
exit();
}
}
Thanks in advance!