Loop until the list of child layout managers is exhausted:
Get a child layout manager (AbstractLayoutManager.getChildLM). The current child layout manager is returned until it is finished. Then the layout manager for the next child is returned.
Record the last breakposs.
Record whether the breakposs we are going to find is the first breakposs of this line.
Record whether it is the first breakposs of this child layout manager.
Initialize the inline layout context (note that it is not a new layout context, the same inline layout context is used by all child layout managers) (method InlineStackingLayout.initChildLC):
Record whether this is a new area; it is a new area if this is the start of a new line or of a new child LM.
If this is the start of a new line
record whether this is the first area of this child LM,
set the leading space as passed by argument.
Else if this starts a new child LM
record that this is the first area,
set the leading space from the previous BP.
Else set the leading space to null.
Record on the inline layout context whether leading space is supppressed; it is suppressed if this is the start of a new line, but not the start of this child LM, and the previous line was not ended by a forced break.
Retrieve the next breakposs from the current child LM (getNextBreakPoss method of child LM). If it is not null:
Calculate the ipd up to the previous BP (method InlineStackingLayout.updatePrevIPD):
Take an empty ipd size.
If this starts a new line:
if it has a leading fence, add leading space (?),
list the ipd for the LM of this BP in the map of previous ipds.
Else
retrieve the ipd for the LM of this BP in the map of previous ipds,
if that is null (first BP of this child LM)
retrieve the ipd for the LM of the previous BP in the map of previous ipds,
add the leading space of this BP,
add the pending space-end (stacking size) of the previous BP,
list the ipd for the LM of this BP in the map of previous ipds.
Add to the ipd the pending space-end (stacking size) of this BP.
Record whether this BP could end the line:
if a break may occur after this BP, record true;
else if this BP is suppressible at a line break, return false;
else, return whether this is the last child LM and it is finished, or the next area could start a new line.
If this BP could end the line, add trailing space.
If this BP exceeds the line length (bpDim.min > availIPD.max),
if the text should be justified or if this is the first BP of this line,
if we are in a hyphenation try, break the loop; we have exhausted our options and one of the previous BPs should end the line (_exit of loop_);
if this BP could not end the line, add it to the list of inline breaks, and continue with the next iteration;
prepare to hyphenate: get the hyphenation context for the text between the last and this BP (method getHyphenContext):
add this BP to the list of inline breaks; even though this is not a good BP, we add it to the list, so that we can retrieve the text between the last and this BP;
iterate back to the previous BP in this list;
loop over the following BPs in this list:
retrieve the text between the preceding and this BP.
remove this BP again from the list of inline breaks.
create a hyphenation object for the retrieved text, taking the language, country and other hyphenation properties into account.
create a hyphenation context object from it, and return that.
store the hyphenation context with the inline layout context.
Record on the inline layout context that we are in a hyphenation try.
reset the child LMs to the previous BP or to the start of the line.
Else (if text should not be justified and if this is not the first BP of this line) break the loop; one of the previous BPs should end the line (_exit of loop_);
Else (if this BP does not exceed the line length):
add this BP to the list of inline breaks,
if this BP could end the line,
record it as the last confirmed BP: set prevBP to this BP.
if this BP is a forced line break, break the loop; this BP (or one of the previous BPs?) should end the line (_exit of loop_).
if this BP may fill the line length (bpDim.max >= availIPD.min), add it to the list of possible line endings, vecPossEnd, with a cost which is equal to the difference of the optimal values of the content length and the line length (Math.abs(availIPD.opt - bpDim.opt)).
If we are in a hypenation try, and the hyphenation context has no more hyphenation points, break the loop; this or one of the previous BPs should end the line (_exit of loop_).