RTL text support, selection

General TRichView support forum. Please post your questions here
Post Reply
AlexeyT
Posts: 9
Joined: Tue Nov 13, 2007 8:04 pm
Location: Moscow
Contact:

RTL text support, selection

Post by AlexeyT »

About RTL text support.
I copy-pasted a simple Arabic string, mixed with English text. Here it is:

1999 النظم العربية المتطورة. جميعCopyright © 1999 Some text الحقوق محفوظة

Now try to select this string from left to right. The result in incorrect: some Arabic chars are drawn incorrectly (when selected).
I tried on compiled demo of RVEdit.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

To turn on support of bidirectional text, set RichViewEdit.BiDiMode = rvbdLeftToRight or rvbdRightToLeft.
AlexeyT
Posts: 9
Joined: Tue Nov 13, 2007 8:04 pm
Location: Moscow
Contact:

Post by AlexeyT »

It would be nice if I can turn this on in RVEdit demo.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You cannot do it in compiled exe, you need to recompile it for this.
AlexeyT
Posts: 9
Joined: Tue Nov 13, 2007 8:04 pm
Location: Moscow
Contact:

Post by AlexeyT »

I think you misunderstood...
In Notepad, even when I didn't check "Right-to-left reading order" (in context menu), I select Ar. string correctly.
In RView, this should be correctly too. Even without BiDiMode option.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

No, I understand you. I just said that this demo was compiled without support of bidirected text.
I compiled actiontest demo with support of bidi text: http://www.trichview.com/support/files/ ... stbidi.zip
I set RichViewEdit1.BiDiMode = rvbdLeftToRight, and added text and paragraph direction actions in Font and Paragraph menu.
AlexeyT
Posts: 9
Joined: Tue Nov 13, 2007 8:04 pm
Location: Moscow
Contact:

Post by AlexeyT »

1 Sorry, cannot paste the Unicode string (Edit - Paste Special - Unicode text) into this demo.
2 When opening "rvedit\Demo\Readme.rvf" with this demo I get:

Code: Select all

---------------------------
Error
---------------------------
Error loading file.

Possible reasons:
- format of this file is not supported by this application;
- the file is corrupted;
- the file is opened and locked by another application.
---------------------------
ÎÊ   
---------------------------
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This file does not contain enough information to be loaded in this demo.
It was saved without text and paragraph styles, so it can be opened only in application having the same collections of styles what was used when creating this file. Resaving this file in the Editor1 demo will help (this demo has dialog for RVF file saving options; options for saving styles are tuned on by default).
But be careful when loading RVF files containing "layout" information, because "layout" includes BiDiMode. If RVF file with BiDiMode=rvbdUnspecified will be loaded, RTL text will not be processed properly.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

About pasting. That demo does not use Unicode, so pasted Unicode text will be converted to ANSI.
Well, this is one more demo: http://www.trichview.com/support/files/ ... di_uni.zip
It has both bidi and Unicode support turned on.
In addition, I added a combobox on toolbar allowing to switch RichViewEdit1.BiDiMode (default text direction for the whole document).

When opening/pasting text and RTF files, all text will still be Unicode in this demo. ANSI text fragments may appear only after opening/pasting RVF files.

As you can see, Unicode+BiDi works slightly worse than ANSI+BiDi. While it is ok when using some fonts (such as "Arial Unicode MS"), for some fonts selection is not displayed correctly.
AlexeyT
Posts: 9
Joined: Tue Nov 13, 2007 8:04 pm
Location: Moscow
Contact:

Post by AlexeyT »

I confirm that the new demo works OK,
I tested on Arabic string selection. Thanx

Sergey Tkachenko wrote: As you can see, Unicode+BiDi works slightly worse than ANSI+BiDi.
I don't understand what does "ANSI+Bidi" mean.. anyway, I tested only issue with selection, it's OK
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

TRichViewEdit can work either with 1-byte (ANSI) or 2-byte (Unicode) text internally (or with mix of ANSI and Unicode text).
Even with ANSI text, you can create TRichView documents containing several languages, by specifying the proper Charset for text fragments. But you need to do it manually in the most cases.

actiontestbidi.zip was compiled to work with ANSI internally.
actiontest_bidi_uni.zip was compiled to work with Unicode internally (see http://www.trichview.com/forums/viewtopic.php?t=70 )
AlexeyT
Posts: 9
Joined: Tue Nov 13, 2007 8:04 pm
Location: Moscow
Contact:

Post by AlexeyT »

Thanx for info.
Post Reply