7. Line LayoutManager, a sequence of breakposs

The text is: "waterstaatsingenieur ministersportefeuille aandachtstrekker. Vernederlandste vakliteratuur" etc. It consists of a few long Dutch words, which can be found in the hyphenation exceptions in nl.xml. The column width is 8cm. This text and width have been chosen so that they force many hyphenations.

This text is contained in a single FOText node, and is dealt with by a single Text LayoutManager, which is a child layout manager for the Line LayoutManager. The Text LayoutManager maintains a list of area information objects, vecAreaInfo, and the Line LayoutManager maintains a list of breakposs, vecInlineBreaks. Each breakposs refers to an area, in its position.iLeafPos member.

During the process of finding suitable line breaks, breakposs are generated until one is found that exceeds the line length. Then the Line LayoutManager backs up to the previous BP, either to start a hyphenation try or to create the line break. When it creates a line break, the last breakposs, which exceeds the line length, is not added to the list of inline breaks. When it starts a hyphenation try, the breakposs is added to that list, and removed again after the text for hyphenation has been obtained. Each time, the corresponding area info is left in the list of area information objects. As a consequence the list vecAreaInfo is longer than the list vecInlineBreaks, and some areas have no corresponding breakposs.

wa-ter-staats-in-ge-nieur mi-nis-ters-por-te-feuil-le aandachtstrekker.
0  2   5      1  1  1    2   2   2  2 3   3  3     4 4                 6
              1  3  5    0   3   6  9 0   3  5     0 2                 0

text:         waterstaatsingenieur  wa      ter     staats   in       |
AreaInfo:     0: 0-20 (removed)     0: 0-2  1: 2-5  2: 5-11  3: 11-13 |
InlineBreaks: 0 (removed)           0       1       2        3        |
              too long, hyphenate,                                    |
              back up                                                 V

gen       genieur   _ministersportefeuille _mi      nis       |
4: 13-15  5: 13-20  6: 20-42               7: 20-23 8: 23-26  |
          4         5 (removed)            5        6         |
too long,           too long, hyphenate                       |
line break,         back up                                   |
back up                                                       v

ters        tersportefeuille_   ter        s          por
9: 26-30    10: 26-42           11: 26-29  12: 29-30  13: 30-33
            7 (removed)         7          8          9
too long,   too long, hyphenate,           hyphenation
line break, back up                        error
back up

te         feuil             |  le         |  _aandachtstrekker.
14: 33-35  15: 35-40         |  16: 40-42  |  17: 42-60
10         11                |  12         |  13 (removed)
           last hyphenpoint, |             |  too long,
           line break        v             |  hyphenation fails,
                                           |  line break,
                                           v  back up

aandachtstrekker.   |  etc.
18: 43-60           |
13                  |
too long,           |
hyphenation fails,  |
first BP,           |
line break          v

A few remarkable points:

  1. The first AreaInfo object is removed from the list during backing up. This is because the previous BP, which is null, does not belong to this child layout manager, and therefore the whole child LM is reset.
  2. The last BP, no. 18, exceeds the line length, but because it is the first BP of this line, it is accepted for the line break.
  3. BP 7 at position 29 falls at a point that is not a good hyphenation point. This is probably caused by the fact that for this line only the partial word is subjected to hyphenation. On the previous line the complete word was subjected to hyphenation, and there was no BP at position 29.
  4. For the word "aandachtstrekker." hyphenation fails (hyph == null is returned). This may be due to the period not being separated from the word. When the period is removed, the word is properly broken.