Page 1 of 1

Text selections with Unicode BiDi

Posted: Sun Jan 08, 2012 4:57 pm
by Extorian
Hi,

When using ScaleRichviewedit (through ActionTestUni demo project) when I enter RTL text either in Arabic and make a selection, the position of the characters in the selections moves around in an odd way. Please refer to the images below


Image
This is the original Arabic text

Image
This is the same text with selection starting from extreme right of the image. The selected area is showing misplaced characters. The text at the end of the sentence is somehow appearing at the start of the selection.

I am using Delphi XE2 on Windows Vista.

I would appreciate your assistance to solve this problem.

Kind regards,

Extorian



[/img]

Posted: Sun Jan 08, 2012 6:00 pm
by Sergey Tkachenko
Assign SRichViewEdit1.BiDiMode = rvbdLeftToRight (or rvbdRightToLeft).

Also, in this demo, in the procedure TForm3.AddEditor, assign srve.BiDiMode as well (this procedure is called when a new tab is open).

Additionally, value of BiDiMode may be stored in RVF files, so, when RVF file is loaded, value of BiDiMode may be reset. In this demo, in TForm3.OnOpenEditor, add:

Code: Select all

if ActiveEditor.RichViewEdit.BiDiMode = rvbdUnspecified then
  ActiveEditor.BiDiMode := rvbdLeftToRight;
after the line

Code: Select all

  srvActionsResource.rvActionOpen1.ExecuteTarget(ActiveEditor.RichViewEdit);

Posted: Mon Jan 09, 2012 4:15 am
by Extorian
Thank you Sergey, it works fine now.