bidi

Printing Bidi text to an image

巧了我就是萌 提交于 2019-12-01 18:22:20
I have some code in Python using PIL, that will print UTF-8 characters to an image. I've noticed that for joining Bidi scripts like Arabic, the same code fails to connect characters correctly (the initial forms are only chosen, medial and final forms aren't utilized) Can anyone recommend a method or technique for solving this particular issue? If you want to keep using PIL, use pyarabicshaping with pybidi or you might want to consider switching to pangocairo which uses HarfBuzz for text shaping. What I did is the following: Python + Wand (Python Lib) +arabic_reshaper(Python Lib) +bidi

Reversing Strings in Right To Left (BiDirectional) Languages in iTextSharp

假如想象 提交于 2019-12-01 18:20:30
I'm using iTextSharp( C# iText port) to create pdfs from text/html. Most of my text is in Hebrew, a Right-To-Left language. My problem is that PDFs show RTL langauge in reverse, so I need to reverse my strings in a way that would only reverse the RTL text without reversing any numbers or text in English. It is my understanding that fribidi allows doing that on linux, but I couldn't find any solutions for this problem for Windows. I would welcome any suggestions, including an alternative to iTextSharp that would do this automatically (if one exists). To show RTL texts by using iTextSharp

Change direction of negative number with combination of LTR and RTL content

余生长醉 提交于 2019-12-01 17:58:09
Here is my HTML structure: div{ direction: rtl; } span{ direction: ltr; } <div> <span>امروز -2</span> </div> This is expected result: As you see, - sign should come in the beginning of the number. How can I do that? Note: The direction of div should be rtl . ٍEDIT: I generate that number like this: $sums_value = sprintf("%+d",$sums_value); /* sums_value = -2 //=> -2 sums_value = 2 //=> +2 So the number has right format, but I don't know why it will be broken in the output: Since your screenshot has the "-2" in a different span element you could is the unicode-bidi option on that specific span:

Reversing Strings in Right To Left (BiDirectional) Languages in iTextSharp

浪尽此生 提交于 2019-12-01 17:51:30
问题 I'm using iTextSharp( C# iText port) to create pdfs from text/html. Most of my text is in Hebrew, a Right-To-Left language. My problem is that PDFs show RTL langauge in reverse, so I need to reverse my strings in a way that would only reverse the RTL text without reversing any numbers or text in English. It is my understanding that fribidi allows doing that on linux, but I couldn't find any solutions for this problem for Windows. I would welcome any suggestions, including an alternative to

Change direction of negative number with combination of LTR and RTL content

限于喜欢 提交于 2019-12-01 17:04:14
问题 Here is my HTML structure: div{ direction: rtl; } span{ direction: ltr; } <div> <span>امروز -2</span> </div> This is expected result: As you see, - sign should come in the beginning of the number. How can I do that? Note: The direction of div should be rtl . ٍEDIT: I generate that number like this: $sums_value = sprintf("%+d",$sums_value); /* sums_value = -2 //=> -2 sums_value = 2 //=> +2 So the number has right format, but I don't know why it will be broken in the output: 回答1: Since your

HTML5 Canvas fillText with Right-to-Left string

☆樱花仙子☆ 提交于 2019-11-30 19:17:43
I am trying to use the fillText() method on an HTML5 Canvas' 2d Context to draw a string written in Arabic. It works perfectly, until I put a punctuation mark at the end of the string. Then the punctuation mark appears on the wrong side of the string (at the beginning, rather than the end, as if it were a ltr not rtl string). I played with the Context.textAlign property, but that seems to concern only the way the string is drawn relative to the specified position, not the actual direction of the text. Does anyone know of a solution to this? Thanks. Update: The answer I found is to add a "dir"

HTML5 Canvas fillText with Right-to-Left string

情到浓时终转凉″ 提交于 2019-11-30 03:44:29
问题 I am trying to use the fillText() method on an HTML5 Canvas' 2d Context to draw a string written in Arabic. It works perfectly, until I put a punctuation mark at the end of the string. Then the punctuation mark appears on the wrong side of the string (at the beginning, rather than the end, as if it were a ltr not rtl string). I played with the Context.textAlign property, but that seems to concern only the way the string is drawn relative to the specified position, not the actual direction of

How to draw RTL text (Arabic) onto a Bitmap and have it ordered properly?

寵の児 提交于 2019-11-28 12:32:40
I'm trying to draw Arabic text onto a Bitmap for display: Bitmap img = Bitmap.createBitmap( (int) f+100, 300, Config.RGB_565); Canvas c = new Canvas(); c.setBitmap( img ); mFace = Typeface.createFromAsset(getAssets(),"DejaVuSansCondensed.ttf"); mPaint.setTypeface(mFace); content = "يجري"; content = ArabicUtilities.reshape( content ); System.out.println("Drawing text: " + content); c.drawText(content, 30, 30, mPaint); The ArabicUtilities class is a tool to reshape the unicode text so the letters are connected. see: http://github.com/agawish/Better-Arabic-Reshaper/ However, the bitmap that is

JavaScript: how to check if character is RTL?

ぐ巨炮叔叔 提交于 2019-11-28 05:05:04
How can I programmatically check if the browser treats some character as RTL in JavaScript? Maybe creating some transparent DIV and looking at where text is placed? A bit of context. Unicode 5.2 added Avestan alphabet support. So, if the browser has Unicode 5.2 support, it treats characters like U+10B00 as RTL (currently only Firefox does). Otherwise, it treats these characters as LTR, because this is the default. How do I programmatically check this? I'm writing an Avestan input script and I want to override the bidi direction if the browser is too dumb. But, if browser does support Unicode,

pyfribidi for windows or any other bidi algorithm

可紊 提交于 2019-11-28 04:52:47
问题 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. My question is, is there any Unicode bi