Inserting Zero Width Joiner control character ZWJ (#$200D)

General TRichView support forum. Please post your questions here
Post Reply
rvuser1719
Posts: 4
Joined: Fri Aug 17, 2007 5:17 pm

Inserting Zero Width Joiner control character ZWJ (#$200D)

Post by rvuser1719 »

Dear Sergey,

the Zero Width Joiner (ZWJ = #$200D = #8205) does not work.

As example,

if I enter this sequence

क + ् + #8205

then the result must be

क्‍

But it looks like the control character gets lost in the editor so the result is just this:

क्

What I do in the program is:

procedure InsertZWJ(View: TRichViewEdit);
var
wcZWJ: WideString;
begin
wcZWJ := 'क' + '्' + #8205;
View.InsertTextW(wcZWJ, False);
end;


Would you like to suggest a solution for this problem?

Thank you.
Wadim
Sergey Tkachenko
Site Admin
Posts: 17572
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Will be fixed in the next update.
But should not it be inserted BETWEEN the characters to join?
rvuser1719
Posts: 4
Joined: Fri Aug 17, 2007 5:17 pm

Post by rvuser1719 »

Sergey Tkachenko wrote:Will be fixed in the next update.
Thank you. When do you plan to release the next update?
Sergey Tkachenko wrote:But should not it be inserted BETWEEN the characters to join?
You are right, it usually should be inserted between characters to prevent the building complex conjuncts like this one

क् + ष = क्ष

But using ZWJ we get another result

क् + ZWJ + ष = क्‍ष

It is very important for complex Unicode scripts like Indic Devanagari ...

There are also other special (control) characters which are very important too, as example ZWNJ (#8204, Zero Width Non-Joiner)

क् + ZWNJ + ष = क्‌ष

Wadim
Sergey Tkachenko
Site Admin
Posts: 17572
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

ZWJ was mistakenly removed from text before drawing it. Fixed version will be available for registered users later this week.
rvuser1719
Posts: 4
Joined: Fri Aug 17, 2007 5:17 pm

Post by rvuser1719 »

Sergey Tkachenko wrote:Fixed version will be available for registered users later this week.
Thanks a lot!

Wadim
Sergey Tkachenko
Site Admin
Posts: 17572
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Uploaded.
rvuser1719
Posts: 4
Joined: Fri Aug 17, 2007 5:17 pm

Post by rvuser1719 »

Sergey Tkachenko wrote:Uploaded.
This is just to confirm that it is perfectly working now. THANK YOU!
Wadim
mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

Post by mohsen24000 »

dose "no-width non break character" support in trichview?
such as MSWord in RTL language as persian, arabic, etc.
mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

Post by mohsen24000 »

when use:
rve.add(str+widechar($AD)+str);
or
rve.add(str+widechar($200D)+str);
and then save it to RTF file. in MSWord it's worked and shown, but dose'nt show in richviewedit!
please help me for this problem.
my richedit's version is 12
Sergey Tkachenko
Site Admin
Posts: 17572
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

There is no special support for this character, but it should work automatically.
What's you version of Delphi?
mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

Post by mohsen24000 »

thanks dear.
my delphi version is 2010.
Sergey Tkachenko
Site Admin
Posts: 17572
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I made the following test: I copied the second post of rvuser1719 (the post containing examples using #$200D) and pasted it as a plain Unicode text in the ActionTest demo (a demo available on the web site, compiled using Delphi XE2 and the latest TRichView version).

The results look like expected: like they are displayed in a browser. I tried Arial and Times New Roman fonts.

If you have problems, please create a simple demo project and send it to me (richviewgmailcom).
mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

Post by mohsen24000 »

hi dear sergey.
i resolve it!
before loading rtf file, i replace \zwnj that deleted in richview with \-
and after loading in richview replace it with #$200F and problem fix...

Code: Select all

sRTF:=Tstringlist.Create;
sRTF.LoadFromFile('d:\sample\doc1.rtf');
//sRTF.Text:=Replace(sRTF.Text,'\zwnj',' ');
sRTF.Text:=Replace(sRTF.Text,'\zwnj','\-');
sRTF.SaveToFile('d:\sample\doc1_tmp.rtf');

Code: Select all

rv.BeginUpdate;
RVSetLinearCaretPos(rv,0);
ft := #173; rt:= #$200F;
while rv.SearchText(ft,[rvseoDown]) do
rv.InsertText(rt,False);
RVSetLinearCaretPos(rv,0);
rv.EndUpdate;
Sergey Tkachenko
Site Admin
Posts: 17572
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Are you sure that you need zero width JOINER? As I understand from your samples, you need to prevent text from joining. So you should use zero width NON-JOINER ($200C)
Post Reply