aka “The Recommendation Strikes Back”

I came across a very interesting section of the XSL-FO 1.1
Recommendation. This is the description of the from-page-master-region
function in section 5.10.4, “Property Value Functions”. This function
can be used to determine the computed value of the “writing-mode” and
“reference-orientation” properties. To keep it simple I’ll leave
“writing-mode” aside and assume that it’s always kept to its default
value of “lr-tb”.

Preliminary note: fo:simple-page-master, fo:region-body,
fo:region-before and the like /do not/ generate areas. They are simply
/used/ to generate areas, the actual generation is done by

fo:simple-page-master is used to generate a page-viewport-area/
page-reference-area pair. The reference-orientation of the
page-viewport-area is set to 0. Now there is, at best, an ambiguity in
the description of Section 6.4.13, “fo:simple-page-master”:
• first there is a note saying “For example, if the writing-mode of the
  fo:simple-page-master is ‘lr-tb’, then these regions correspond to the
  body of a document, the header, the footer, the left sidebar, and the
  right sidebar.”
• then there is this sentence: “The ‘writing-mode’ of the page is used
  to determine the placement of the five regions on the master.”

That seems to indicate that the value of the “writing-mode” property set
on the fo:simple-page-master is used to determine the placement of the

• but further below there is this: “The reference-orientation of the
  page-reference-area and writing-mode of the page-viewport-area are
  determined by the formatting object that generates the area (see 6.4.5

In Section 6.4.15, “fo:region-before”, there is this: “This region
specifies a viewport/reference pair that is located on the ‘before’ side
of the page-reference-area.”

So, if the fo:simple-page-master has a “reference-orientation” of 0 and
the fo:page-sequence a “reference-orientation” of 90, who wins? Let’s
assume that the first 2 bullet points above are only vague descriptions
and that the 3rd point is normative.

If we want to use the values specified on the respective regions
instead, then we can use the from-page-master-region function for the
value of the “reference-orientation” or “writing-mode” properties set on
fo:page-sequence, as clearly described in Section 5.10.4.

Now, let’s take the following XSL-FO document:

<?xml version="1.0" standalone="no"?>
<fo:root xmlns:fo="http://www.w3.org/1999/xsl/format";>

    <fo:simple-page-master master-name="page"
      page-width="21cm" page-height="29.7cm" reference-orientation="90">
      <fo:region-body margin-top="15pt" reference-orientation="90"/>
      <fo:region-before extent="10pt"/>

  <fo:page-sequence master-reference="page"
    <fo:static-content flow-name="xsl-region-before" font-size="8pt">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>lorem ipsum dolor sit amet, consectetur adipiscing elit.
        vestibulum arcu felis, gravida vitae laoreet in, molestie nec
        libero. mauris non enim diam. pellentesque nisl diam, aliquet
        nec euismod vitae, convallis nec massa. mauris gravida arcu ac
        erat euismod molestie. maecenas eget neque in sem aliquam
        viverra. vivamus dictum lobortis scelerisque.</fo:block>


Because the from-page-master-region function is used, the
“reference-orientation” property specified on the fo:simple-page-master
and the regions is used to determine their orientations.

So the content-rectangle of the page-reference-area is like this:

    |          end            |
    |                         |
    |                         |
    |                         |
    |                         |
    |                         |
    |before                   |after
    |                         |
    |                         |
    |                         |
    |                         |
    |                         |
    |                         |

While the content-rectangle of the region-viewport-area for the
region-before is supposed to be like this:

     |  |
     |  |
     |  |
     |  |
     |  |
  end|  |start
     |  |
     |  |
     |  |
     |  |
     |  |

which is completely inconsistent with the description of
    “The before-edge of the content-rectangle of this
    region-viewport-area is positioned coincident with the before-edge
    of the content-rectangle of the page-reference-area generated using
    the parent fo:simple-page-master. The block-progression-dimension of
    the region-viewport-area is determined by the extent trait on the
    fo:region-before formatting object.”

The inconsistency can be resolved by replacing content-rectangle with
border-rectangle in the excerpt above. Because, as explained in Section
4.2.3, “Geometric Definitions”, the definition of the
before/after/start/end-edges of the content-rectangle of an area uses
the inline/block-progression-direction of that area; Whereas the
border/padding/allocation-rectangles use the directions of the parent

Unless, of course, I have completely missed the point, which might well
be the case.

As a side note, FOP does not follow the Recommendation regarding the
implementation of the “reference-orientation” property on
fo:page-sequence. It behaves as if that property was set to
“from-page-master-region()”, whereas it doesn’t even implement that

Why am I raising this topic? Take an XSL-FO document, add a bit of
overflow=“hidden” here and there, a pinch of reference-orientation,
introduce IPD, BPD, clipping rectangles and transformation matrices,
shake well... and you obtain food for thought regarding Bugzilla #49910.

Any thoughts?

Reply via email to