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 & HelpSyntax Questions › text(String, float, float, float, float) BUG!!!
Page Index Toggle Pages: 1
text(String, float, float, float, float) BUG!?!?! (Read 515 times)
text(String, float, float, float, float) BUG!?!?!
Aug 28th, 2008, 10:23am
 
Here is the bug scenario:

Quote:
String emptyString = " ", longString="is that a bug? Because it's really annoying";
PFont font;
boolean swicth;

void setup(){

  font= loadFont("SagarNormal-25.vlw");
  textFont(font);
  size(560, 560);

}

void draw(){

  background(230);
  fill(0);

  if(!swicth) text(longString, 100, 100, 200, 100);
  else text(emptyString, 100, 100, 200, 100);

}

void mouseReleased(){
  swicth = !swicth; 
}




LongString's second line appears when only displaying emptyString. That doesn't happen if only using text(String, float ,float).
Anyone came across that thing ?
Re: text(String, float, float, float, float) BUG!?
Reply #1 - Aug 28th, 2008, 2:04pm
 
It is probably a bug, so you should fill in a bug report in the Contribute section.

I think the issue is that with default vertical align (see textAlign()), text() processes the number of lines fitting in the rectangle, whatever the real number of lines in the string. We don't see this behavior with textAlign(LEFT, CENTER); for example.
And since Processing re-uses buffers between calls of text(), it also re-uses data from previous calls when handling excess lines.
Perhaps a simple reset of the buffers would fix this. Or use the line int lineCount = Math.min(textBreakCount, lineFitCount); in all align modes, but perhaps there is another issue I don't see.
Re: text(String, float, float, float, float) BUG!?
Reply #2 - Aug 28th, 2008, 3:04pm
 
PhiLho  wrote on Aug 28th, 2008, 2:04pm:
It is probably a bug, so you should fill in a bug report in the Contribute section.

Please don't ever file bugs there, always use dev.processing.org/bugs.
Re: text(String, float, float, float, float) BUG!?
Reply #3 - Aug 28th, 2008, 3:52pm
 
fry wrote on Aug 28th, 2008, 3:04pm:
Please don't ever file bugs there, always use dev.processing.org/bugs.


I already filled the bug data base this morning. I've put this bug in the "bug section" of the forum  yesterday thinking that if that wasn't a bug and I put it in the bug database that would pissed people off. ( but I did anyway )
It was delete anyway and after searching the forum and bugs database I decided that was a real one and added it to the list. I won't put anything in the bug section any more.

I just added before every textbox a textbox with lots and lots and lots of "spaces" to 'clear' the textBox. Don't know own to reset the textbuffer for a specific textbox, so that's my best trick so far.  

Re: text(String, float, float, float, float) BUG!?
Reply #4 - Aug 28th, 2008, 6:36pm
 
fry wrote on Aug 28th, 2008, 3:04pm:
Please don't ever file bugs there, always use dev.processing.org/bugs.

By "Contribute section", I really meant Contribute which is in the top link bar. That's where the Report Bugs paragraph is. I suppose I should have worded "Contribute page" instead...

TM, no need for "lot of spaces", just put some "\n\n\n" in emptySpace, and it should clear each line (one per \n).
Re: text(String, float, float, float, float) BUG!?
Reply #5 - Aug 28th, 2008, 10:40pm
 
Thanks for the tip, I try it tomorrow
Page Index Toggle Pages: 1