xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Delmelle <andreas.delme...@telenet.be>
Subject Re: FOP hyphenate-ladder-count and pre-hyphenated text
Date Thu, 07 May 2015 19:00:54 GMT
Hi Marc

> On 06 May 2015, at 13:40, Marc Wiest <Marc.Wiest@getAbstract.com> wrote:
> 
> I have the requirements of
> 1. allow adding hyphenation exceptions at runtime (web container)
> 2. don't hyphenate more than two successive lines in a paragraph
> 
> For 1. the only solution I found is to use a third-party library to add the actual soft-hyphens
in the text, instead.
> This has other benefits for me, including that I can use hyphenation in other places
than PDF generation, so I prefer this separation.
> But if anyone knows a way to add exceptions for words at runtime, I would be highly interested
how to do that.
> 
> Since I solved 1. Using a new library for adding soft-hyphens into the text, 2. doesn't
work anymore. My XSL contains hyphenation-ladder-count="2" attributes on all relevant blocks,
which does the trick when passing text without soft-hyphens and relying on FOP hyphenation
entirely. But it does nothing if I don't use FOP to hyphenate the words. In general, hyphenation
works, though, like the soft-hyphens in the text are taken into account. But it happens that
6 or more successive lines are hyphenated, which is deemed bad style.

The effect you see in FOP is just very basic Unicode line breaking at work. 
An explicit SHY is obviously a legal breaking point, but is not recognised as a true hyphenation
point by FOP. 
Internally, what FOP tries to hyphenate are only the word fragments in between the spaces
and SHYs, but those cannot be broken up further themselves. As strange as it sounds, a SHY
is treated as a word boundary here, similar to a zero-width space.
The SHY is recognised as a special character, however, that only needs to be taken into account
and rendered in case the effective line-break occurs at that point, but that is as far as
it goes, currently.

Not sure how difficult it would be to make FOP recognise that the text in a paragraph has
already been hyphenated and then register the SHY as a precomputed hyphenation point. If that
can be done, then hyphenation-ladder-count would 'automagically' come into play here.

At any rate, something like the above would be a prerequisite for adding hyphenation exceptions.
As long as FOP does not see a SHY as a hyphenation point, it is almost useless to add exceptions
on this end.


KR

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


Mime
View raw message