Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FOP apache - support Hebrew letters

I've been investigating in the last few days the support of Hebrew letters in the FOP apache project for generating PDF file.

I saw that there was a problem with that in the past and I didn't really understood whether it been solved or not?

If there is a support, can somebody show/redirect me to simple sample giving me XSL-FO file with Hebrew letters that when using FOP the PDF is generated properly(clear and not reversed by order letters).

I would really appreciate your answer. This thing is really bothering me and I thinking moving to IText because of this...

like image 393
Anatoly Libman Avatar asked Sep 15 '13 22:09

Anatoly Libman


1 Answers

What kind of sample are you looking for? Works fine for me ...

 <fo:list-item><fo:list-item-label end-indent="label-end()"><fo:block>Hebrew</fo:block></fo:list-     item-label>
 <fo:list-item-body start-indent="body-start()"><fo:block xml:lang="he"><fo:bidi-override    
 unicode-bidi="embed" direction="rtl">כאשר העולם רוצה לדבר, הוא מדבר ב־Unicode</fo:bidi-
 override></fo:block></fo:list-item-body></fo:list-item>

If you use bidi-override and direction it works fine. I tested this in RenderX, Antennahouse and Apache FOP and the results are the same.

Top image is Antennahouse, middle RenderX and bottom Apache FOP.

Per you're question below, the use of direction rtl and bidi-override is because the sentence contains mixed English and Hebrew. If you only had Hebrew, it should format correctly. See this image with FOP all three ways. The middle version is not correct because it requires these attributes.

Here is the complete example for this one:

    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
    <fo:simple-page-master master-name="PageMaster" margin="25mm" page-width="8.5in" page-height="11in" >
    <fo:region-body margin="10mm"/>
    <fo:region-before extent="6mm" display-align="center"/>
    <fo:region-after extent="6mm" display-align="center"/>
    </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="PageMaster">
    <fo:flow flow-name="xsl-region-body" line-height="1.7" font-family="Arial Unicode MS">
    <fo:block>Mixed English and Hebrew with Override</fo:block>
    <fo:block xml:lang="he"><fo:bidi-override unicode-bidi="embed" direction="rtl">כאשר העולם רוצה לדבר, הוא מדבר ב־Unicode</fo:bidi-override></fo:block>
    <fo:block>Mixed English and Hebrew no Override</fo:block>
    <fo:block>כאשר העולם רוצה לדבר, הוא מדבר ב־Unicode</fo:block>
    <fo:block>Hebrew only no Override</fo:block>
    <fo:block>כאשר העולם רוצה לדבר, הוא מדבר ב־</fo:block>    
    </fo:flow>
    </fo:page-sequence>
    </fo:root>

FOP showing different ways you can render

All three major FO renderers

like image 87
Kevin Brown Avatar answered Sep 29 '22 01:09

Kevin Brown