private void initAll(AttributedCharacterIterator text){
  fStart=text.getBeginIndex();
  fChars=new char[text.getEndIndex() - fStart];
  int n=0;
  for (char c=text.first(); c != CharacterIterator.DONE; c=text.next()) {
    fChars[n++]=c;
  }
  text.first();
  fBidi=new Bidi(text);
  if (fBidi.isLeftToRight()) {
    fBidi=null;
  }
  text.first();
  Map<? extends Attribute,?> paragraphAttrs=text.getAttributes();
  NumericShaper shaper=AttributeValues.getNumericShaping(paragraphAttrs);
  if (shaper != null) {
    shaper.shape(fChars,0,fChars.length);
  }
  fParagraph=new StyledParagraph(text,fChars);
{
    fJustifyRatio=AttributeValues.getJustification(paragraphAttrs);
    boolean haveFont=TextLine.advanceToFirstFont(text);
    if (haveFont) {
      Font defaultFont=TextLine.getFontAtCurrentPos(text);
      int charsStart=text.getIndex() - text.getBeginIndex();
      LineMetrics lm=defaultFont.getLineMetrics(fChars,charsStart,charsStart + 1,fFrc);
      fBaseline=(byte)lm.getBaselineIndex();
      fBaselineOffsets=lm.getBaselineOffsets();
    }
 else {
      GraphicAttribute graphic=(GraphicAttribute)paragraphAttrs.get(TextAttribute.CHAR_REPLACEMENT);
      fBaseline=TextLayout.getBaselineFromGraphic(graphic);
      Hashtable<Attribute,?> fmap=new Hashtable<>(5,(float)0.9);
      Font dummyFont=new Font(fmap);
      LineMetrics lm=dummyFont.getLineMetrics(" ",0,1,fFrc);
      fBaselineOffsets=lm.getBaselineOffsets();
    }
    fBaselineOffsets=TextLine.getNormalizedOffsets(fBaselineOffsets,fBaseline);
  }
  invalidateComponents();
}

private void initAll ( AttributedCharacterIterator text ) { fStart = text . getBeginIndex ( ) ; fChars = new char [ text . getEndIndex ( ) - fStart ] ; int n = 0 ; for ( char c = text . first ( ) ; c != CharacterIterator . DONE ; c = text . next ( ) ) { fChars [ n ++ ] = c ; } text . first ( ) ; fBidi = new Bidi ( text ) ; if ( fBidi . isLeftToRight ( ) ) { fBidi = null ; } text . first ( ) ; Map < ? extends Attribute , ? > paragraphAttrs = text . getAttributes ( ) ; NumericShaper shaper = AttributeValues . getNumericShaping ( paragraphAttrs ) ; if ( shaper != null ) { shaper . shape ( fChars , 0 , fChars . length ) ; } fParagraph = new StyledParagraph ( text , fChars ) ; { fJustifyRatio = AttributeValues . getJustification ( paragraphAttrs ) ; boolean haveFont = TextLine . advanceToFirstFont ( text ) ; if ( haveFont ) { Font defaultFont = TextLine . getFontAtCurrentPos ( text ) ; int charsStart = text . getIndex ( ) - text . getBeginIndex ( ) ; LineMetrics lm = defaultFont . getLineMetrics ( fChars , charsStart , charsStart + 1 , fFrc ) ; fBaseline = ( byte ) lm . getBaselineIndex ( ) ; fBaselineOffsets = lm . getBaselineOffsets ( ) ; } else { GraphicAttribute graphic = ( GraphicAttribute ) paragraphAttrs . get ( TextAttribute . CHAR_REPLACEMENT ) ; fBaseline = TextLayout . getBaselineFromGraphic ( graphic ) ; Hashtable < Attribute , ? > fmap = new Hashtable < > ( 5 , ( float ) 0.9 ) ; Font dummyFont = new Font ( fmap ) ; LineMetrics lm = dummyFont . getLineMetrics ( " " , 0 , 1 , fFrc ) ; fBaselineOffsets = lm . getBaselineOffsets ( ) ; } fBaselineOffsets = TextLine . getNormalizedOffsets ( fBaselineOffsets , fBaseline ) ; } invalidateComponents ( ) ; }
initialize state , including fchars array , direction , and fbidi .
