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 Matthias Müller <py...@yahoo.de> on 2007/08/29 10:37:46 UTC

collapsing borders of block elements

Hi,

is there a way to collapse borders of close-by fo:block elements?
like border-collapse="collapse" for table elements?

cheers, Matthias




      Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: 
http://de.yahoo.com/set

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


RE: text-align="justify" issues

Posted by "Puppala, Kumar (LNG-CON)" <ku...@lexisnexis.com>.
Andreas,
  I removed white-space-treatment property from my fo:block and
everything works fine. I thought that it was a bug since I could see the
same FO work properly in old FOP but not in the new one. Thanks for the
clarification.

Thanks,
Kumar Puppala

-----Original Message-----
From: Andreas L Delmelle [mailto:a_l.delmelle@pandora.be] 
Sent: Saturday, September 15, 2007 9:35 AM
To: fop-users@xmlgraphics.apache.org
Subject: Re: text-align="justify" issues

On Sep 15, 2007, at 14:26, Andreas L Delmelle wrote:

Just thought I'd add for the sake of clarity:

> On Sep 13, 2007, at 15:20, Puppala, Kumar (LNG-CON) wrote:
>
>> Hi Vincent,
>>   Thanks for your suggestion. Removing white-space-treatment  
>> property got me a correct result.
>
> The result *with* white-space preservation is also correct (don't  
> confuse 'unexpected' with 'incorrect').
> <snip />
> It's not a bug, but a feature. ;-)

Given that the issue arose in a transition of FOP 0.20.x to 0.9x, the  
*only right way* to deal with it is to adapt the stylesheet to not  
use white-space-treatment="preserve" anymore, unless when it is  
absolutely necessary to do so. In the provided example, the property  
serves no purpose at all, so should best be removed.

In FOP 0.20.x, white-space-treatment was necessary to preserve  
linefeeds, which is non-compliant behavior. The two properties white- 
space-treatment and linefeed-treatment operate independently of each  
other.
Firstly, linefeeds are either preserved, ignored or converted to a  
space.
Then the space-characters, after having treated the linefeeds, are in  
their turn preserved or ignored.
In a first pass --in XSL-FO terms: refinement stage--, by only  
looking at explicit linebreaks, like start- or end-of-block or  
preserved linefeed characters.
Further on, in a second pass --in XSL-FO terms: area tree building--,  
the implicit formatter-generated linebreaks also enter the equation.

Add white-space-collapse into the mix to further control whether  
series of spaces should be replaced by one space character.

Finally, there is also the suppress-at-line-break property one could  
use on individual fo:characters, to specify the behavior for a single  
character (regardless of whether it is white-space or not).


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: text-align="justify" issues

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 15, 2007, at 14:26, Andreas L Delmelle wrote:

Just thought I'd add for the sake of clarity:

> On Sep 13, 2007, at 15:20, Puppala, Kumar (LNG-CON) wrote:
>
>> Hi Vincent,
>>   Thanks for your suggestion. Removing white-space-treatment  
>> property got me a correct result.
>
> The result *with* white-space preservation is also correct (don't  
> confuse 'unexpected' with 'incorrect').
> <snip />
> It's not a bug, but a feature. ;-)

Given that the issue arose in a transition of FOP 0.20.x to 0.9x, the  
*only right way* to deal with it is to adapt the stylesheet to not  
use white-space-treatment="preserve" anymore, unless when it is  
absolutely necessary to do so. In the provided example, the property  
serves no purpose at all, so should best be removed.

In FOP 0.20.x, white-space-treatment was necessary to preserve  
linefeeds, which is non-compliant behavior. The two properties white- 
space-treatment and linefeed-treatment operate independently of each  
other.
Firstly, linefeeds are either preserved, ignored or converted to a  
space.
Then the space-characters, after having treated the linefeeds, are in  
their turn preserved or ignored.
In a first pass --in XSL-FO terms: refinement stage--, by only  
looking at explicit linebreaks, like start- or end-of-block or  
preserved linefeed characters.
Further on, in a second pass --in XSL-FO terms: area tree building--,  
the implicit formatter-generated linebreaks also enter the equation.

Add white-space-collapse into the mix to further control whether  
series of spaces should be replaced by one space character.

Finally, there is also the suppress-at-line-break property one could  
use on individual fo:characters, to specify the behavior for a single  
character (regardless of whether it is white-space or not).


Cheers

Andreas


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


Re: text-align="justify" issues

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 13, 2007, at 15:20, Puppala, Kumar (LNG-CON) wrote:

> Hi Vincent,
>   Thanks for your suggestion. Removing white-space-treatment  
> property got me a correct result.

The result *with* white-space preservation is also correct (don't  
confuse 'unexpected' with 'incorrect').

Explanation:
Note that the combination of

<fo:block white-space-collapse="false" white-space- 
treatment="preserve">...</fo:block>

will preserve *all* spaces. On top of that, if linefeed-treatment is  
not explicitly specified, then it defaults to "treat-as-space".

<fo:block white-space-collapse="false" white-space-treatment="preserve">
a line ending with a space
  a line beginning with a space
</fo:block>

will lead to *three* spaces, as in:

a line ending with a space   a line beginning with a space

If the formatter would generate an implicit line-break after the  
three spaces, they will NOT be collapsed. To achieve that result, you  
want the default/initial value of white-space-treatment="ignore-if- 
surrounding-linefeed".

It's not a bug, but a feature. ;-)



Cheers

Andreas




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


RE: text-align="justify" issues

Posted by "Puppala, Kumar (LNG-CON)" <ku...@lexisnexis.com>.
Hi Vincent,
  Thanks for your suggestion. Removing white-space-treatment property got me a correct result. I may be able to use this as a workaround for now. We did add that property on the block for a specific reason and I will try to figure out what else I might be breaking if I take that out of my fo:block elements. I will also keep looking at the code related to whitespaces handling. If anyone is able to resolve this issue (or have suggestions how to fix it), please post it.

Thanks,
Kumar Puppala

-----Original Message-----
From: Vincent Hennebert [mailto:vincent.hennebert@anyware-tech.com] 
Sent: Thursday, September 13, 2007 4:39 AM
To: fop-users@xmlgraphics.apache.org
Subject: Re: text-align="justify" issues

Hi Kumar,

Indeed there seems to be something going wrong, caused by the 
white-space-treatment property. Your change seems to fix part of the 
problem, although I'd have to study it into more details. Sorry, right 
now I have no time for that. If someone else wants to take the lead...
Properties related to the handling of whitespaces are a bit complex and 
not easy to grasp correctly.

Note that if you remove the white-space-treatment property (or leave  it 
to its default value) you will get a correct result. Maybe you can avoid 
using it? You would have something working while waiting for the issue 
to be corrected.

Vincent


Puppala, Kumar (LNG-CON) a écrit :
> Thanks for the response. I am hereby providing a sample FO file along with outputs generated using fop 0.20.5 and 0.94.
> 
>  
> 
> <?xml version="1.0" encoding="iso-8859-1" ?><fo:root xmlns:lnsm="http://www.lexis-nexis.com/lnsm" xmlns:lnvx="http://www.lexis-nexis.com/lnvx" xmlns:lnv="http://www.lexis-nexis.com/lnv" xmlns:lnvxe="http://www.lexis-nexis.com/lnvxe" xmlns:lnclx="http://www.lexis-nexis.com/lnclx" xmlns:fo="http://www.w3.org/1999/XSL/Format"><fo:layout-master-set><fo:simple-page-master master-name="cover-end-page-first" page-height="11in" page-width="8.5in" margin-top=".5in" margin-bottom=".5in" margin-left=".9in" margin-right=".9in"><fo:region-body  margin-top=".25in" margin-bottom=".25in" column-count="2"/></fo:simple-page-master><fo:page-sequence-master master-name="cover-end-sequence"><fo:repeatable-page-master-reference master-reference="cover-end-page-first"/></fo:page-sequence-master></fo:layout-master-set><fo:page-sequence master-reference="cover-end-sequence" force-page-count="no-force" initial-page-number="1" ><fo:flow flow-name="xsl-region-body"><fo:block white-space-treatment="pre
serve" white-space-collapse="false" color="#000000" font-family="Times" text-align="justify" font-weight="normal" font-style="normal" text-decoration="no-underline" font-size="10pt" line-height="1.35" ><fo:inline color="#000000" font-family="Times" font-weight="normal" font-style="normal" text-decoration="no-underline" font-size="10pt">Testing Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment calls for the exercise of an informed judgment on a consideration of many factors.</fo:inline></fo:block><fo:block span="all" /></fo:flow></fo:page-sequence></fo:root>
> 
> 
> If you notice these outputs, you will see that the second line clears shows that justification is not working properly. I was playing with the order of the elements created for a space in TextLayoutManager.java and was able to align the text properly on the left (refer to newFopUpdated.pdf) but still it does not justify properly on the right. The change I did to get it aligned properly on the left is:

<snip/>

---------------------------------------------------------------------
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: text-align="justify" issues

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Hi Kumar,

Indeed there seems to be something going wrong, caused by the 
white-space-treatment property. Your change seems to fix part of the 
problem, although I’d have to study it into more details. Sorry, right 
now I have no time for that. If someone else wants to take the lead...
Properties related to the handling of whitespaces are a bit complex and 
not easy to grasp correctly.

Note that if you remove the white-space-treatment property (or leave  it 
to its default value) you will get a correct result. Maybe you can avoid 
using it? You would have something working while waiting for the issue 
to be corrected.

Vincent


Puppala, Kumar (LNG-CON) a écrit :
> Thanks for the response. I am hereby providing a sample FO file along with outputs generated using fop 0.20.5 and 0.94.
> 
>  
> 
> <?xml version="1.0" encoding="iso-8859-1" ?><fo:root xmlns:lnsm="http://www.lexis-nexis.com/lnsm" xmlns:lnvx="http://www.lexis-nexis.com/lnvx" xmlns:lnv="http://www.lexis-nexis.com/lnv" xmlns:lnvxe="http://www.lexis-nexis.com/lnvxe" xmlns:lnclx="http://www.lexis-nexis.com/lnclx" xmlns:fo="http://www.w3.org/1999/XSL/Format"><fo:layout-master-set><fo:simple-page-master master-name="cover-end-page-first" page-height="11in" page-width="8.5in" margin-top=".5in" margin-bottom=".5in" margin-left=".9in" margin-right=".9in"><fo:region-body  margin-top=".25in" margin-bottom=".25in" column-count="2"/></fo:simple-page-master><fo:page-sequence-master master-name="cover-end-sequence"><fo:repeatable-page-master-reference master-reference="cover-end-page-first"/></fo:page-sequence-master></fo:layout-master-set><fo:page-sequence master-reference="cover-end-sequence" force-page-count="no-force" initial-page-number="1" ><fo:flow flow-name="xsl-region-body"><fo:block white-space-treatment="pre
serve" white-space-collapse="false" color="#000000" font-family="Times" text-align="justify" font-weight="normal" font-style="normal" text-decoration="no-underline" font-size="10pt" line-height="1.35" ><fo:inline color="#000000" font-family="Times" font-weight="normal" font-style="normal" text-decoration="no-underline" font-size="10pt">Testing Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment calls for the exercise of an informed judgment on a consideration of many factors.</fo:inline></fo:block><fo:block span="all" /></fo:flow></fo:page-sequence></fo:root>
> 
> 
> If you notice these outputs, you will see that the second line clears shows that justification is not working properly. I was playing with the order of the elements created for a space in TextLayoutManager.java and was able to align the text properly on the left (refer to newFopUpdated.pdf) but still it does not justify properly on the right. The change I did to get it aligned properly on the left is:

<snip/>

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


RE: text-align="justify" issues

Posted by "Puppala, Kumar (LNG-CON)" <ku...@lexisnexis.com>.
Thanks for the response. I am hereby providing a sample FO file along with outputs generated using fop 0.20.5 and 0.94.

 

<?xml version="1.0" encoding="iso-8859-1" ?><fo:root xmlns:lnsm="http://www.lexis-nexis.com/lnsm" xmlns:lnvx="http://www.lexis-nexis.com/lnvx" xmlns:lnv="http://www.lexis-nexis.com/lnv" xmlns:lnvxe="http://www.lexis-nexis.com/lnvxe" xmlns:lnclx="http://www.lexis-nexis.com/lnclx" xmlns:fo="http://www.w3.org/1999/XSL/Format"><fo:layout-master-set><fo:simple-page-master master-name="cover-end-page-first" page-height="11in" page-width="8.5in" margin-top=".5in" margin-bottom=".5in" margin-left=".9in" margin-right=".9in"><fo:region-body  margin-top=".25in" margin-bottom=".25in" column-count="2"/></fo:simple-page-master><fo:page-sequence-master master-name="cover-end-sequence"><fo:repeatable-page-master-reference master-reference="cover-end-page-first"/></fo:page-sequence-master></fo:layout-master-set><fo:page-sequence master-reference="cover-end-sequence" force-page-count="no-force" initial-page-number="1" ><fo:flow flow-name="xsl-region-body"><fo:block white-space-treatment="preserve" white-space-collapse="false" color="#000000" font-family="Times" text-align="justify" font-weight="normal" font-style="normal" text-decoration="no-underline" font-size="10pt" line-height="1.35" ><fo:inline color="#000000" font-family="Times" font-weight="normal" font-style="normal" text-decoration="no-underline" font-size="10pt">Testing Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment Apportionment calls for the exercise of an informed judgment on a consideration of many factors.</fo:inline></fo:block><fo:block span="all" /></fo:flow></fo:page-sequence></fo:root>

 

 

If you notice these outputs, you will see that the second line clears shows that justification is not working properly. I was playing with the order of the elements created for a space in TextLayoutManager.java and was able to align the text properly on the left (refer to newFopUpdated.pdf) but still it does not justify properly on the right. The change I did to get it aligned properly on the left is:

 

 

In CreateElementsForASpace() function of TextLayoutManager.java:

 

Before:

--------------------------

            case EN_JUSTIFY:

                spaceElements.add(new KnuthGlue(lineEndBAP, 0, 0,

                        new LeafPosition(this, -1), false));

                spaceElements.add(new KnuthPenalty(0, 0, false,

                        new LeafPosition(this, -1), false));

                spaceElements.add(new KnuthGlue(

                        - (lineStartBAP + lineEndBAP), ai.ipdArea.max

                        - ai.ipdArea.opt, ai.ipdArea.opt - ai.ipdArea.min,

                        new LeafPosition(this, -1), false));

                spaceElements.add(new KnuthInlineBox(0, null,

                        notifyPos(new LeafPosition(this, -1)), false));

                spaceElements.add(new KnuthPenalty(0,

                        KnuthElement.INFINITE, false, new LeafPosition(

                                this, -1), false));

                spaceElements.add(new KnuthGlue(lineStartBAP + ai.ipdArea.opt, 0, 0,

                        mainPosition, false));

 

-----------------------------

 

Change:

------------------------------

            case EN_JUSTIFY:

                spaceElements.add(new KnuthPenalty(0,

                        KnuthElement.INFINITE, false, 

                        new LeafPosition(this, -1), false));

                spaceElements.add(new KnuthGlue(

                        - (lineStartBAP + lineEndBAP), ai.ipdArea.max

                        - ai.ipdArea.opt, ai.ipdArea.opt - ai.ipdArea.min,

                        new LeafPosition(this, -1), false));

                spaceElements.add(new KnuthPenalty(0,

                        KnuthElement.INFINITE, false, new LeafPosition(

                                this, -1), false));

                spaceElements.add(new KnuthInlineBox(0, null,

                        new LeafPosition(this, -1), false));

                spaceElements.add(new KnuthGlue(

                        (lineStartBAP +ai.ipdArea.opt), 0, 0,

                        mainPosition, false));

---------------------------------

 

My understanding is that when we add areas to the layout, there is a spaceArea at the beginning of second line. This space area gets the adjustment calculated and hence it appears to be offset by that adjustment value. The inlineAreas arraylist (showing this spaceArea) at this point is as shown below:

 

 

 

If someone can point how to fix this issue, I would really appreciate it. We are trying to switch to the new FOP but this issue could be a potential show stopper for the migration.

 

Thanks,

Kumar Puppala

 

-----Original Message-----
From: Vincent Hennebert [mailto:vincent.hennebert@anyware-tech.com] 
Sent: Wednesday, September 12, 2007 4:01 AM
To: fop-users@xmlgraphics.apache.org
Subject: Re: text-align="justify" issues

 

Hi Kumar,

 

Sorry for the delay.

 

I'm not sure if your problem is related to that bug. Are you playing 

with the word-spacing option?

I suggest you to post a small FO file showing your problem, so that we 

can have a look.

 

Thanks,

Vincent

 

Puppala, Kumar (LNG-CON) a �crit :

> We have been using apache fop 0.20.5 and are planning to switch to .94

> version. One difference I noticed between the two is when we have

> text-align="justify" set on an fo:block. I don't see the text justified

> properly as it used to do in the previous version( 0.20.5). The text is

> rendered in dual column layout. If the text was rendered in Single

> column layout, the very first line of the paragraph seems to be off

> compared to the other lines. However, the remaining lines seem to be

> justified properly. Are there any known issues here? I was going through

> the 'known Issues' list for fop 0.94 and it does mention about word

> spacing not working as expected. The corresponding testcase is named

> block_word_spacing_text_align_justify.xml. There is not a whole lot of

> information provided on this issue. For the pudits on this forum, do you

> see any correlation between the issue I am facing and the one already

> documented? If so, are there any workarounds.

> 

> PS: The same problem was also seem in 0.93 version.

 

---------------------------------------------------------------------

To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org

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


Re: text-align="justify" issues

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Hi Kumar,

Sorry for the delay.

I’m not sure if your problem is related to that bug. Are you playing 
with the word-spacing option?
I suggest you to post a small FO file showing your problem, so that we 
can have a look.

Thanks,
Vincent

Puppala, Kumar (LNG-CON) a écrit :
> We have been using apache fop 0.20.5 and are planning to switch to .94
> version. One difference I noticed between the two is when we have
> text-align="justify" set on an fo:block. I don't see the text justified
> properly as it used to do in the previous version( 0.20.5). The text is
> rendered in dual column layout. If the text was rendered in Single
> column layout, the very first line of the paragraph seems to be off
> compared to the other lines. However, the remaining lines seem to be
> justified properly. Are there any known issues here? I was going through
> the 'known Issues' list for fop 0.94 and it does mention about word
> spacing not working as expected. The corresponding testcase is named
> block_word_spacing_text_align_justify.xml. There is not a whole lot of
> information provided on this issue. For the pudits on this forum, do you
> see any correlation between the issue I am facing and the one already
> documented? If so, are there any workarounds.
> 
> PS: The same problem was also seem in 0.93 version.

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


text-align="justify" issues

Posted by "Puppala, Kumar (LNG-CON)" <ku...@LexisNexis.com>.
We have been using apache fop 0.20.5 and are planning to switch to .94
version. One difference I noticed between the two is when we have
text-align="justify" set on an fo:block. I don't see the text justified
properly as it used to do in the previous version( 0.20.5). The text is
rendered in dual column layout. If the text was rendered in Single
column layout, the very first line of the paragraph seems to be off
compared to the other lines. However, the remaining lines seem to be
justified properly. Are there any known issues here? I was going through
the 'known Issues' list for fop 0.94 and it does mention about word
spacing not working as expected. The corresponding testcase is named
block_word_spacing_text_align_justify.xml. There is not a whole lot of
information provided on this issue. For the pudits on this forum, do you
see any correlation between the issue I am facing and the one already
documented? If so, are there any workarounds.

PS: The same problem was also seem in 0.93 version.

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


RE: Do you have any .fo sample in 0.94 demonstrating that new collapsing-border model in tables?

Posted by Andrejus Chaliapinas <a....@infosana.com>.
Hi Chris,

> There are half a dozen files in the test suite. Look in
> fop/test/layoutengine/standard-testcases for all files starting with
> table_border-collapse_collapse. Note; that these files are not strict FO
> files, they have some XML around the FO, but the FO is easy enough to
> extract from here.
>

Thanks a lot for the hint! I finally gave up with JDK 1.3 (various ant build
errors) and now try to work with JDK 1.4. So far there were no big issues
with 0.94 branch.

Andrejus


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


Re: Do you have any .fo sample in 0.94 demonstrating that new collapsing-border model in tables?

Posted by Chris Bowditch <bo...@hotmail.com>.
Andrejus Chaliapinas wrote:

> Just curious if I can find any .fo file in 0.94 branch, which has
> demonstration of that new implemented feature.

There are half a dozen files in the test suite. Look in 
fop/test/layoutengine/standard-testcases for all files starting with 
table_border-collapse_collapse. Note; that these files are not strict FO 
files, they have some XML around the FO, but the FO is easy enough to 
extract from here.

Chris



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


Do you have any .fo sample in 0.94 demonstrating that new collapsing-border model in tables?

Posted by Andrejus Chaliapinas <a....@infosana.com>.
Just curious if I can find any .fo file in 0.94 branch, which has
demonstration of that new implemented feature.

Regards,
Andrejus


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