prevBP = getBestBP(vecPossEnd);
}
// Backup child LM if necessary
- if (bp != prevBP && !prevBP.couldEndLine()) {
+ if (bp != prevBP && !prevCouldEndLine(prevBP)) {
reset();
}
return true;
}
+ /** Test whether all breakposs in vecInlineBreaks
+ back to and including prev could end line */
+ private boolean prevCouldEndLine(BreakPoss prev) {
+ ListIterator bpIter =
+ vecInlineBreaks.listIterator(vecInlineBreaks.size());
+ boolean couldEndLine = true;
+ while (bpIter.hasPrevious()) {
+ BreakPoss bp = (BreakPoss) bpIter.previous();
+ couldEndLine = bp.couldEndLine();
+ if (!couldEndLine || bp == prev) break;
+ }
+ return couldEndLine;
+ }
+
private HyphContext getHyphenContext(BreakPoss prev,
BreakPoss newBP) {
// Get a "word" to hyphenate by getting characters from all