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 Alex Zepeda <zi...@sonic.net> on 2010/11/18 07:57:54 UTC

Table and block-container borders 0.93 vs 0.95/1.0

Hi all,

I've been updating some of my templates to work with FOP 1.0.  I've noticed 
that the following xsl does not produce the same results with FOP 0.95 or 1.0 
that it does with 0.93.  Now, I know that 0.93 didn't support collapsing table 
borders... but that aside, the outer table border on 0.93 is aligned with the 
block-container border, but is mysteriously set about 1/4 point below the 
table border in 0.95/1.0

Is this intentional behaviour?  If so, is there some other way than futzing 
with the margins manually to achieve the old-style results?

<?xml version="1.0" encoding="ISO-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>
	<fo:simple-page-master page-width="8.5in" page-height="11.0in" 
master-name="page-master">
		<fo:region-body />
	</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="page-master">

<fo:flow flow-name="xsl-region-body">

	<fo:block-container top="0.25in" left="1in" width="3.0in" height="1in" 
position="fixed" padding="0pt" margin="0in" border="0.5pt solid lightblue">
		<fo:block>TEXT HERE</fo:block>
	</fo:block-container>

	<fo:block-container border="0pt" top="0.25in" left="1.75in" width="3.0in" 
height="1in" position="fixed">
		<fo:table border="0.5pt solid black" position="absolute">
			<fo:table-column column-width="0.721in"/>
			<fo:table-body>
	  		<fo:table-row>
	    		<fo:table-cell border="0.5pt solid black" height="0.324in">
	      		<fo:block>CELL</fo:block>
	    		</fo:table-cell>
	  		</fo:table-row>
			</fo:table-body>
		</fo:table>
	</fo:block-container>
</fo:flow>

</fo:page-sequence>
</fo:root>

- alex

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


Re: Table and block-container borders 0.93 vs 0.95/1.0

Posted by Vincent Hennebert <vh...@gmail.com>.
Hi Alex,

On 18/11/10 17:53, Alex Zepeda wrote:
> Vincent Hennebert wrote:
> 
>> Set the border-collapse property to ‘separate’, or set a top-margin of
>> half the table border. That may not be so simple if you have fancy
>> borders on the cells but, in most cases, this is easy to determine.
> 
> Ah hah.  Setting border-collapse to 'separate' doesn't fix things.  With
> 0.93, you'll get the double border that is flush with the
> block-container's border.  With 0.95/1.0 I get the same effect as
> before, but with a thicker border. Setting margin-top of the blue
> block-container doesn't seem to change things.  Adjusting the absolute
> position gets a bit tricky because I'm using two different units for the
> dimensions and borders.

My bad, this is actually slightly more complicated. FOP 0.93 is wrong,
FOP 0.95 produces the correct result.

In the separate border model the table border behaves just like any
other border, and takes up some space on the page (unlike in the
collapsing border model where half of it relies in the table’s margin).
Thus, the top of the table’s border coincides with the beginning of the
block-container’s content rectangle, that is, at 0.25in from the top of
the page.

The ‘top’ property sets the distance of the block-container’s
/content-rectangle/ WRT the top of the page. The content-rectangle
doesn’t include the block-container’s border, which then starts at
(0.25in − 0.5pt).

If you want the table’s border to be flush with the other
block-container’s border, then you have to set a negative margin on the
table (−0.25pt in the collapsing border model, −0.5pt in the separate
border model). Or you can also set the ‘top’ property on the
block-container to “0.25in - 0.25pt” (FOP will do the calculation for
you).


> I've attached the PDFs from 0.93 (with no border-collapse specified /
> relevant) and 1.0 (with border-collapse set to separate).
> 
> - alex

HTH,
Vincent

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


Re: Table and block-container borders 0.93 vs 0.95/1.0

Posted by Alex Zepeda <zi...@sonic.net>.
Vincent Hennebert wrote:

> Set the border-collapse property to ‘separate’, or set a top-margin of
> half the table border. That may not be so simple if you have fancy
> borders on the cells but, in most cases, this is easy to determine.

Ah hah.  Setting border-collapse to 'separate' doesn't fix things.  With 0.93, 
you'll get the double border that is flush with the block-container's border. 
  With 0.95/1.0 I get the same effect as before, but with a thicker border. 
Setting margin-top of the blue block-container doesn't seem to change things. 
  Adjusting the absolute position gets a bit tricky because I'm using two 
different units for the dimensions and borders.

I've attached the PDFs from 0.93 (with no border-collapse specified / 
relevant) and 1.0 (with border-collapse set to separate).

- alex

Re: Table and block-container borders 0.93 vs 0.95/1.0

Posted by Vincent Hennebert <vh...@gmail.com>.
Hi Alex,

On 18/11/10 06:57, Alex Zepeda wrote:
> Hi all,
> 
> I've been updating some of my templates to work with FOP 1.0.  I've
> noticed that the following xsl does not produce the same results with
> FOP 0.95 or 1.0 that it does with 0.93.  Now, I know that 0.93 didn't
> support collapsing table borders... but that aside, the outer table
> border on 0.93 is aligned with the block-container border, but is
> mysteriously set about 1/4 point below the table border in 0.95/1.0
> 
> Is this intentional behaviour?

Yes. In the collapsing border model half of the border resides in the
table’s margin. And since in your example its margin was left to zero,
this means that half of its border sticks out of the parent
block-container, and encroaches upon the other block-container’s border
rectangle.


> If so, is there some other way than
> futzing with the margins manually to achieve the old-style results?

Set the border-collapse property to ‘separate’, or set a top-margin of
half the table border. That may not be so simple if you have fancy
borders on the cells but, in most cases, this is easy to determine.


> <?xml version="1.0" encoding="ISO-8859-1"?>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
> 
> <fo:layout-master-set>
>     <fo:simple-page-master page-width="8.5in" page-height="11.0in"
> master-name="page-master">
>         <fo:region-body />
>     </fo:simple-page-master>
> </fo:layout-master-set>
> 
> <fo:page-sequence master-reference="page-master">
> 
> <fo:flow flow-name="xsl-region-body">
> 
>     <fo:block-container top="0.25in" left="1in" width="3.0in"
> height="1in" position="fixed" padding="0pt" margin="0in" border="0.5pt
> solid lightblue">
>         <fo:block>TEXT HERE</fo:block>
>     </fo:block-container>
> 
>     <fo:block-container border="0pt" top="0.25in" left="1.75in"
> width="3.0in" height="1in" position="fixed">
>         <fo:table border="0.5pt solid black" position="absolute">
>             <fo:table-column column-width="0.721in"/>
>             <fo:table-body>
>               <fo:table-row>
>                 <fo:table-cell border="0.5pt solid black" height="0.324in">
>                   <fo:block>CELL</fo:block>
>                 </fo:table-cell>
>               </fo:table-row>
>             </fo:table-body>
>         </fo:table>
>     </fo:block-container>
> </fo:flow>
> 
> </fo:page-sequence>
> </fo:root>
> 
> - alex

HTH,
Vincent

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