public void text(String str,float x,float y){
  if (textFont == null) {
    defaultFontOrDeath("text");
  }
  int length=str.length();
  if (length > textBuffer.length) {
    textBuffer=new char[length + 10];
  }
  str.getChars(0,length,textBuffer,0);
  float high=0;
  for (int i=0; i < length; i++) {
    if (textBuffer[i] == '\n') {
      high+=textLeading;
    }
  }
  if (textAlignY == CENTER) {
    y+=(textAscent() - high) / 2;
  }
 else   if (textAlignY == TOP) {
    y+=textAscent();
  }
 else   if (textAlignY == BOTTOM) {
    y-=textDescent() + high;
  }
  int start=0;
  int index=0;
  while (index < length) {
    if (textBuffer[index] == '\n') {
      textLineAlignImpl(textBuffer,start,index,x,y);
      start=index + 1;
      y+=textLeading;
    }
    index++;
  }
  if (start < length) {
    textLineAlignImpl(textBuffer,start,index,x,y);
  }
}

public void text ( String str , float x , float y ) { if ( textFont == null ) { defaultFontOrDeath ( "text" ) ; } int length = str . length ( ) ; if ( length > textBuffer . length ) { textBuffer = new char [ length + 10 ] ; } str . getChars ( 0 , length , textBuffer , 0 ) ; float high = 0 ; for ( int i = 0 ; i < length ; i ++ ) { if ( textBuffer [ i ] == '\n' ) { high += textLeading ; } } if ( textAlignY == CENTER ) { y += ( textAscent ( ) - high ) / 2 ; } else if ( textAlignY == TOP ) { y += textAscent ( ) ; } else if ( textAlignY == BOTTOM ) { y -= textDescent ( ) + high ; } int start = 0 ; int index = 0 ; while ( index < length ) { if ( textBuffer [ index ] == '\n' ) { textLineAlignImpl ( textBuffer , start , index , x , y ) ; start = index + 1 ; y += textLeading ; } index ++ ; } if ( start < length ) { textLineAlignImpl ( textBuffer , start , index , x , y ) ; } }
draw a chunk of text . newlines that are \ n ( unix newline or linefeed char , ascii 10 ) are honored , but \ r ( carriage return , windows and mac os ) are ignored .
