Now transparency is being preserved but the resolution is unacceptable. Again it is showing as 72ppi and this time it looks it...
On the PDF Export library page it says
Images don't look great, mostly because of the difference of expectations in how a PDF should look (scalable and high res) versus what happens when image data is written to it at 72 dpi.
And yet in the first example above, image data was written at 180ppi. I don't know why 72ppi would be the default. It is ridiculously low even for a small-screen monitor. But for a PDF which will likely be printed, 300-1200 ppi is the norm. Why isn't this adjustable? Is there a hack that can make it adjustable?
The PDF version of the exported files is 1.4 (Acrobat 5.x), which supports an alpha channel. I even made a PDF of the same version with the original image and the background was transparent. This also should be programmable. Is there a hack for this?
So I don't know where to go from here. It's either horrible resolution or no transparencies. I can't proceed with either situation. Does anyone know a work-around that will give me high resolution AND transparency at the same time. I still need scalable vector graphics as well for text and graphics objects so a high-res image is not an option.
I have tried literally dozens of plotting, drawing, image processing, and page layout programs, including freeware and expensive commercial software, to do what I consider a moronically simple task. None of them do, in a simple manner, what I want to do. All I want to do is to create a circular layout with text on a circular path, some lines, and some images positioned at various points around the circle. Processing is by far the most feature-rich, simplest to script program I have found. While I'm sure I can create exactly what I want with it, the huge stumbling block is the PDF export library. I have tried for hours to get the exported PDF to contain the font that I specified in the script. No matter what font I try, I keep getting no fonts at all. The PDF displays text with some generic default font:
Here is the script:
// The message to be displayed
String message = "text along a curve";
PFont f;
// The radius of a circle
float r = 100;
import processing.pdf.*;
void setup() {
size(400, 400);
String[] fontList = PFont.list();
println(fontList);
f = createFont("Georgia",40,true);
textFont(f);
// The text must be centered!
textAlign(CENTER);
smooth();
noLoop();
beginRecord(PDF, "text_along_a_curve.pdf");
}
void draw() {
background(255);
// Start in the center and draw the circle
translate(width / 2, height / 2);
noFill();
stroke(0);
ellipse(0, 0, r*2, r*2);
// We must keep track of our position along the curve
float arclength = 0;
// For every box
for (int i = 0; i < message.length(); i++)
{
// Instead of a constant width, we check the width of each character.
char currentChar = message.charAt(i);
float w = textWidth(currentChar);
// Each box is centered so we move half the width
arclength += w/2;
// Angle in radians is the arclength divided by the radius
// Starting on the left side of the circle by adding PI
float theta = PI + arclength / r;
pushMatrix();
// Polar to cartesian coordinate conversion
translate(r*cos(theta), r*sin(theta));
// Rotate the box
rotate(theta+PI/2); // rotation is offset by 90 degrees
// Display the character
fill(0);
text(currentChar,0,0);
popMatrix();
// Move halfway again
arclength += w/2;
}
endRecord();
}
I have read and reread the
PDF Export page and found it not that helpful and outdated. I tried using
textMode(SHAPE) as advised there and it threw an exception. There is talk about adding a
.ttf file to the data directory. What data directory? "I don't see no data directory." So I am at wits' end about how to do this. I'm tired of "riddles in the dark." Being able to control the font in the output PDF is mandatory. Without this ability, the program is all but useless to me. So how do I go about doing this?