StandardTextSource(char[] chars,int start,int len,int cstart,int clen,int level,int flags,Font font,FontRenderContext frc,CoreMetrics cm){
  if (chars == null) {
    throw new IllegalArgumentException("bad chars: null");
  }
  if (cstart < 0) {
    throw new IllegalArgumentException("bad cstart: " + cstart);
  }
  if (start < cstart) {
    throw new IllegalArgumentException("bad start: " + start + " for cstart: "+ cstart);
  }
  if (clen < 0) {
    throw new IllegalArgumentException("bad clen: " + clen);
  }
  if (cstart + clen > chars.length) {
    throw new IllegalArgumentException("bad clen: " + clen + " cstart: "+ cstart+ " for array len: "+ chars.length);
  }
  if (len < 0) {
    throw new IllegalArgumentException("bad len: " + len);
  }
  if ((start + len) > (cstart + clen)) {
    throw new IllegalArgumentException("bad len: " + len + " start: "+ start+ " for cstart: "+ cstart+ " clen: "+ clen);
  }
  if (font == null) {
    throw new IllegalArgumentException("bad font: null");
  }
  if (frc == null) {
    throw new IllegalArgumentException("bad frc: null");
  }
  this.chars=chars;
  this.start=start;
  this.len=len;
  this.cstart=cstart;
  this.clen=clen;
  this.level=level;
  this.flags=flags;
  this.font=font;
  this.frc=frc;
  if (cm != null) {
    this.cm=cm;
  }
 else {
    LineMetrics metrics=font.getLineMetrics(chars,cstart,clen,frc);
    this.cm=((FontLineMetrics)metrics).cm;
  }
}

StandardTextSource ( char [ ] chars , int start , int len , int cstart , int clen , int level , int flags , Font font , FontRenderContext frc , CoreMetrics cm ) { if ( chars == null ) { throw new IllegalArgumentException ( "bad chars: null" ) ; } if ( cstart < 0 ) { throw new IllegalArgumentException ( "bad cstart: " + cstart ) ; } if ( start < cstart ) { throw new IllegalArgumentException ( "bad start: " + start + " for cstart: " + cstart ) ; } if ( clen < 0 ) { throw new IllegalArgumentException ( "bad clen: " + clen ) ; } if ( cstart + clen > chars . length ) { throw new IllegalArgumentException ( "bad clen: " + clen + " cstart: " + cstart + " for array len: " + chars . length ) ; } if ( len < 0 ) { throw new IllegalArgumentException ( "bad len: " + len ) ; } if ( ( start + len ) > ( cstart + clen ) ) { throw new IllegalArgumentException ( "bad len: " + len + " start: " + start + " for cstart: " + cstart + " clen: " + clen ) ; } if ( font == null ) { throw new IllegalArgumentException ( "bad font: null" ) ; } if ( frc == null ) { throw new IllegalArgumentException ( "bad frc: null" ) ; } this . chars = chars ; this . start = start ; this . len = len ; this . cstart = cstart ; this . clen = clen ; this . level = level ; this . flags = flags ; this . font = font ; this . frc = frc ; if ( cm != null ) { this . cm = cm ; } else { LineMetrics metrics = font . getLineMetrics ( chars , cstart , clen , frc ) ; this . cm = ( ( FontLineMetrics ) metrics ) . cm ; } }
create a simple implementation of a textsource . chars is an array containing clen chars in the context , in logical order , contiguously starting at cstart . start and len represent that portion of the context representing the true source ; start , like cstart , is relative to the start of the character array . level is the bidi level ( 0 - 63 for the entire context . flags is the layout flags . font is the font , frc is the render context , and lm is the line metrics for the entire source text , but not necessarily the context .
