protected Rectangle2D createAlignBounds(){
  float[] info=getCharinfo();
  float al=0f;
  float at=-cm.ascent;
  float aw=0f;
  float ah=cm.ascent + cm.descent;
  if (charinfo == null || charinfo.length == 0) {
    return new Rectangle2D.Float(al,at,aw,ah);
  }
  boolean lineIsLTR=(source.getLayoutFlags() & 0x8) == 0;
  int rn=info.length - numvals;
  if (lineIsLTR) {
    while (rn > 0 && info[rn + visw] == 0) {
      rn-=numvals;
    }
  }
  if (rn >= 0) {
    int ln=0;
    while (ln < rn && ((info[ln + advx] == 0) || (!lineIsLTR && info[ln + visw] == 0))) {
      ln+=numvals;
    }
    al=Math.max(0f,info[ln + posx]);
    aw=info[rn + posx] + info[rn + advx] - al;
  }
  return new Rectangle2D.Float(al,at,aw,ah);
}

protected Rectangle2D createAlignBounds ( ) { float [ ] info = getCharinfo ( ) ; float al = 0f ; float at = - cm . ascent ; float aw = 0f ; float ah = cm . ascent + cm . descent ; if ( charinfo == null || charinfo . length == 0 ) { return new Rectangle2D . Float ( al , at , aw , ah ) ; } boolean lineIsLTR = ( source . getLayoutFlags ( ) & 0x8 ) == 0 ; int rn = info . length - numvals ; if ( lineIsLTR ) { while ( rn > 0 && info [ rn + visw ] == 0 ) { rn -= numvals ; } } if ( rn >= 0 ) { int ln = 0 ; while ( ln < rn && ( ( info [ ln + advx ] == 0 ) || ( ! lineIsLTR && info [ ln + visw ] == 0 ) ) ) { ln += numvals ; } al = Math . max ( 0f , info [ ln + posx ] ) ; aw = info [ rn + posx ] + info [ rn + advx ] - al ; } return new Rectangle2D . Float ( al , at , aw , ah ) ; }
like createlogicalbounds except ignore leading and logically trailing white space . this assumes logically trailing whitespace is also visually trailing . whitespace is anything that has a zero visual width , regardless of its advance . < p > we make the same simplifying assumptions as in createlogicalbounds , namely that we can rely on the charinfo to shield us from any glyph positioning oddities in the font that place the glyph for a character at other than the pos + advance of the character to its left . so we no longer need to skip chars with zero advance , as their bounds ( right and left ) are already correct .
