I have implemented a basic page layout algorithm for footnote placement. Basically:
At every step, I check to see if the total height (body text + footnote text + gap) exceeds page height. If it does, I remove the most recently laid out line and the page is complete.
My question is: How do I deal with a situation where the body text is in two columns?
I would essentially need to know the total allowed body text height in advance in order to properly lay out the columns, but that cannot be known until I know the height of the footnote text.
I also can't just take the accumulated height of body text lines and divide by 2, due to varying line heights, line spacing, paragraph spacing, etc.
You have 3 blocks – two for the columns and one for footnotes. Obviously (height of the column + height of the footnotes + gap) has to be lower than page height.
You can use your old algorithm for the first column. For the second column, when you add a footnote and it causes the first column to be too long, move lines from the end of the first column to the beginning of the second. If this makes the second column too long, move the line(s) back to the first column and remove the last footnote line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With