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.
Page Index Toggle Pages: 1
PGraphics text (Read 649 times)
PGraphics text
Nov 10th, 2006, 6:39pm
 
hi all,

i'm having a problem using text with a pgraphics object. it displays rectangles instead of the letters.

am i missing something here?

i am using processing 121 with jikes 1.22 on a fedora core 6 linux machine.

thanks in advance.

Quote:
PFont font;
PGraphics p0;

void setup()
{
 size(100, 100, P3D);
 font = loadFont("LucidaSans-Demi-48.vlw");
 textFont(font, 48);
 
 p0 = createGraphics(width, height, P3D);

 p0.beginDraw();
 p0.background(255);
 p0.fill(0);
 p0.textFont(font, 48);
 p0.text("xyz", 10, 48);
 p0.endDraw();
}

void draw()
{
 image(p0, 0, 0);
}
Re: PGraphics text
Reply #1 - Nov 10th, 2006, 6:56pm
 
what happens when you draw the text to the screen instead of the PGraphics?
Re: PGraphics text
Reply #2 - Nov 10th, 2006, 7:03pm
 
it works fine. the text is printed to the screen.
Re: PGraphics text
Reply #3 - Nov 10th, 2006, 8:15pm
 
k, then that's this recently discovered bug:
http://dev.processing.org/bugs/show_bug.cgi?id=428
thanks for the report, i'll be looking into this soon.
Re: PGraphics text
Reply #4 - Nov 10th, 2006, 8:45pm
 
i'm not sure if it helps, but i found that the words example introduces the same problem if i change the size(200, 200) command to size(200, 200, P2D).

this gave me the idea to try the workaround textMode(SCREEN), which seems to work.

the pgraphics drawing commands are changed like this:

Quote:

 p0.beginDraw();
 p0.textFont(font, 48);
 p0.textMode(SCREEN);
 p0.background(255);
 p0.fill(0);
 p0.text("xyz", 10, 48);
 p0.endDraw();


and the text is displayed fine.
Re: PGraphics text
Reply #5 - Nov 11th, 2006, 5:50pm
 
yeah, thanks.. it's just because they're handled by very different methods.. the bug is just growing pains from the new createGraphics() stuff, because a previous requirement was that all drawing surfaces were opaque.
Page Index Toggle Pages: 1