There are five exit points of the main loop:
If the last BP has exceeded the line length, it is not in the list of inline breaks, and prevBP points to the last good break; otherwise it is in the list of inline breaks, and prevBP points to it.
If we are through the list of child LMs, mark this LM as finished.
If no BP was produced, return null. (This should concur with being finished?)
If prevBP is null, there is not last good break; set it to this BP, even though it fails some criteria:
it has exceeded the line length in the hyphenation try or we cannot get a hyphenation context,
or it cannot end the line but it is the last BP of the last child layout manager.
If this BP is not a forced break, and there are several possible line breaks, select the best one; make prevBP point to it. (Could this produce the wrong result if the BP has exceeded the line length and at the same time is a forced line break? Should prevBP be tested for being a forced break instead?)
If the last BP is not the actual breakpoint prevBP (bp != prevBP) and the material after prevBP is not suppressible at the end of a line, back up to prevBP for a proper start of the next line.
If the text should be justified and the breakpoint is a forced line break (here prevBP is tested) or this is the last line of the layout manager, set text alignment to left-aligned.
Make a line break and return the associated breakposs.