Text selections with Unicode BiDi

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
Extorian
Posts: 24
Joined: Wed Dec 28, 2011 3:52 pm

Text selections with Unicode BiDi

Post 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]
Sergey Tkachenko
Site Admin
Posts: 17267
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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);
Extorian
Posts: 24
Joined: Wed Dec 28, 2011 3:52 pm

Post by Extorian »

Thank you Sergey, it works fine now.
Post Reply