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
Geomerative (Read 1008 times)
Geomerative
Jun 17th, 2009, 3:55am
 
Hi there,

when using Geomerative Library // RFont

i am wittnessing a strange rectangle-shape popping up when hitting "Enter/Return".
it does not happen when using PFont though...

any ideas?
something TrueType specific?
how to avoid?


thanks for your help!

+

this is an example-file; just hint enter/return und you will see...

+++++++++++++++

import geomerative.*;
import org.apache.batik.svggen.font.table.*;
import org.apache.batik.svggen.font.*;

//// RFont object
RFont font;

String input = "";

void setup(){
   size(600,300);
 
   smooth();      

   background(255);
 
   RG.init( this );

   stroke(0);
   strokeWeight(1);

   // RFont object related
   font = new RFont( "arial.ttf", 30, RFont.LEFT);
 
 
}

void draw(){
   background(255);
   translate(30, 100);    
 
   font.draw(input, g);
}


void keyPressed (){
   if (  keyCode == DELETE || keyCode == BACKSPACE )
   {
       if ( input.length() > 0 )
           input = input.substring(0,input.length()-1);  
   }
   else if ( key != CODED ) {
       input = input + key;  
   }
}
Re: Geomerative
Reply #1 - Jun 17th, 2009, 6:19am
 
I suppose the rectangle shape is the glyph for the Enter code.
You can avoid it by processing ENTER like you do for DELETE and BACKSPACE: ignore it (discard it) or process it.
Re: Geomerative
Reply #2 - Jun 17th, 2009, 8:24am
 
it works when i "avoid" it...

like adding:

else if ( key != CODED && keyCode != RETURN &&  keyCode != ENTER) {
      input = input + key;  
  }

+++

i was just wondering why the glyph behavior is different using PFont?

anyway. thanks for your help!
Page Index Toggle Pages: 1