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 "Allison, Peter S. (MSFC-NNM04AA02C)[MORGAN]" <Pe...@nasa.gov> on 2008/10/22 00:14:18 UTC

RE: Extra space?

Not sure how to describe this problem... I'm using 0.94...
 
Heres my data:
 
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to  come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
Now  is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country. 

It's one long line, with no newline characters.
 
Here's the output:
 
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid
 of their country. Now is the time for all good men to come to the aid
of their country. Now is the time for all good men  
 to come to the aid of their country. Now is the time for all good men
to come to the aid of their country. Now is the 
 time for all good men to come to the aid of their country. Now is the
time for all good men to come to the aid of their 
 country.

Notice after the line wraps, there is a space printed (I'm assuming it's
a space) before the rest of the line of text is printed.

I'm using my database server, which uses Xalan, to create an FO file
(from an XML file and a stylesheet) that is handed off to FOP. I'm using
a table, and my XSL is this:

   <fo:table-row>
    <fo:table-cell border="1pt solid black" number-columns-spanned="14"
padding="2pt" height="{$appHeight}" display-align="before"> <!--
2.0in-->
     <fo:block text-align="left">APPLICATION:</fo:block>
     <fo:block text-align="left" 
               linefeed-treatment="preserve"
               white-space-treatment="preserve"
               white-space-collapse="false"><xsl:value-of
select="CTPROPERTY[@id='768']/VALUE[@active='YES']"/></fo:block>
    </fo:table-cell>
   </fo:table-row>

where "CTPROPERTY[@id='768']/VALUE[@active='YES']" is a reference to the
XML data.

Here's the resulting FO snippet (I pretty-printed it for readability. No
formatting):

<fo:table-row>
 <fo:table-cell border="1pt solid black" number-columns-spanned="14"
padding="2pt" height="2.5in" display-align="before">
  <fo:block text-align="left">APPLICATION:</fo:block>
  <fo:block text-align="left" linefeed-treatment="preserve"
white-space-treatment="preserve" white-space-collapse="false">Now is the
time for all good men to come to the aid of their country. Now is the
time for all good men to come to the aid of their country. Now is the
time for all good men to come to the aid of their country. Now is the
time for all good men to come to the aid of their country. Now is the
time for all good men to come to the aid of their country. Now is the
time for all good men to come to the aid of their country. Now is the
time for all good men to come to the aid of their country.</fo:block>
 </fo:table-cell>
</fo:table-row>

Any ideas why there would be an extra space when the line wraps? I've
played with some of the attributes, but haven't been able to fix it.

Thanks,
Pete Allison
"Do or do not. There is no 'try.' " - Yoda


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


RE: Extra space?

Posted by Pete Allison <ma...@aol.com>.
Appears to be true even if there is only ONE space character where the
formatter decides to break... 

My example wasn't very good, but there were never sequence of more than one
space character. This particular data also had no newline characters at all.

I'm using FOP to produce a PDF from data users input into a database, using
an HTML textarea input object. They are free to use newlines, indenting and
spacing as they want.

I never know how they are going to format it, so that's the reason for
linefeed-treatment="preserve" white-space-treatment="preserve".

I'm going to try to "school" my users to start each new line with a space,
including the first one. That seems to fix it.

Thanks,
Pete Allison

-----Original Message-----
From: Andreas Delmelle [mailto:andreas.delmelle@telenet.be] 
Sent: Wednesday, October 22, 2008 11:50 AM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Extra space?

On Oct 22, 2008, at 00:14, Allison, Peter S. (MSFC-NNM04AA02C) [MORGAN]
wrote:

> Not sure how to describe this problem... I'm using 0.94...
>
> Heres my data:
> <snip />
> It's one long line, with no newline characters.
>
> <snip />
>
> Notice after the line wraps, there is a space printed (I'm assuming 
> it's a space) before the rest of the line of text is printed.

Yes, this is a consequence of 'white-space-treatment="preserve"'.  
Currently, the layout-algorithm produces suboptimal results, since, if there
is a sequence of space characters, the algorithm will prefer a break before
the last one, making that one end up as the first character on the next
line. (see also Bugzilla 45097: https://
issues.apache.org/bugzilla/show_bug.cgi?id=45097)

As far as I can derive from your example, you may be able to get around it
by either using 'white-space-treatment="ignore-if-following-
linefeed"' or not specifying it at all (= default 'ignore'), since you don't
seem to have blocks of preformatted text (with indenting that should be
preserved).


HTH!

Cheers

Andreas

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



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


Re: Extra space?

Posted by Andreas Delmelle <an...@telenet.be>.
On Oct 22, 2008, at 00:14, Allison, Peter S. (MSFC-NNM04AA02C) 
[MORGAN] wrote:

> Not sure how to describe this problem... I'm using 0.94...
>
> Heres my data:
> <snip />
> It's one long line, with no newline characters.
>
> <snip />
>
> Notice after the line wraps, there is a space printed (I'm assuming  
> it's
> a space) before the rest of the line of text is printed.

Yes, this is a consequence of 'white-space-treatment="preserve"'.  
Currently, the layout-algorithm produces suboptimal results, since,  
if there is a sequence of space characters, the algorithm will prefer  
a break before the last one, making that one end up as the first  
character on the next line. (see also Bugzilla 45097: https:// 
issues.apache.org/bugzilla/show_bug.cgi?id=45097)

As far as I can derive from your example, you may be able to get  
around it by either using 'white-space-treatment="ignore-if-following- 
linefeed"' or not specifying it at all (= default 'ignore'), since  
you don't seem to have blocks of preformatted text (with indenting  
that should be preserved).


HTH!

Cheers

Andreas

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