if (aci.current() != CharacterIterator.DONE) {
int chunkStartIndex = aci.getIndex();
// find out if this chunck is the start or end of a text path chunck
// if it is, then we ignore any previous advance
TextPath chunkTextPath = (TextPath) aci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);
TextPath prevChunkTextPath = null;
if (chunkStartIndex > 0) {
aci.setIndex(chunkStartIndex-1);
prevChunkTextPath = (TextPath) aci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);
aci.setIndex(chunkStartIndex);
}
if (prevChunkTextPath != chunkTextPath) {
advance = new Point2D.Float(0,0);
}
boolean isChunkStart = true;
TextPath prevTextPath = null;
Point2D prevTextPathAdvance = null;
do {
int start = aci.getRunStart(extendedAtts);
int end = aci.getRunLimit(extendedAtts);
runaci =
new AttributedCharacterSpanIterator(aci, start, end);
runaci.first();
Float runX = (Float) runaci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.X);
Float runY = (Float) runaci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.Y);
TextPath textPath = (TextPath) runaci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);
inChunk = (isChunkStart)
|| ((runX == null || runX.isNaN())
&&(runY == null || runY.isNaN()));