Windows的pyfribidi或其他任何比迪算法 [英] pyfribidi for windows or any other bidi algorithm

查看:119
本文介绍了Windows的pyfribidi或其他任何比迪算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用reportlab生成报告,并且报告语言为阿拉伯语.但问题是由于缺少 BIDI算法支持,因此reportlab不支持BIDI(双向)显示Python.经过大量的搜寻后,我发现Gnome有一个包装器, Fribidi 称为

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 lack BIDI Algorithm support in Python. after alot of googling I found that there is a wrapper around Gnome Fribidi called PyFribidi. but it compiled and runs only on Linux, I tried to build it on windows using mingwin but the compilation fails because a lot of linux libs not found.

我的问题是,在Windows中运行的python中是否有Unicode双向算法实现?

My question is, is there any Unicode bi-direction algorithm implementation in python, that runs on windows?

谢谢.

推荐答案

Python BiDi 是一种很棒的BiDi算法实现,但是它仅支持双向(按原样),而无需修复上下文阿拉伯脚本的形式,要解决上下文形式问题,您应该将python-bidi模块与名为 python-arabic-reshaper .

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.

示例:(来自=> 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)
#...

它完美地解决了我的问题,并且两个软件包都是纯python实现.

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

这篇关于Windows的pyfribidi或其他任何比迪算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆