如何通过 Ruby 正确打印阿拉伯语?
我正在尝试通过 RMagick 生成图像,其中包含已从 Excel 电子表格解析的阿拉伯文本。阿拉伯字母根据其相邻字母改变形状,这种情况似乎仅在 Excel 中发生,仅用于显示目的。这些字母没有以修改后的形式存储,因此打印出来的结果不正确。有谁知道有一个图书馆可以解决这个问题? TIA
I'm trying to generate images through RMagick that contain Arabic text that has been parsed from an excel spreadsheet. Arabic letters change shape depending on their neighbors and this seems to happen in excel for displaying purposes only. The letters are not stored in their modified form, so they print out incorrectly. Does anyone know of a library that addresses this? TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您使用什么版本的 Ruby?另外,ImageMagick 是否应该首先正确渲染阿拉伯文本?如果没有,你可能想使用 Prawn 或其他东西来生成 PDF 文件......
What version of Ruby are you using? Also, is ImageMagick supposed to render Arabic text correctly in the first place? If not, you might want to use Prawn or something to generate a PDF file...
您需要在 Ruby 中重塑阿拉伯文本,ImageMagick/RMagick 才能正确呈现它。
Java 已经解决了这个问题(Better-Arabic-Reshaper) 和 Python(arabic_reshaper)。在将 Ruby 文本传递给 ImageMagick 之前执行相同的任务。 linux CLI:如何将阿拉伯文本渲染为位图
You need to reshape Arabic text in Ruby for ImageMagick/RMagick to render it correctly.
This is already solved for Java(Better-Arabic-Reshaper) and Python(arabic_reshaper). Do the same task in Ruby text before passing it to ImageMagick. linux CLI: how to render Arabic text into bitmap