The problem, as some of you might have guessed, is the direction switching. Given an application like MS Word, my keyboard correctly sends the characters, and Word gives them the right form. But sometimes some characters (mainly the “shared” chars), and often the blinking caret appear on the wrong side of the line.

 

What can be done to make the shared characters (Like “!”) to appear on the correct side? The caret problem can be fixed with Word’s RTL command. But mixing English and Persian letters in the same line often leads to unpredictable outcomes. 

The rule of the thumb is, use RTL paragraphs when writing Persian text (which might contain English text within it) and use LTR when writing English text (which might contain Persian text within it.)

Is there an algorithm governing these situations that I can use to modify the output to remedy this?  

There is an algorithm called Unicode BiDirectional Algorithm, the details of which is avaibale on Unicode.org.  As you might have guessed, Word doesn't provide a correct implementation of this algorithm (nor do any other text editors that I know of to this date.)  There's a library being developed called FriBidi, of which Behdad is the project maintainer, IIRC, which might help you, but not with Word probably.  I guess Behdad would be able to make profound comments on this.

_______________________________________________
PersianComputing mailing list
PersianComputing@lists.sharif.edu
http://lists.sharif.edu/mailman/listinfo/persiancomputing

Reply via email to