[xep-support] Padding on blocks

W. Eliot Kimber eliot at isogen.com
Tue Nov 12 03:25:50 PST 2002


Gustaf Liljegren wrote:
> Here's a very basic question. I've hever been able to understand the
> reasoning behind padding on blocks. Here's a template for boxed text:
> 
> <xsl:template match="note">
>   <fo:block
>     padding="2mm"
>     border="0.5pt solid black"
>     keep-together.within-page="always">
>     <xsl:apply-templates/>
>   </fo:block>
> </xsl:template>
> 
> I'd expect the border around to be aligned with the region boundaries
> (typically region-body), but instead, the text is aligned with the region
> while the border is outside. The border is the outmost part of the block.
> What says it can go outside the region?

This is the subtle interplay of *-indent and margin-*. If you do not 
specify an explicit value for the margins, then the content region of 
the block is aligned with in the content region of its containing 
reference area (e.g., the region body). That means that border and 
padding will be outside the content rectangle of the containing region.

If you specify margin-*="0" or specify a value for *-indent, then this 
behavior is turned off and the outside of the border rectangle will be 
adjacent to the inside of the containing region's content rectangle. The 
attached sample FO demonstrates this behavior.

This behavior makes some kind of twisted sense--for example, if in your 
layout design, the width of the body region is intended to be the width 
of text in the body, then any border-based decoration will not throw off 
the positioning of the text. For example, consider the case where you 
use border-start on some paragraph blocks to indicate revisions in that 
paragraph (a crude form of revision bars):

<fo:block>No border</fo:block>
<fo:block border-start-style="solid" padding-start="6pt" 
border-start-width="1pt">Border</fo:block>

With the default behavior (margin and start-indent unspecified) the text 
of both blocks will be aligned on the start edge--the border on the 
second block will not throw off the indention.

Cheers,

Eliot
-- 
W. Eliot Kimber, eliot at isogen.com
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139
-------------- next part --------------
A non-text attachment was scrubbed...
Name: block-samples-03.fo
Type: text/xml
Size: 19162 bytes
Desc: not available
URL: <http://lists.renderx.com/pipermail/xep-support/attachments/20021112/a41d1833/attachment.xml>


More information about the Xep-support mailing list