[xep-support] Inside/Outside Floats

From: Eliot Kimber <ekimber@innodata-isogen.com>
Date: Fri Jan 28 2005 - 15:59:27 PST

Here is a working sample of inside/outside floats that I've worked up. I
think I now understand why this works. I've constructed the page
geometry in this example so that you can have edge regions (the
XEP-provided stuff I've seen assumes you have non-zero margins on your
page master, which I almost never do so that I can put marks out to the
edge of the paper if I need to. It also reduces the number of variables
that have to be considered when doing geometry calculations.)

I have found two possible issues with this sample:

1. The horizontal placement of floats differs from that produced by XSL
Formatter in that XSL Formatter only floats to the edge of the parent
block's effective edge based on that block's start or end indent. XEP
floats to the edge of the nearest ancestor reference area (i.e., the
edge of the region-body). I believe that XEP's behavior is correct based
on my reading of the spec. I have asked Antenna House to defend their
interpretation.

2. When I specify space-before on the child block-container of fo:float,
XEP *always* renders the space, regardless of the conditionality
setting. However, I believe that conditional space-before should be
discarded in this case because side floats establish new reference
areas. XSL Formatter does discard the conditional space in this case.

The behavior in issue 2 isn't actually a problem for me--what I was
hoping to be able to do was to have conditional space before the float
that would be discarded if and only if the float's before edge was
adjacent to the region-body's before edge (i.e., the float was anchored
in the first line of the first normally-positioned block area on a
page). However, because floats establish new reference areas, I see no
way to get this behavior.

This is a concern for me because I'm trying to emulate a hand-laid-out
page design where marignalia were spaced out vertically along the page.
With FO, you can get the floats to stack automatically (using
clear="both" on the floats) but you can't get conditional space between
the stacked floats and you can't normally know which floats will start
on a new page.

I think that what would be required would be for fo:float to be a
specialization of block-container that explicitly had space-before/after
properties and was clearly defined as behaving as an initial child of
its containing reference area when it's before edge is adjacent to the
before edge of its containing reference area.

So hmph.

Here is my sample FO instance:

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
font-family="sans-serif" font-size="9pt" line-height="120%">
   <fo:layout-master-set>
     <!-- This layout reflects the XEP approach to doing "duplex"
          marginalia (inside/outside), in which you use negative margins
         on the region body for the edge opposite the side you want the
          marginalia in (i.e., start edge for odd page with outside-edge
                  marginalia).

          You then use start indent and end indent greater than or equal
          to the negative margins to bring the body contents back onto
          the page in the correct place.

          For this design we want a body column of 4in and an offset
          column of 3in, with 0.5in for the side regions (creating the
          effective page margin).

          Note that the negative inside-edge indent is equal to the width
          of the offset column minus the width of the edge regions (e.g.,
          -2.5in instead of -3in):

            inside-indent = 0 - (offset-column-width - edge-region-width)

          This is with no page margins (which allows for bleeds and so
          forth).

       -->
     <fo:simple-page-master master-name="odd-page" page-width="8.5in"
page-height="11in"
>
       <fo:region-body
           margin-left="-2.5in"
           margin-right="0.5in"
           margin-top="0.75in"
           margin-bottom="0.75in"
           border-color="blue"
           border-style="solid"
           border-width="0.5pt"
       />
       <fo:region-before region-name="region-before-odd"
precedence="false" extent="0.5in"/>
       <fo:region-after extent="0.5in" precedence="false"/>
       <fo:region-start extent="0.5in"/>
       <fo:region-end extent="0.5in"/>
     </fo:simple-page-master>
     <fo:simple-page-master master-name="even-page" page-width="8.5in"
page-height="11in"
>
       <fo:region-body
           margin-left="0.5in"
           margin-right="-2.5in"
           margin-top="0.75in"
           margin-bottom="0.75in"
           border-color="blue"
           border-style="solid"
           border-width="0.5pt"
       />
       <fo:region-before region-name="region-before-even"
precedence="false" extent="0.5in"/>
       <fo:region-after extent="0.5in" precedence="false"/>
       <fo:region-start extent="0.5in"/>
       <fo:region-end extent="0.5in"/>
     </fo:simple-page-master>
     <fo:page-sequence-master master-name="body-pages">
       <fo:repeatable-page-master-alternatives>
         <fo:conditional-page-master-reference
master-reference="odd-page" odd-or-even="odd"/>
         <fo:conditional-page-master-reference
master-reference="even-page" odd-or-even="even"/>
       </fo:repeatable-page-master-alternatives>
     </fo:page-sequence-master>
   </fo:layout-master-set>
   <fo:page-sequence master-reference="body-pages">
     <fo:static-content flow-name="region-before-odd">
       <fo:block-container display-align="after"
block-progression-dimension="100%"
         border-after-style="solid" border-after-color="black"
border-after-width="1pt">
         <fo:block font-size="10pt" text-align="outside">Odd page</fo:block>
       </fo:block-container>
     </fo:static-content>
     <fo:static-content flow-name="region-before-even">
       <fo:block-container display-align="after"
block-progression-dimension="100%"
         border-after-style="solid" border-after-color="black"
border-after-width="1pt">
         <fo:block font-size="10pt" text-align="outside">Even
page</fo:block>
       </fo:block-container>
     </fo:static-content>
     <fo:static-content flow-name="xsl-region-after">
       <fo:block text-align="outside" font-size="10pt"
border-before-style="solid"
         border-before-color="black" border-before-width="1pt">
         <fo:page-number/>
       </fo:block>
     </fo:static-content>
     <fo:flow flow-name="xsl-region-body"
         start-indent="3in"
         end-indent="3in"

>
       <fo:wrapper><!-- odd page -->
         <fo:block font-weight="bold" font-size="14pt">Test of floats
into margins. Odd page</fo:block>
         <fo:block space-before="1em">This sample tests the facility in
XEP that allows you
           to create inside/outside floats.</fo:block>
         <fo:block space-before="1em">This layout reflects the XEP
approach to doing "duplex" marginalia (inside/outside),
           in which you use negative margins on the region body for the
edge opposite the
           side you want the marginalia in (i.e., start edge for odd
page with outside-edge
           marginalia).
         </fo:block>
         <fo:block space-before="1em">
           You then use start indent and end indent equal to the negative
           margins to bring the body contents back onto the page in the
correct place.
         </fo:block>
         <fo:block space-before="1em">
           For this design we want a body column of 4in and an offset
column of 3in, with
           0.5in for the side regions (creating the effective page margin).
         </fo:block>
         <fo:block space-before="1em"
           border-color="green"
           border-style="solid"
           border-width="0.5pt"
           padding="2pt"
>
           <fo:float float="outside" clear="both"
>
             <fo:block-container
               start-indent="0pt"
               end-indent="0pt"
               inline-progression-dimension="2in"
               block-progression-dimension="1in"
               border="red 1pt solid"
               display-align="center"
               text-align="left"
               color="red"
>
               <fo:wrapper
                 start-indent="0pt"
                 end-indent="0pt"
>
                 <fo:block start-indent="1em"
end-indent="1em">Float="outside" [1] clear="both"
                 start/end indent="0pt"
                 </fo:block>
               </fo:wrapper>
             </fo:block-container>
           </fo:float>
           This is a block with an outside-floated block. The outer
block-container
           in the float sets its start and end indent to 0pt to turn off the
           indention that would otherwise be inherited from the flow.
           +++++++++++ ++++++++++ +++++++++++ ++++ +++++++++++++ ++ ++++
++++++++++.
           +++++++++++ ++++++++++ +++++++++++ ++++ +++++++++++++ ++ ++++
++++++++++.
         </fo:block>
         <fo:block space-before="1em"
           border-color="green"
           border-style="solid"
           border-width="0.5pt"
           padding="2pt"
>
           <fo:float float="outside" clear="both"
>
             <fo:block-container
               space-before="0.5in"
               start-indent="0pt"
               end-indent="0pt"
               inline-progression-dimension="2in"
               block-progression-dimension="1in"
               border="red 1pt solid"
               display-align="center"
               text-align="left"
               color="red"
>
               <fo:wrapper
                 start-indent="1em" end-indent="1em" >
                 <fo:block >Float="outside"</fo:block>
                 <fo:block>clear="both"</fo:block>
                 <fo:block>start/end indent="0pt"</fo:block>
                 <fo:block>space-before="0.5in"</fo:block>
                 <!-- <fo:block>space-before.conditionality =
"0.5in"</fo:block> -->
               </fo:wrapper>
             </fo:block-container>
           </fo:float>
           A second block with a float. The outer block-container in
this float
           specifies a space-before value but does not specify
space-before.conditionality value of
           "retain". Thus it should never have any space before it
(because side floats
           establish new reference areas, and therefore establish a
fence, which causes
           the conditional space before to be discarded).
           +++++++++++ ++++++++++ +++++++++++ ++++ +++++++++++++ ++ ++++
++++++++++.
           +++++++++++ ++++++++++ +++++++++++ ++++ +++++++++++++ ++ ++++
++++++++++.
         </fo:block>
         <fo:block space-before="1em"
           border-color="green"
           border-style="solid"
           border-width="0.5pt"
           padding="2pt"
>
           <fo:float float="outside" clear="both"
>
             <fo:block-container
               space-before="0.5in"
               space-before.conditionality="retain"
               start-indent="0pt"
               end-indent="0pt"
               inline-progression-dimension="2in"
               block-progression-dimension="1in"
               border="red 1pt solid"
               display-align="center"
               text-align="left"
               color="red"
>
               <fo:wrapper
                 start-indent="1em" end-indent="1em" >
                 <fo:block >Float="outside"</fo:block>
                 <fo:block>clear="both"</fo:block>
                 <fo:block>start/end indent="0pt"</fo:block>
                 <fo:block>space-before="0.5in"</fo:block>
                 <fo:block>space-before.conditionality = "retain"</fo:block>
               </fo:wrapper>
             </fo:block-container>
           </fo:float>
           A second block with a float. The outer block-container in
this float
           specifies a space-before value and a
space-before.conditionality value of
           "retain". Thus it should always have 1/2 inch of space before it.
           +++++++++++ ++++++++++ +++++++++++ ++++ +++++++++++++ ++ ++++
++++++++++.
           +++++++++++ ++++++++++ +++++++++++ ++++ +++++++++++++ ++ ++++
++++++++++.
         </fo:block>
       </fo:wrapper>
       <fo:wrapper><!-- Even page -->
         <fo:block
           break-before="page"
           space-before="1em"
           border-color="green"
           border-style="solid"
           border-width="0.5pt"
           padding="2pt"
>
           <fo:float float="outside" clear="both"
>
             <fo:block-container
               space-before="0.5in"
               start-indent="0pt"
               end-indent="0pt"
               inline-progression-dimension="2in"
               block-progression-dimension="1in"
               border="red 1pt solid"
               display-align="center"
               text-align="left"
               color="red"
>
               <fo:wrapper
                 start-indent="1em" end-indent="1em" >
                 <fo:block >Float="outside"</fo:block>
                 <fo:block>clear="both"</fo:block>
                 <fo:block>start/end indent="0pt"</fo:block>
                 <fo:block>space-before="0.5in"</fo:block>
               </fo:wrapper>
             </fo:block-container>
           </fo:float>
           A block that starts a page and has a float anchored as its
first child area.
           This float's inner block-container also specifies space
before but
           no "retain", so it should have no space before it, both
because the
           side float establishes a reference area and because it is the
initial child area
           of the page's region-body reference area.
           +++++++++++ ++++++++++ +++++++++++ ++++ +++++++++++++ ++ ++++
++++++++++.
           +++++++++++ ++++++++++ +++++++++++ ++++ +++++++++++++ ++ ++++
++++++++++.
         </fo:block>
       </fo:wrapper>
     </fo:flow>
   </fo:page-sequence>
</fo:root>

-- 
W. Eliot Kimber
Professional Services
Innodata Isogen
9390 Research Blvd, #410
Austin, TX 78759
(512) 372-8122
ekimber@innodata-isogen.com
www.innodata-isogen.com
-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html
Received on Fri Jan 28 17:55:35 2005

This archive was generated by hypermail 2.1.8 : Fri Jan 28 2005 - 17:55:38 PST