Page 1 of 1
Possible Hebrew RTL word order bug
Posted: Fri Mar 27, 2020 9:39 pm
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
Re: Possible Hebrew RTL word order bug
Posted: Sun Mar 29, 2020 9:06 am
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 (72.05 KiB) Viewed 23358 times
Re: Possible Hebrew RTL word order bug
Posted: Sun Mar 29, 2020 8:15 pm
by Sergey Tkachenko
I modified the code to improve arrangement of items in bi-directional text:
- bidi.png (23.25 KiB) Viewed 23347 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.
Re: Possible Hebrew RTL word order bug
Posted: Sun Mar 29, 2020 8:27 pm
by jgkoehn
Thank, I will check. I May have accidentally turned that off in fixing something else. Appreciate it Sergey!
Re: Possible Hebrew RTL word order bug
Posted: Sun Mar 29, 2020 8:45 pm
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).
Re: Possible Hebrew RTL word order bug
Posted: Sun Mar 29, 2020 9:34 pm
by jgkoehn
Greetings Sergey,
For me changing that to LTR seems to have fixed it.