Bug 36408 - FOP hyphenation splits consecutive digits onto separate rows
Summary: FOP hyphenation splits consecutive digits onto separate rows
Status: NEEDINFO
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 0.20.5
Hardware: PC Linux
: P3 minor
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-29 19:01 UTC by Joona Palaste
Modified: 2012-04-01 16:23 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joona Palaste 2005-08-29 19:01:29 UTC
If a <fo:block> node in the XSL:FO source given to FOP has the hyphenate="true"
attribute set, enabling hyphenation, and the contents of the block have lots of
consecutive digits stretching beyond the block boundary, like so:

                                | <-- boundary
The phone number is 12345678901234567890.

then FOP splits the consecutive digits at the boundary, rendering the text like so:

                                | <-- boundary
The phone number is 1234567890123
4567890.

I would prefer it to treat the entire digit sequence as a single,
non-hyphenatable word, causing it to render as follows:

                                | <-- boundary
The phone number is
12345678901234567890.

However, I couldn't find out any way to configure FOP to do this, because it
uses the same hyphenation pattern format as TeX, and apparently TeX only takes
letters, not other symbols, into account when parsing the hyphenation rules.

Is there some kind of way I could stop FOP from splitting consecutive digits
onto separate rows?
Comment 1 Chris Bowditch 2005-08-30 13:07:04 UTC
The correct way to stop a piece of text being split across line/page/column 
bounaries in XSL-Fo is to use keep-* properties.

e.g.

<fo:inline keep-together="always">12345678901234567890</fo:inline>

However, keep-* properties are not implemented in 0.20.5. They have been 
implemented in the current development version. 0.20.5 is about to be 
superceeded by a release of the development code and since work has stopped on 
the maintenance code, this bug won't be fixed in 0.20.5 and I'm closing this 
bug report.
Comment 2 Joona Palaste 2005-08-30 16:01:35 UTC
The suggested fix wouldn't work in my case.

To achieve what I want to do with the suggested fix, I'd have to write the
<fo:block> as:

<fo:block hyphenation="true"><fo:inline>The phone number is
</fo:inline><fo:inline
keep-together="always">12345678901234567890</fo:inline><fo:inline>.</fo:inline></fo:block>

However, the text contents of the <fo:block> are dynamically generated and thus
I can't decide in advance where the <fo:inline> nodes should go. I am reopening
this bug. If the bug is invalid because of the wrong version, please reclose the
bug and tell me how to report it with the corret version.
Comment 3 Jeremias Maerki 2005-08-30 18:05:58 UTC
I can't prove it but I'd say that FOP 0.20.5 illegally splits the long number. A
number is not subject to hyphenation, is it? Anyway, FOP Trunk currently doesn't
split the number but keep-together.within-line doesn't work, either. So, Joona
would actually be fine with FOP Trunk except that there is no warning message,
yet, when a word is rendered beyond the content rectangle (i.e. overflows the
box). Other FO implementations compress the word to fit it into the content
rectangle but that's probably a bad idea since it results in badly looking output.

IMO this bug can be closed again, but only because Joona's problem shouldn't
happen in FOP Trunk and it won't be fixed in 0.20.5. I don't have a work-around
for 0.20.5, either, except to try to shut off hyphenation. Sorry. The missing
keep-together.within-line feature is a different story and IMO not related to
Joona's problem.
Comment 4 Glenn Adams 2012-04-01 16:23:46 UTC
please provide (1) an input FO test file, (2) an output PDF file (if any), (3) console output as file (if any), and (4) FOP version being tested