Possible Hebrew RTL word order bug

General TRichView support forum. Please post your questions here
Post Reply
jgkoehn
Posts: 303
Joined: Thu Feb 20, 2020 9:32 pm

Possible Hebrew RTL word order bug

Post by jgkoehn »

Greetings Sergey,
Here is a possible bug a co-worker found in regards to Hebrew and English mixed.
The letters are in correct order. However, the Hebrew word order gets changed around when loading into RVF.
The Hebrew words are in red. Please see the attached .rtf and .pdf
Attachments
HebrewTest.pdf
(93.38 KiB) Downloaded 1248 times
HebrewTest.rtf
(886 Bytes) Downloaded 1351 times
JG
Posts: 11
Joined: Tue Nov 30, 2010 11:48 am

Re: Possible Hebrew RTL word order bug

Post by JG »

I just wanted to clarify with a screenshot. Top is the file in Wordpad, and showing the correct word order of the two words.
Thanks, Jon.
Hebrew word order.png
Hebrew word order.png (72.05 KiB) Viewed 23331 times
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Possible Hebrew RTL word order bug

Post by Sergey Tkachenko »

I modified the code to improve arrangement of items in bi-directional text:
bidi.png
bidi.png (23.25 KiB) Viewed 23320 times
Please note that the code that arranges items is activated only if you assign RichViewEdit.BiDiMode = rvbdLeftToRight or rvbdRightToLeft.
Since the main text direction in your document is LTR, assign RichViewEdit.BiDiMode = rvbdLeftToRight.
Do it before loading RTF (because text and paragraph direction properties are not read from RTF if RichViewEdit.BiDiMode = rvbdUnspecified).

If you are a registered TRichView user, I can send a changed unit for you for testing. If not, please wait for the next TRichView update.
jgkoehn
Posts: 303
Joined: Thu Feb 20, 2020 9:32 pm

Re: Possible Hebrew RTL word order bug

Post by jgkoehn »

Thank, I will check. I May have accidentally turned that off in fixing something else. Appreciate it Sergey!
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Possible Hebrew RTL word order bug

Post by Sergey Tkachenko »

RichViewEdit.BiDiMode = rvbdUnspecified by default, so you need to assign rvbdLeftToRight explicitly.

Unfortunately, in the current version, it does not help in this document. The problem is in the space character between these two Hebrew words. This character is a separate item not marked as RTL text, so TRichView treats it as LTR text, and arranges text as on your screenshot.
I made corrections to take surrounding text into account, so it will work better in the next update.

In the current version, minor modification of this document can help:
- You can delete this space character between Hebrew words and type a new space character. The words will be combined in a single item which must be displayed correctly.
- Or you can select it and apply RTL direction. In RichViewActions, you can use TrvActionTextRTL (RichViewActions include bi-di actions: TrvActionTextRTL, TrvActionTextLTR, TrvActionParaRTL, TrvActionParaLTR, but in ActionTest demos they are not assigned to menu items or toolbar buttons).
jgkoehn
Posts: 303
Joined: Thu Feb 20, 2020 9:32 pm

Re: Possible Hebrew RTL word order bug

Post by jgkoehn »

Greetings Sergey,
For me changing that to LTR seems to have fixed it.
Post Reply