Bug 727 : Unicode characters not rendered to PDF with beginRecord()
Last modified: 2008-11-24 12:41




Status:
ASSIGNED
Resolution:
-
Priority:
P4
Severity:
normal

 

Reporter:
JiantaoShi
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2008-02-16 05:18
the pdf library can not render unicode characters, for example, greek letters.
Code tested:

import processing.pdf.*;
size(600,800);
background(255);
beginRecord(PDF,"test.pdf");
PFont arial = createFont("Arial",48);
textFont(arial);
textSize(10);
fill(0);
text("\u03B1",50,50);
text("\u0391",50,70);
endRecord();

i can see the letters in the screen, but get an empty PDF file.
processing version:0135beta.
Additional Comment #1 From fry 2008-02-16 09:02
*** Bug 728 has been marked as a duplicate of this bug. ***
Additional Comment #2 From fry 2008-02-16 09:03
huh, that's interesting. i'm stumped actually, i could have sworn that i've
had unicode characters working just fine for me with the pdf library. we
may need an updated version of itext.
Additional Comment #3 From fry 2008-06-14 09:48
Looking into this today... It appears that the problem only occurs when
beginRecord() is in use. If you use PDF as the renderer, it writes the
characters just fine.

import processing.pdf.*;
size(800, 600, PDF, "test.pdf");
textMode(SHAPE);
background(255);
PFont arial = createFont("Arial", 48);
textFont(arial);
textSize(10);
fill(0);
text("testing?",100,50);
text("\u03B1",50,50);
text("\u0391",50,70);
line(20, 20, 80, 80);
exit();

Also, if you use textMode(SHAPE), it also works fine with beginRecord().
PGraphics p = beginRecord(PDF, "test.pdf");
p.textMode(SHAPE);
// the rest of the program
Additional Comment #4 From fry 2008-06-14 12:47
oops, that last comment was not quite correct; size(..., PDF) does not
work, only textMode(SHAPE) gets around the problem. (the first example
still had textMode(SHAPE) listed in it).

the problem here appears to be that the pdf library is not setting the font
correctly when createFont() is in use. (which makes it a higher priority
bug after all.)
This bug is now being tracked here.