Jeremias- Yeah, I recall reading this wiki page back when I started looking into this. In my case, there aren't alternative contents -- I needed to adjust various properties of the contents -- namely the font-size and line-spacing.
In my system, custom attributes are added to the fo:block-container element that look something like: myrx:copyfit-strategy="min-opt-max" myrx:copyfit-ruleset="font(36,20,80,1) line(2.0,1.1,2.2,.1)" This would notify the copyfitter to first adjust the font, starting at 36pt and increment/decrement by 1pt until best fit. Then it will adjust the linespacing the same way. There can be as many rulesets as desired...so the refinement can continue, though at the cost of more iterations. In my initial version I hacked in my own layout listener that I could register to be notified of overflows in various layout manager classes. The actual adjustments take place outside of FOP. Back when I did this, I noticed the EventProducer interfaces in HEAD, however there were rendering issues with the code in HEAD at the time so I was unable to use it. Reviewing FOP 1.0, it looks like I should be able to use the EventBroadcaster to be notified of the overflow events I need...though I haven't worked out if I will have everything I need from the event. I was passing up the FObj in the event. I'll need to dig some more. Ideally I would be able to make the adjustments and perform another pass within the main render process instead of kicking off a new trial render each time there's at least one overflowing section. However, it's unclear to me how this could work, or even if it's practical/possible as, if I remember correctly, the attributes I'd need to modify are read only by this point in the process. If there's a way to make this work as part of the core renderer or as some kind of plugin to it, I'd be happy to see if I can get the budget and contribute the results. BTW: In reviewing the code, it looks like LineLayoutManager line #385, the event is only thrown if the log level is WARN. Bug? -Patrick -----Original Message----- From: Jeremias Maerki [mailto:d...@jeremias-maerki.ch] Sent: Thursday, October 28, 2010 1:44 AM To: firstname.lastname@example.org Subject: Re: Copyfitting and Flexible Layout We've written down some thoughts about the topic some time ago: http://wiki.apache.org/xmlgraphics-fop/WhitespaceManagement But there were no further actions on this. On 27.10.2010 20:11:29 Patrick Jaromin wrote: > Early last year I implemented copyfitting and flexible layouts into our > FOP-based rendering process by locally branching FOP 0.95, adding my > own listener/event mechanism and FO extensions, and a pre-processor that > implements the copyfitting strategies through an iterative process of > render-modify-render-... > > I'm hoping to upgrade to the FOP 1.0 codebase and rather than branching > and re-implementing my hacks, I'd prefer to extend the base in a more > maintainable way that perhaps others could also benefit from. > > Before I embark on this process (or even discuss it in more depth) I > figured I'd see if anyone else has made any movements on this or has > any thoughts. My system uses my own namespace/attributes, however I would > likely adopt the specifications outlined in XSL:FO 2.0 working draft > (http://www.w3.org/TR/xslfo20/#req_2_1_4). > > Thoughts/Comments? > > > Patrick K. Jaromin > VP Technology > 312.943.1600 * fax 312.640.8100 > > JGSullivan Interactive, Inc. > > Jeremias Maerki