W3C home > Mailing lists > Public > www-xsl-fo@w3.org > February 2008

Upside down text in the table

From: fat bold cyclop <fat.bold.cyclop@gmail.com>
Date: Tue, 5 Feb 2008 06:24:51 +0100
Message-ID: <1ee982a50802042124l2c8e270fh3935b32b7437c882@mail.gmail.com>
To: www-xsl-fo@w3.org

I work on XML->XSL-FO->PDF tranformation that would produce Tsumeshogi
problems in pdf format. In Shogi diagrams the pieces are often rotated
(black pieces are placed heads up, white - heads down).

I need some cells of my table to be rotated by 180 deg.
I achieve this by:

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
        <fo:simple-page-master master-name="first"
page-height="29.7cm" page-width="21cm" margin-top="1cm"
                               margin-bottom="1cm" margin-left="2.5cm"
margin-right="2.5cm">
            <fo:region-body margin-top="1.5cm" margin-bottom="1.5cm"/>
        </fo:simple-page-master>
    </fo:layout-master-set>

    <fo:page-sequence master-reference="first" language="ja">
        <fo:flow flow-name="xsl-region-body">
            <fo:block space-before="4mm">
                <fo:table font-size="8pt" table-layout="fixed"
border-collapse="separate"
                          border-style="solid"
                          width="2*6mm">
                    <fo:table-column column-width="6mm"/>
                    <fo:table-column column-width="6mm"/>
                    <fo:table-body>
                        <fo:table-row height="6mm">
                            <fo:table-cell border-bottom="0.5pt solid
black" border-right="0.5pt solid black" display-align="center">
                                <fo:block-container text-align="center">
                                    <fo:block>A</fo:block>
                                </fo:block-container>
                            </fo:table-cell>
                            <fo:table-cell border-bottom="0.5pt solid
black" border-right="0.5pt solid black">
                                <fo:block-container
reference-orientation="-180" text-align="center" >
                                    <fo:block>B</fo:block>
                                </fo:block-container>
                            </fo:table-cell>
                        </fo:table-row>
                    </fo:table-body>
                </fo:table>
            </fo:block>
        </fo:flow>
    </fo:page-sequence>
</fo:root>

The key part is the use of reference-orientation:
           <fo:block-container reference-orientation="-180"
text-align="center" >
                    <fo:block>B</fo:block>
           </fo:block-container>

The rotation works fine -- the letter B in my example gets rotated.
But it also gets misplaced: it goes outside it's cell (above the
cell).

The PDF rendered by FOP look like this:
http://fat.bold.cyclop.googlepages.com/upsidedown.pdf (~5k).

Is it the matter of renderer (Apache FOP 0.93) or it is a behavior
described by xsl-fo specification? Am I doing something wrong? Maybe
there is other way in XSL-FO to rotate text?


Thanks for any help!

Regards,
fbc
Received on Wednesday, 6 February 2008 06:25:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 6 February 2008 06:25:41 GMT