Re: keep-together question

Andreas Delmelle <[email protected]>
Newsgroups gmane.text.xml.fop.user
Message-ID <[email protected]>
Hi Matthew

While I can't speak to the integer-keep support, from what I can make out here, it does seem like you would be greatly helped by decent orphans/widows support.

Assuming that you know that at most N lines will fit together on a page, you could specify orphans="N" on the parent block, which will have exactly the effect I think you are seeking. That is: if a paragraph/block ends, and there is no more room for N lines, the next paragraph would automatically start on a new page, but would still allow breaking after the Nth line (in other words: it acts like a keep-together on the first N lines in a block). You could play with slightly lower values to avoid leaving too much empty space on a page, or combine with a widows="..." setting for paragraphs that you know will take up multiple pages. It would still require a couple of tries to arrive at the nicest looking result, but at least, it is a bit less black-and-white than a forced keep-together of the entire block.

First, the bad news: FOP 2.1 (and trunk) still does not support that.

The good news: there is a patch available in JIRA (look for FOP-1488), which I worked on quite some time back, and which I believe one of our committers --Matthias-- is already using. It will take a quick stroll, probably, to make sure it can easily be applied to trunk. I synched it up last year, and as I recall, not a lot has changed since then to those areas in the code, so I'll see if I can at least update that shortly. I really should work on committing it to trunk anyway, so we can finally close that and at least get it in for a next release.

Just one question left: Are you fluent enough in Subversion, Ant etc. to check out the trunk, apply the patch and build FOP, or would you require a binary package to try it out? I guess I could always (temporarily) attach one in JIRA for you to download, or deliver it some other way, if that helps.

Let me know.


Andreas

> On 25 Feb 2016, at 19:12, Matthew R. Wilson <[email protected]> wrote:
> 
> On Thu, Feb 25, 2016 at 09:41:20AM +0100, Pascal Sancho wrote:
>> That can be achieved using an integer value rather than 'always'.
>> See [1] (compliance page) & [2] (XSL-FO rec v1.1) for further info.
>> 
>> NOTE: keep-together should be considered as a shorthand for
>> *.within-line, *.within-column, and *.within-page
> 
> I've tried using an integer value, but that doesn't seem to do anything.
> For example, changing my original example attachment to the following
> snippet
> 
>  <fo:block keep-together.within-page="100">
>    <fo:block>line 1</fo:block>
>    <fo:block>line 2</fo:block>
>    <!-- ... more ... -->
>    <fo:block>line n</fo:block>
>  </fo:block>
> 
> does not do what I expect. Even though this block can fit on a page, I
> don't end up with a page break before it and it just breaks in the
> middle. The same block with keep-together.within-page="always" results
> in the expected page break before the block. I've removed all other
> keeps in the document so there shouldn't be anything conflicting with
> the attempt to make this block appear on its own page.
> 
> The FOP compliance page says that there is "Minimal support for
> <integer> values", but I don't see anything explaining further. So I'm
> back to not knowing if I'm just not doing it right (i.e. is there
> something more to it than changing "always" to "100"), or am I hitting a
> scenario that isn't supported by the minimal support.
> 
> Thanks,
> Matthew
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.