[xep-support] character sequence reversed in table body cells for text direction rtl and unicode-bidi normal

From: Gerald Wiesinger <Gerald_Wiesinger@at.ibm.com>
Date: Mon May 17 2010 - 07:49:09 PDT

following situation.
a table should be shown which can contain text of any language inside its
table cells. since the 1st column should stay the leftmost column we have
to use the writing mode lr-tb.
the input data holds alignment information and a 'right' alignment should
stay a right alignment on the output. so also lr-tb is required.

the main document langauge is known so we can use a a master switch to
change the text direction accordingly. which is rtl for hebrew or arabic
and ltr for any latin character based languae like english, german, french.

here the full code for reproducing the error (turn validation off)

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:saxon="http://saxon.sf.net/" xmlns:xs=
"http://www.w3.org/2001/XMLSchema" xmlns:fo=
"http://www.w3.org/1999/XSL/Format" font-size="7pt">
      <fo:layout-master-set>
            <fo:simple-page-master master-name="odd_sequence" page-width=
"210mm" page-height="297mm" margin-top="20mm" margin-right="20mm"
margin-left="20mm" margin-bottom="20mm">
                  <fo:region-body margin-bottom="20mm" margin-top="10mm"/>
                  <fo:region-before region-name="odd-cover-header" extent=
"10mm" precedence="false"/>
                  <fo:region-after region-name="odd-footer" extent="10mm"
precedence="false"/>
            </fo:simple-page-master>
            <fo:simple-page-master master-name="even_sequence" page-width=
"210mm" page-height="297mm" margin-top="20mm" margin-right="20mm"
margin-left="20mm" margin-bottom="20mm">
                  <fo:region-body margin-bottom="20mm" margin-top="10mm"/>
                  <fo:region-before region-name="even-cover-header" extent=
"10mm" precedence="false"/>
                  <fo:region-after region-name="even-footer" extent="10mm"
precedence="false"/>
            </fo:simple-page-master>
            <fo:page-sequence-master master-name="sequence">
                  <fo:repeatable-page-master-alternatives>
                        <fo:conditional-page-master-reference odd-or-even=
"odd" master-reference="odd_sequence"/>
                        <fo:conditional-page-master-reference odd-or-even=
"even" master-reference="even_sequence"/>
                  </fo:repeatable-page-master-alternatives>
            </fo:page-sequence-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="sequence">
            <fo:flow flow-name="xsl-region-body">
                  <fo:block>the beginning of the file</fo:block>
                  <fo:block-container writing-mode="lr-tb">
                        <fo:block>
                              <fo:bidi-override direction="ltr"
unicode-bidi="normal">
                                    <fo:block>left</fo:block>
                                    <fo:block space-after="10mm"
text-align="left">The words of Queen Esther,
        &#x5D5;&#x5DB;&#x5D0;&#xFB2A;&#x5E8;
        &#x5D0;&#x5D1;&#x5D3;&#xFB4A;&#x5D9;
        &#x5D0;&#x5D1;&#x5D3;&#xFB4A;&#x5D9;
        "If I perish [in trying to save my people], I perish"</fo:block>
                                    <fo:block>This is a test with number
one-two-three 123</fo:block>
                                    <fo:block>5 ב''יצנה 31 הנגהה</fo:block>
                                    <fo:table width="100%" table-layout=
"fixed" border-top="1.5pt solid" border-style="solid" border-color="black"
space-after="10mm">
                                          <fo:table-column column-width=
"10%"/>
                                          <fo:table-column column-width=
"proportional-column-width(1)"/>
                                          <fo:table-column column-width=
"proportional-column-width(1)"/>
                                          <fo:table-header>
                                                <fo:table-row
background-color="#cccccc">
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="right">Column 1</fo:block>
                                                      </fo:table-cell>
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="left">Column 2</fo:block>
                                                      </fo:table-cell>
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="right">Column 3</fo:block>
                                                      </fo:table-cell>
                                                </fo:table-row>
                                          </fo:table-header>
                                          <fo:table-body>
                                                <fo:table-row>
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="left">Cell 11</fo:block>
                                                      </fo:table-cell>
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="right">Cell 12</fo:block>
                                                      </fo:table-cell>
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="left">Cell 13</fo:block>
                                                      </fo:table-cell>
                                                </fo:table-row>
                                          </fo:table-body>
                                    </fo:table>
                              </fo:bidi-override>
                        </fo:block>
                  </fo:block-container>
                  <fo:block-container writing-mode="lr-tb">
                        <fo:block>
                              <fo:bidi-override direction="rtl"
unicode-bidi="normal">
                                    <fo:block>right</fo:block>
                                    <fo:block space-after="10mm"
text-align="right">The words of Queen Esther,
        &#x5D5;&#x5DB;&#x5D0;&#xFB2A;&#x5E8;
        &#x5D0;&#x5D1;&#x5D3;&#xFB4A;&#x5D9;
        &#x5D0;&#x5D1;&#x5D3;&#xFB4A;&#x5D9;
        "If I perish [in trying to save my people], I perish"</fo:block>
                                    <fo:block>This is a test with number
one-two-three 123</fo:block>
                                    <fo:block>5 ב''יצנה 31 הנגהה</fo:block>
                                    <fo:table width="100%" table-layout=
"fixed" border-top="1.5pt solid" border-style="solid" border-color="black"
space-after="10mm">
                                          <fo:table-column column-width=
"10%"/>
                                          <fo:table-column column-width=
"proportional-column-width(1)"/>
                                          <fo:table-column column-width=
"proportional-column-width(1)"/>
                                          <fo:table-header>
                                                <fo:table-row
background-color="#cccccc">
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="left">Column 1</fo:block>
                                                      </fo:table-cell>
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="right">Column 2</fo:block>
                                                      </fo:table-cell>
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="left">Column 3</fo:block>
                                                      </fo:table-cell>
                                                </fo:table-row>
                                          </fo:table-header>
                                          <fo:table-body>
                                                <fo:table-row>
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="right">Cell 11</fo:block>
                                                      </fo:table-cell>
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="left">Cell 12</fo:block>
                                                      </fo:table-cell>
                                                      <fo:table-cell
border-top="1pt solid" border-style="solid" border-color="black" margin=
"1pt">
                                                            <fo:block
text-align="right">Cell 13</fo:block>
                                                      </fo:table-cell>
                                                </fo:table-row>
                                          </fo:table-body>
                                    </fo:table>
                              </fo:bidi-override>
                        </fo:block>
                  </fo:block-container>
            </fo:flow>
      </fo:page-sequence>
</fo:root>

after rendering the output document contains some nice mixed direction text
and it contains 2 tables. the 1st table is ok.
the table header of the 2nd table is also ok
but all cells of the body of the 2nd table contain the characters of the
text in reversed order as the property unicode-bidi="bidi-override" was
there - but it isnt.

Cell 11 gets printed as 11 lleC
Cell 12 gets printed as 21 lleC
Cell 13 gets printed as 31 lleC

the alignments of the text is as expected.

____________________________________
Best Regards
Gerald Wiesinger

-------------------
(*) 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/terms-of-service.html
Received on Mon May 17 07:57:00 2010

This archive was generated by hypermail 2.1.8 : Mon May 17 2010 - 07:57:01 PDT