Hi Michel

Sorry to chime in so late on this...

> On 25 Nov 2016, at 17:11, Michel Krämer <michel.krae...@googlemail.com> wrote:
> 
> I'm looking for a way to place an image at the top of the page, just like you 
> can do it in LaTeX:
> 
> ...
> <fo:float float="before">
>  ...
> </fo:float>
> 
> I understand that FOP does not support the "before" value yet.
> 
> Is there a workaround to achieve the same thing? For example by placing the 
> image absolutely or something like that?

Not really, I'm afraid. If the box is absolutely positioned then it will 
overlap with the other content... :(

> 
> I had a look at the code and it seems the feature is almost implemented but 
> not fully yet. There is a BeforeFloat class that is supposed to place blocks 
> in the before-float area, but even if I use <fo:float float="before"> this 
> class never receives any children. The float also disappears from the output 
> PDF.
> 
> If there is no workaround for my problem I would be very interested to 
> implement the solution myself. I'm a Java programmer and if anyone could give 
> me some pointers on where to start and what is missing in the current code 
> I'd probably be able to fill the gaps.
> 
> Let me know what you think. Thank you so much!

I cannot recall immediately to what extent the feature is implemented at this 
point, but since start-floats are already implemented, that means there is 
already a mapping for the fo:float element, so no need to worry about that. 

I do recall from past discussions that the "simplest" solution would be to 
treat before-floats very much in the same way as footnotes, only instead of the 
eventual layout element list being appended to the 'current' page, the list 
would be prepended.

So, that would be one important clue: try to focus on getting to understand 
which flow a footnote follows in the code, and you should have a template to 
work off of. Ideally, we want to make sure that code that can be shared, is 
also shared, so do not hesitate to introduce a common superclass for 
FootnoteLayoutManager and BeforeFloatLayoutManager, or something like that, if 
that can save some copy-pasting...

Eventually, for the line layout algorithm, it does not yet matter _where_ on 
the page the float will end up, only that it is out-of-line content that 
(basically) has no effect on the line breaks, it only needs to be anchored to a 
line box.
For the page breaking algorithm, same as footnotes, it does not matter _where_ 
on the page the float should end up, just how much space it will take up, if 
included.

Only in the last layout phase, when adding the areas to the tree, the paths of 
before-float and footnote diverge.

Hope the above info helps already. If you start nosing around, and/or have 
other questions or an idea that you want to bounce back, do subscribe to 
fop-dev, and follow up there.


Cheers

Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to