Quick summary: RTL inserts in a bi-directional document modify the directionality of brackets following those inserts.
I am using Apache fop-1.1 on Ubuntu 12.04.2 to generate PDF output from
XML.
File mini.xml:
<?xml version='1.0' encoding='UTF-8'?>
<data>
<notes><br/>[1] RTL insert קום <br/>[2] (parens
wrong).<br/>[3] Back to normal because of this RTL insert: בּ .</notes>
</data>
File mini.fo:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="myPage">
<fo:region-body />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="myPage">
<fo:flow flow-name="xsl-region-body">
<fo:block font-family="FreeSans">
<xsl:apply-templates
select="data/notes"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="br">
<fo:block></fo:block>
</xsl:template>
</xsl:stylesheet>
File mini-fo.cfg:
<fop version="1.0">
<renderers>
<renderer mime="application/pdf">
<fonts>
<font
metrics-url="FreeSans.xml"
embed-url="/usr/share/fonts/truetype/freefont/FreeSans.ttf"
>
<font-triplet name="FreeSans" style="normal"
weight="normal"/>
</font>
</fonts>
</renderer>
</renderers>
</fop>
Invocation of fop-1.1:
/tmp/fop-1.1/fop -c mini-fo.cfg -xml mini.xml -xsl mini.fo mini.pdf
I attach mini.pdf. You can also see its contents by looking at what
pdftotext outputs:
[1] RTL insert קום
]2[ )parens wrong(.
[3] Back to normal because of this RTL insert: ּ. ב
(There are some Unicode \u202b (RIGHT-TO-LEFT EMBEDDING) and \u202c (POP
DIRECTIONAL FORMATTING) characters in that pdftotext output.)
When I use xmlroff instead of fop, the result is correct:
[1] RTL insert קום
[2] (parens wrong).
[3] Back to normal because of this RTL insert: ּ . ב
Raphael
mini.pdf
Description: Adobe PDF document
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
