We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Fonts in 3d for PDF export
Page Index Toggle Pages: 1
Fonts in 3d for PDF export (Read 724 times)
Fonts in 3d for PDF export
May 10th, 2006, 3:44pm
 
Hi,

I'm making a 3d graph with processing and want to add labels to the axes.  The whole graph is rotated to an isometric view for prettiness and when using P3D to screen, I can write the axis labels no problem.  

However if I try to write it out to PDF, the fonts just come out as big black blocks.  Any ideas?  Here's the relevant bit of code:

Code:

import processing.pdf.*;
PGraphics pdf;
PFont font;

void setup() {

size(1000, 1000, P3D);
font = createFont("TW Cen MT",32);
textFont(font);
pdf = createGraphics(PDF, "landscape.pdf");
}

void draw() {

beginRaw(pdf);
// translating and rotating and drawing stuff...
text("Test",xDist/3,yDist,0);
endRaw();
exit();}
}


Thanks for your help!
Re: Fonts in 3d for PDF export
Reply #1 - May 10th, 2006, 6:40pm
 
the only way to do it (this will improve later) is to use some undocumented features Smiley

1) you have to use the OPENGL renderer
2) use textMode(SHAPE);
3) use createFont() (which you already are)

this will convert all the shape data from the fonts for writing. it will be *extremely* slow, which is part of why it's not documented yet. but it will work with beginRaw().
Re: Fonts in 3d for PDF export
Reply #2 - May 11th, 2006, 11:05am
 
Brilliant!  Thanks fry.
Page Index Toggle Pages: 1