*/
public LbContent next() {
if (! hasNext()) {
throw new NoSuchElementException("No more elements in " + this.getClass().getName());
}
final LineContent lineContent = this.lineContentList.get(this.lineContentIndex);
if (lineContent instanceof LineNonText) {
final LineNonText lineNonText = (LineNonText) lineContent;
final int optimum = lineNonText.inlineSizeOptimum(1);
final int minimum = lineNonText.inlineSizeMinimum(1);
final int maximum = lineNonText.inlineSizeMaximum(1);
this.lineContentIndex ++;
return new LbGlue4a(optimum, maximum - optimum, optimum - minimum);
}
if (lineContent instanceof LineText) {
final LineText lineText = (LineText) lineContent;
final int codePoint = lineText.inlineText().charAt(this.currentLineTextItemIndex);
final int width = lineText.inlinePrimaryFont().getFont().width(codePoint, lineText.inlineFontSize());
this.currentLineTextItemIndex ++;
if (this.currentLineTextItemIndex >= lineText.inlineText().length()) {
this.currentLineTextItemIndex = -1;
this.lineContentIndex ++;
}
return new LbBox4a(width);
}
throw new IllegalStateException("Unknown LineContent item: " + lineContent.getClass().getName());
}