You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jeff Vannest <Je...@jandrconsult.com> on 2007/04/05 14:32:38 UTC

Wrapping Long Text Without Spaces

Does FOP only wrap text on spaces? What I'm seeing is that text placed in a
cell will overrun the cell boundaries if the text does not contain a space.

I've attached a PNG showing the symptom. The example contains four cells
(with four column headings) each containing boundary text as follows:

Method: COA BOUNDARY_METHOD 01MAR_ABCDEFGHIJ_END
Operation: COA BOUNDARY_OP 01MAR_ABCDEFGHIJKLMN_END
Procedure: N/A
Component: COA BOUNDARY_COMP 01MAR_ABCDEFGHIJKL_END

Because certain sections of text are very long without spaces, and because
no hyphenation support is configured, the text starts to overrun cell
boundaries.


Analysis of Example
====================

The Method cell correctly wraps after "COA ". However, I'm guessing that
"BOUNDARY_METHOD" is too wide for the cell, so wrapping stops, and instead
"BOUNDARY_METHOD 01MAR_ABCDEFGHIJ_END" is simply printed non-stop across the
first 3 columns.

The Operation cell has a problem. I assume that this cell knows that it
cannot wrap because the Method cell already consumes this space, so it
simply writes all text across columns 2-4.

The Procedure cell prints "N/A" as it should, but it is already obscured by
the Operation overflow text.

The Component cell prints and wraps correctly, but is partially obscured by
the Operation overflow text.


Hyphenation
===========
Why not enable hyphenation support? Good question, with hopefully, a good
answer: Our implementation will be writing chemical and scientific data, and
I assume that they hyphenation patterns will not 1) support scientific names
without ongoing tweaking for every new chemical name added, and 2) be
preferred by our readers, who are very particular that data appear
unaltered.

In our previous solution using Oracle Reports, long words were simply broken
across lines. For example, if the text "COA BOUNDARY_METHOD" did not fit
into a single cell, it might hard-break the text as

COA BOUNDARY_ME
THOD

This is suitable to our readers, since it represents no artificial
modification of the name (no hyphenation), and it does not obscure data in
cells to the right.


Questions
=========

Sooooooooooo.............

1) Can FOP be configured to wrap on characters other than space? Like
underscore, for example? This would decrease the occurrence of the problem.

2) If I were to modify the FOP code to hard-break words when no space is
found, where would that modification occur? (I assume this support would be
"turned on" in the configuration file or whatever.)

Thanks for your thoughts in advance, and for all the hard work you do on
FOP!

Jeff


Re: Wrapping Long Text Without Spaces

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Apr 5, 2007, at 14:45, Manuel Mall wrote:

Hi Jeff / Manuel,


>> Does FOP only wrap text on spaces? What I'm seeing is that text
>> placed in a cell will overrun the cell boundaries if the text does
>> not contain a space.

> Assuming you are using the lastest FOP version instead of actually
> modifying FOP you could make your stylesheet insert a zero width space
> after each underscore as that would create a line break opportunity.

Just FYI: the other known workaround (which fits some scenarios  
better than inserting ZWSPs) would be to activate hyphenation, and  
use a ZWSP as hyphenation-character... In that case, FOP will  
ultimately always break the words if they don't fit the available space.

Note that you do need the hyphenation patterns from OFFO, in that  
case, as described here:
http://xmlgraphics.apache.org/fop/0.93/hyphenation.html

Cheers,

Andreas

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


Re: Wrapping Long Text Without Spaces

Posted by Manuel Mall <mm...@arcus.com.au>.
On Thursday 05 April 2007 20:32, Jeff Vannest wrote:

Assuming you are using the lastest FOP version instead of actually 
modifying FOP you could make your stylesheet insert a zero width space 
after each underscore as that would create a line break opportunity.

Manuel

> Does FOP only wrap text on spaces? What I'm seeing is that text
> placed in a cell will overrun the cell boundaries if the text does
> not contain a space.
>
> I've attached a PNG showing the symptom. The example contains four
> cells (with four column headings) each containing boundary text as
> follows:
>
> Method: COA BOUNDARY_METHOD 01MAR_ABCDEFGHIJ_END
> Operation: COA BOUNDARY_OP 01MAR_ABCDEFGHIJKLMN_END
> Procedure: N/A
> Component: COA BOUNDARY_COMP 01MAR_ABCDEFGHIJKL_END
>
> Because certain sections of text are very long without spaces, and
> because no hyphenation support is configured, the text starts to
> overrun cell boundaries.
>
>
> Analysis of Example
> ====================
>
> The Method cell correctly wraps after "COA ". However, I'm guessing
> that "BOUNDARY_METHOD" is too wide for the cell, so wrapping stops,
> and instead "BOUNDARY_METHOD 01MAR_ABCDEFGHIJ_END" is simply printed
> non-stop across the first 3 columns.
>
> The Operation cell has a problem. I assume that this cell knows that
> it cannot wrap because the Method cell already consumes this space,
> so it simply writes all text across columns 2-4.
>
> The Procedure cell prints "N/A" as it should, but it is already
> obscured by the Operation overflow text.
>
> The Component cell prints and wraps correctly, but is partially
> obscured by the Operation overflow text.
>
>
> Hyphenation
> ===========
> Why not enable hyphenation support? Good question, with hopefully, a
> good answer: Our implementation will be writing chemical and
> scientific data, and I assume that they hyphenation patterns will not
> 1) support scientific names without ongoing tweaking for every new
> chemical name added, and 2) be preferred by our readers, who are very
> particular that data appear unaltered.
>
> In our previous solution using Oracle Reports, long words were simply
> broken across lines. For example, if the text "COA BOUNDARY_METHOD"
> did not fit into a single cell, it might hard-break the text as
>
> COA BOUNDARY_ME
> THOD
>
> This is suitable to our readers, since it represents no artificial
> modification of the name (no hyphenation), and it does not obscure
> data in cells to the right.
>
>
> Questions
> =========
>
> Sooooooooooo.............
>
> 1) Can FOP be configured to wrap on characters other than space? Like
> underscore, for example? This would decrease the occurrence of the
> problem.
>
> 2) If I were to modify the FOP code to hard-break words when no space
> is found, where would that modification occur? (I assume this support
> would be "turned on" in the configuration file or whatever.)
>
> Thanks for your thoughts in advance, and for all the hard work you do
> on FOP!
>
> Jeff

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