I have implemented a basic page layout algorithm for footnote placement. Basically:
- Layout a line of body text.
- If it contains footnote references, lay out footnotes line by line.
- Go to 1.
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.