Writing 3D text with PGraphicsPDF: "vertex(x, y, u, v) is not available with this renderer."
in
Core Library Questions
•
3 years ago
I'm trying to produce a PDF that contains scaled and rotated text. The text shows up on the screen, but doesn't appear in the PDF. I get a message in the console -- "vertex(x, y, u, v) is not available with this renderer" -- that I haven't seen elsewhere in the forums.
I'm attaching a minimal sketch.
Does anyone have any idea what the problem is & how to fix it?
Many thanks,
Dave
- import processing.core.*;
- import processing.pdf.PGraphicsPDF;
- float rotx;
- float roty;
- boolean record;
- PFont font;
- void setup() {
- size(400, 450, P3D);
- font = createFont("Arial", 100);
- rotx= -0.27460164f;
- roty = -2.2146025f;
- record = true; // print the first frame
- }
- void draw() {
- if (record) {
- System.out.println("Writing to PDF...\n");
- PGraphics pdf = beginRaw(PDF, "output.pdf");
- //pdf.hint(ENABLE_NATIVE_FONTS);
- //for(String s : PGraphicsPDF.listFonts()) System.out.println(s);
- //pdf.textMode(SHAPE);
- pdf.textFont(font);
- }
- background(255);
- translate(width/2.0f, height/2.0f, -100);
- rotateX(rotx);
- rotateY(roty);
- scale(2);
- pushStyle();
- // draw axes
- stroke(255,0,0);
- line(-100,0,0,100,0,0);
- stroke(0,255,0);
- line(0,-100,0,0,100,0);
- stroke(0,0,255);
- line(0,0,-100,0,0,100);
- popStyle();
- fill(0);
- translate(50,0,0);
- rotate(PI/2,0,1,0);
- String s = "Text";
- text(s,0,0,0);
- if (record) {
- endRaw();
- record = false;
- }
- }
- // Hit 'r' to record a single frame
- public void keyPressed() {
- if (key == 'r') {
- record = true;
- }
- }
1