public float textWidth(String str){
  if (textFont == null) {
    defaultFontOrDeath("textWidth");
  }
  int length=str.length();
  if (length > textWidthBuffer.length) {
    textWidthBuffer=new char[length + 10];
  }
  str.getChars(0,length,textWidthBuffer,0);
  float wide=0;
  int index=0;
  int start=0;
  while (index < length) {
    if (textWidthBuffer[index] == '\n') {
      wide=Math.max(wide,textWidthImpl(textWidthBuffer,start,index));
      start=index + 1;
    }
    index++;
  }
  if (start < length) {
    wide=Math.max(wide,textWidthImpl(textWidthBuffer,start,index));
  }
  return wide;
}

public float textWidth ( String str ) { if ( textFont == null ) { defaultFontOrDeath ( "textWidth" ) ; } int length = str . length ( ) ; if ( length > textWidthBuffer . length ) { textWidthBuffer = new char [ length + 10 ] ; } str . getChars ( 0 , length , textWidthBuffer , 0 ) ; float wide = 0 ; int index = 0 ; int start = 0 ; while ( index < length ) { if ( textWidthBuffer [ index ] == '\n' ) { wide = Math . max ( wide , textWidthImpl ( textWidthBuffer , start , index ) ) ; start = index + 1 ; } index ++ ; } if ( start < length ) { wide = Math . max ( wide , textWidthImpl ( textWidthBuffer , start , index ) ) ; } return wide ; }
return the width of a line of text . if the text has multiple lines , this returns the length of the longest line .
