public static float measureText(final IFont pFont,final CharSequence pText,final int pStart,final int pEnd,final float[] pWidths){
  final int textLength=pEnd - pStart;
  if (pStart == pEnd) {
    return 0;
  }
 else   if (textLength == 1) {
    return pFont.getLetter(pText.charAt(pStart)).mWidth;
  }
  Letter previousLetter=null;
  float width=0;
  for (int pos=pStart, i=0; pos < pEnd; pos++, i++) {
    final Letter letter=pFont.getLetter(pText.charAt(pos));
    if (previousLetter != null) {
      width+=previousLetter.getKerning(letter.mCharacter);
    }
    previousLetter=letter;
    if (pos == (pEnd - 1)) {
      width+=letter.mOffsetX + letter.mWidth;
    }
 else {
      width+=letter.mAdvance;
    }
    if (pWidths != null) {
      pWidths[i]=width;
    }
  }
  return width;
}

public static float measureText ( final IFont pFont , final CharSequence pText , final int pStart , final int pEnd , final float [ ] pWidths ) { final int textLength = pEnd - pStart ; if ( pStart == pEnd ) { return 0 ; } else if ( textLength == 1 ) { return pFont . getLetter ( pText . charAt ( pStart ) ) . mWidth ; } Letter previousLetter = null ; float width = 0 ; for ( int pos = pStart , i = 0 ; pos < pEnd ; pos ++ , i ++ ) { final Letter letter = pFont . getLetter ( pText . charAt ( pos ) ) ; if ( previousLetter != null ) { width += previousLetter . getKerning ( letter . mCharacter ) ; } previousLetter = letter ; if ( pos == ( pEnd - 1 ) ) { width += letter . mOffsetX + letter . mWidth ; } else { width += letter . mAdvance ; } if ( pWidths != null ) { pWidths [ i ] = width ; } } return width ; }
does not respect linebreaks !
