Footnotes

15 views
Skip to first unread message

Vijay Kaushik

unread,
Sep 29, 2014, 9:57:59 AM9/29/14
to flying-s...@googlegroups.com
To add the footnote support, I am trying the below approach. Please suggest issues/problems/improvements

1) first footnotes needs to identified while laying out to do that block was marked as float:footnote as defined by CSS specs.

2. Define area in PageBox as FootNote area similar to MarginBox and whenever any footnote is added in the this area, adjust the content height in PageBox Class
3) At layout time footnotes needs to be pushed into Footnote area  and create its own layer which can be used to print 

Doing this in 

3A)InlineBoxing#processOutOfFlowContent

3B) FloatManager#floatBox..something like below

    public void floatBox(LayoutContext c, Layer layer, BlockFormattingContext bfc, BlockBox box) {

        if (box.getStyle().isFloatedLeft()) {

            position(c, bfc, box, LEFT);

            save(box, layer, bfc, LEFT);

        } else if (box.getStyle().isFloatedRight()) {

            position(c, bfc, box, RIGHT);

            save(box, layer, bfc, RIGHT);

        }

        else if (box.getStyle().isFloatedFootnote()) {//added by VIjay

            c.getRootLayer().ensureHasPage(c, box);

            c.getRootLayer().getLastPage(c, box).addFootnote(box);

        }

4) the space required for footnotes(content+style), needs to be excluded for other content. 

                       IF PageBox height is adjusted then nothing is printed in that area. but it sometime splits the last line of page....unable to understand that.
5) In case, foot note can not be printed on same page then either the text with footnote marker needs to be shifted out to next page 

                    I need to find out where to do that
6) At print time, This layer needs to be printed separately.

                   A good reference point for this kind of separate implementation is MarginBox(nested class of pagebox) implementation but it is static area and footnote area needs to grow dynamically.


Can someone correct/ guide me further?

Reply all
Reply to author
Forward
0 new messages