CharacterInformation currentInfo;
currentInfo = getCharacterInformation(list, firstChar,charnum,aci);
CharacterInformation lastCharacterInRunInfo = null;
int chIndex = currentInfo.characterIndex+1;
GVTGlyphVector vector = currentInfo.layout.getGlyphVector();
float [] advs = currentInfo.layout.getGlyphAdvances();
boolean [] glyphTrack = new boolean[advs.length];
for( int k = charnum +1; k < charnum +nchars ; k++) {
if (currentInfo.layout.isOnATextPath() ){
for (int gi = currentInfo.glyphIndexStart;
gi <= currentInfo.glyphIndexEnd; gi++) {
if ((vector.isGlyphVisible(gi)) && !glyphTrack[gi])
length += advs[gi+1]-advs[gi];
glyphTrack[gi] = true;
}
CharacterInformation newInfo;
newInfo = getCharacterInformation(list, firstChar, k, aci);
if (newInfo.layout != currentInfo.layout) {
vector = newInfo.layout.getGlyphVector();
advs = newInfo.layout.getGlyphAdvances();
glyphTrack = new boolean[advs.length];
chIndex = currentInfo.characterIndex+1;
}
currentInfo = newInfo;
} else {
//reach the next run
if ( currentInfo.layout.hasCharacterIndex(chIndex) ){
chIndex++;
continue;
}
lastCharacterInRunInfo = getCharacterInformation
(list,firstChar,k-1,aci);
//if the text run change compute the distance between the
//first character of the run and the last
length += distanceFirstLastCharacterInRun
(currentInfo,lastCharacterInRunInfo);
currentInfo = getCharacterInformation(list,firstChar,k,aci);
chIndex = currentInfo.characterIndex+1;
vector = currentInfo.layout.getGlyphVector();
advs = currentInfo.layout.getGlyphAdvances();
glyphTrack = new boolean[advs.length];
lastCharacterInRunInfo = null;
}
}
if (currentInfo.layout.isOnATextPath() ){
for (int gi = currentInfo.glyphIndexStart;
gi <= currentInfo.glyphIndexEnd; gi++) {
if ((vector.isGlyphVisible(gi)) && !glyphTrack[gi])
length += advs[gi+1]-advs[gi];
glyphTrack[gi] = true;
}
} else {
if ( lastCharacterInRunInfo == null ){