Page 1 of 1
RTL text support, selection
Posted: Tue Nov 13, 2007 9:26 pm
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.
Posted: Wed Nov 14, 2007 8:50 am
by Sergey Tkachenko
To turn on support of bidirectional text, set RichViewEdit.BiDiMode = rvbdLeftToRight or rvbdRightToLeft.
Posted: Wed Nov 14, 2007 1:04 pm
by AlexeyT
It would be nice if I can turn this on in RVEdit demo.
Posted: Wed Nov 14, 2007 1:22 pm
by Sergey Tkachenko
You cannot do it in compiled exe, you need to recompile it for this.
Posted: Wed Nov 14, 2007 1:38 pm
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.
Posted: Wed Nov 14, 2007 3:51 pm
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.
Posted: Wed Nov 14, 2007 5:32 pm
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.
---------------------------
ÎÊ
---------------------------
Posted: Thu Nov 15, 2007 6:35 am
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.
Posted: Thu Nov 15, 2007 7:05 am
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.
Posted: Thu Nov 15, 2007 10:33 am
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
Posted: Thu Nov 15, 2007 3:49 pm
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 )
Posted: Thu Nov 15, 2007 5:54 pm
by AlexeyT
Thanx for info.