while (lastIndex > 0 && foText.charAt(lastIndex - 1) == CharUtilities.SOFT_HYPHEN) {
lastIndex--;
}
final boolean endsWithHyphen = checkEndsWithHyphen
&& foText.charAt(lastIndex) == CharUtilities.SOFT_HYPHEN;
Font font = FontSelector.selectFontForCharactersInText(foText, thisStart, lastIndex, foText, this);
int wordLength = lastIndex - thisStart;
boolean kerning = font.hasKerning();
MinOptMax wordIPD = MinOptMax.ZERO;
for (int i = thisStart; i < lastIndex; i++) {
char currentChar = foText.charAt(i);
//character width
int charWidth = font.getCharWidth(currentChar);
wordIPD = wordIPD.plus(charWidth);
//kerning
if (kerning) {
int kern = 0;
if (i > thisStart) {
char previousChar = foText.charAt(i - 1);
kern = font.getKernValue(previousChar, currentChar);
} else if (prevAreaInfo != null && !prevAreaInfo.isSpace && prevAreaInfo.breakIndex > 0) {
char previousChar = foText.charAt(prevAreaInfo.breakIndex - 1);
kern = font.getKernValue(previousChar, currentChar);
}
if (kern != 0) {
addToLetterAdjust(i, kern);
wordIPD = wordIPD.plus(kern);
}
}
}
if (kerning
&& breakOpportunity
&& !TextLayoutManager.isSpace(ch)
&& lastIndex > 0
&& endsWithHyphen) {
final int kern = font.getKernValue(foText.charAt(lastIndex - 1), ch);
if (kern != 0) {
addToLetterAdjust(lastIndex, kern);
//TODO: add kern to wordIPD?
}
}