pyfribidi for windows or any other bidi algorithm

前端 未结 4 826
余生分开走
余生分开走 2020-12-19 17:42

I\'m trying to generate a report using reportlab, and the report language is Arabic. but the problem is reportlab doesn\'t support BIDI (Bidirection) Display because of the

相关标签:
4条回答
  • 2020-12-19 18:13

    python-bidi http://pypi.python.org/pypi/python-bidi/ is a pure python API so presumably it should work fine on windows.

    You need to use the RL branch of reportlab and changes any calls to pyfribidi with calls to python-bidi. This link might help http://code.pediapress.com/wiki/wiki/RightToLeft

    0 讨论(0)
  • 2020-12-19 18:15

    Here is another pure Python implementation of the Unicode bidi algorithm: http://code.google.com/p/pybidi/

    0 讨论(0)
  • 2020-12-19 18:16

    In the meantime I implemented Arabic shaping in Python:

    https://github.com/behdad/pyarabicshaping

    0 讨论(0)
  • 2020-12-19 18:23

    Python BiDi is a great BiDi algorithm implementation, but it just support bi-direction (As Is) without fixing the contextual form of arabic script, to solve contextual form problem, you should use python-bidi module with an arabic reshaper library called python-arabic-reshaper.

    example : (from => http://mpcabd.igeex.biz/python-arabic-text-reshaper/)

    import arabic_reshaper
    from bidi.algorithm import get_display
    
    #...
    reshaped_text = arabic_reshaper.reshape(u'اللغة العربية رائعة')
    bidi_text = get_display(reshaped_text)
    pass_arabic_text_to_render(bidi_text)
    #...
    

    it fixes my problem perfectly, and both packages are pure python implementation.

    0 讨论(0)
提交回复
热议问题