FOP apache - support Hebrew letters

别说谁变了你拦得住时间么 提交于 2021-02-07 13:21:07

问题


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...


回答1:


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



来源:https://stackoverflow.com/questions/18818185/fop-apache-support-hebrew-letters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!