Bug 42578

Summary: Parentheses in RTL text (hebrew, arabic)
Product: [Unmaintained] kword Reporter: stoledo
Component: generalAssignee: Thomas Zander <zander>
Status: RESOLVED FIXED    
Severity: normal CC: zander
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description stoledo 2002-05-14 14:39:08 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kword
Version:           1.2 Beta1 (WYSIWYG) (using KDE 3.0.0 )
Severity:          normal
Installed from:    RedHat RPMs
Compiler:          gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
OS:                Linux (i686) release 2.4.18-3
OS/Compiler notes: 

In RTL text (hebrew arabic) the opening parenthesis is the right one ) and the closing one is the left one (. In most of KDE3 e.g. Kmail I get open (=right) parenthesis when I press shift-0 which is also mapped to right parenthesis in the Latin keyboard layouts. To close the parenthesis I press shift-9. This makes sense becasue on the keyboard there is only one set of parenthesis printed/engraved.

But in kword I get the opposite parenthesis so I need to press shift-9 to get the opening parenthesis which is inconsistent with the rest of KDE. Since the rest of KDE is fine I don't think that this is a keyboard layout issue (I use the israeli keyboard layout via the KDE control panel) but a unicode encoding issue. Please make this consistent thoughout KDE with preference to the way Kmail operates. 

(Submitted via bugs.kde.org)
(Called from KBugReport dialog. Fields KDE Version manually changed)
Comment 1 David Faure 2002-06-03 17:07:45 UTC
koffice/lib/kotext koparaglayout.cc1.61.7 koparaglayout.h1.61.7 kotextobject.cc1.841.85 kotextobject.h1.511.52 kotextparag.cc1.831.84 kotextview.cc1.701.71 kotextview.h1.461.47 qrichtext.cpp1.671.68
Author: faure


Modified Files:
         koparaglayout.cc koparaglayout.h kotextobject.cc
         kotextobject.h kotextparag.cc kotextview.cc kotextview.h
         qrichtext.cpp
Log Message:
Save the direction in KoParagLayout.
Ctrl+Shift/Ctrl+Right changes the paragraph direction (TODO: finish undo/redo support).
Fixed Ctrl+Backspace/Ctrl+Delete for RTL users
Fixed typing of mirrored chars (e.g. parenthesis) in RTL mode (taken from Qt)
This fixes #42578.
Comment 2 Munzir Taha 2004-05-13 00:25:11 UTC
Thanks David. It's partially fixed but has some flaws.

How to reproduce:
In kword (I have Kword 1.3 KDE 3.2)
Open a new document. The cursor will be by default to the left. Change the langugage to Arabic and open the paranthesis (the right paranthesis which is ctrl+0). It displays properly. Type any Arabic character and the paranthesis will change its direction while both everything goes now to the right. It's strange that the icon of "Align left" is still pressed while the text now is aligned right.

In kmail and konqueror (I am trying it in this text box) the situation is worse. It always type the wrong paranthesis.
I am using Mandrake 10 rpms
Comment 3 David Faure 2004-05-13 00:29:49 UTC
I think you're confusing paragraph alignment and paragraph direction?

For kmail and konqueror - this would be a Qt issue then; if Qt widgets don't react properly to RTL text input, you have to mail qt-bugs@trolltech.com explaining exactly what happens and what should happen.
Comment 4 Munzir Taha 2004-05-13 00:32:42 UTC
Is this related
http://bugs.kde.org/show_bug.cgi?id=59178
?
I don't know how to reopen the bug!!
Comment 5 David Faure 2004-05-13 09:37:24 UTC
reopening
Comment 6 stoledo 2004-05-13 11:18:46 UTC
I reported this bug, a long time ago. I think that it is indeed a Qt 
bug, and I think that Lars Knoll from Trolltech wrote to me that this 
bug is only in the X11 version of Qt, that it is there because keyboard 
drivers in X are still defective, and that they will fix this. I don't 
remember when it was supposed to be fixed, whether in 3.3 or 4 or 
whatever. Sivan

David Faure wrote:

> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>       
> http://bugs.kde.org/show_bug.cgi?id=42578      
> faure kde org changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|CLOSED                      |UNCONFIRMED
>          Resolution|FIXED                       |
> 
> 
> 
> ------- Additional Comments From faure kde org  2004-05-13 09:37 -------
> reopening
>  
>  +++++++++++++++++++++++++++++++++++++++++++
>  This Mail Was Scanned By Mail-seCure System
>  at the Tel-Aviv University CC.

Comment 7 Munzir Taha 2004-05-17 18:56:54 UTC
>I think you're confusing paragraph alignment and paragraph direction?
Can you explain the difference for me and whether me or kword is making the confusion, please david

Try this please, In kword, type C++. Now Ctrl+RightShift to change the paragraph direction(or alignment?) to the right. It's now ++C. Is this correct? If + is a weak character shouldn't it follow the previous character lang?
Comment 8 David Faure 2004-05-17 19:04:12 UTC
On Monday 17 May 2004 18:56, Muunzir Taha wrote:
> Try this please, In kword, type C++. Now Ctrl+RightShift to change the paragraph direction(or alignment?) to the right.
Direction, AFAIK.

> It's now ++C. Is this correct? If + is a weak character shouldn't it follow the previous character lang? 
I have no idea!
Either Qt does the same - and then you should talk to qt-bug or Lars,
or Qt behaves differently, and then I agree to look into it.

Test things in e.g. kmail's composer window. If things are not right there,
talk to Trolltech, not to me :)

Comment 9 Munzir Taha 2004-05-18 18:36:46 UTC
>I think you're confusing paragraph alignment and paragraph direction?
Again, can you explain the difference, if any, please

Can you also show me where is this qt-bug site? I heard they have no bugzilla system.

Also when kmail behaves differently than kword, does this mean its a kde or application issue (not a qt issue)?
Comment 10 David Faure 2004-05-18 19:47:41 UTC
On Tuesday 18 May 2004 18:36, Muunzir Taha wrote:
> >I think you're confusing paragraph alignment and paragraph direction?
> Again, can you explain the difference, if any, please
Well I'm definitely no expert on the question, but AFAIK
* the global direction of a paragraph is what you control with Ctrl+ShiftLeft/Right,
it indicates which way the text goes at the beginning of the paragraph [note that
the direction can change later on in the paragraph when mixing scripts]

* alignment can be auto, left, right, justified. Only "auto" means that it's dependent
on the direction. The other allow to set custom alignments - you can left-align a
RTL paragraph, just like you can right-align a LTR paragraph etc. (any alignment
is possible for any direction).

> Can you also show me where is this qt-bug site? I heard they have no bugzilla system.

It's no website, it's email based. You can mail qt-bugs@trolltech.com for bug reports,
provided that you give them full details about the problem.

> Also when kmail behaves differently than kword, does this mean its a kde or application issue (not a qt issue)?

KMail's composer uses the Qt widget directly. So KMail's RTL bugs are Qt's RTL bugs.
KOffice has its own code, so KWord bugs are much more probably KWord-specific.

Comment 11 Munzir Taha Obeid 2004-05-23 04:06:23 UTC
Ok Thank David I will report it to qt-bugs, but I know you love bugs ;)

What about this: Type C++ in kword. Now Ctrl+RightShift to change the paragraph direction to the right. Now Ctrl+LeftShift to revert it back to its original position. It's now C+   + instead of C++ with additional spaces between the two pluses signs (double clicking the word to select it display it properly). Now, clicking the icon for Align right will allign it to the right as C+ with only one plus sign!. This doesn't happen in kmail.
Comment 12 Munzir Taha 2004-06-25 05:20:00 UTC
> I think that Lars Knoll from Trolltech wrote to me that this
> bug is only in the X11 version of Qt, that it is there because keyboard
> drivers in X are still defective

Wow, I found something very interesting here.
My /etc/X11/xkb/symbols/ar says:
   key <AE09> { [  ], [               9,       parenleft      ]       };
   key <AE10> { [  ], [               0,       parenright    ]       };
If I switch these two options, I can solve the bug in all qt apps.
Unicode denotes the U+0028 as left parenthesis = opening parenthesis. These seems to me as a contradiction because a left parenthesis in Arabic is a closing parenthesis and hence I thought about this switch. Though this will fix qt-based applications, it won't work well with kword. Kword seems to have done its own code that reverses the situation. This code may need to be removed then.

Now, the questions are:
Do you agree with this solution or you see it as a hack?
Do this solution conform to Unicode?
Comment 13 stoledo 2004-06-25 16:04:26 UTC
This is a hack, I think. It would cause files transfered between KDE and 
other environments (Java, Win32, Mac) to reverse parantheses direction.

Muunzir Taha wrote:
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>       
> http://bugs.kde.org/show_bug.cgi?id=42578      
> munzirtaha myrealbox com changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |NEW
>       everconfirmed|0                           |1
> 
> 
> 
> ------- Additional Comments From munzirtaha newhorizons com sa  2004-06-25 05:20 -------
> 
>>I think that Lars Knoll from Trolltech wrote to me that this
>>bug is only in the X11 version of Qt, that it is there because keyboard
>>drivers in X are still defective
> 
> 
> Wow, I found something very interesting here.
> My /etc/X11/xkb/symbols/ar says:
>    key <AE09> { [  ], [               9,       parenleft      ]       };
>    key <AE10> { [  ], [               0,       parenright    ]       };
> If I switch these two options, I can solve the bug in all qt apps.
> Unicode denotes the U+0028 as left parenthesis = opening parenthesis. These seems to me as a contradiction because a left parenthesis in Arabic is a closing parenthesis and hence I thought about this switch. Though this will fix qt-based applications, it won't work well with kword. Kword seems to have done its own code that reverses the situation. This code may need to be removed then.
> 
> Now, the questions are:
> Do you agree with this solution or you see it as a hack?
> Do this solution conform to Unicode?
>  
>  +++++++++++++++++++++++++++++++++++++++++++
>  This Mail Was Scanned By Mail-seCure System
>  at the Tel-Aviv University CC.

Comment 14 Munzir Taha 2004-06-27 19:13:45 UTC
> This is a hack, I think. It would cause files transfered between KDE and 
> other environments (Java, Win32, Mac) to reverse parantheses direction.

No, i have just tested every thing is ok between linux and windows. I checked the hebrew keymap in Mandarke 10 and found it  has the same problem. The funny thing is when I checked the farsi (iran) keymap it has already implemented it properly!!
 
Comment 15 Munzir Taha 2004-07-29 15:41:31 UTC
After all the comments one get lost on where is the bug that needs to be solved. The main bug is:

KDE applications are not consistent with Qt in the typing of opening and closing parenthesis, brackets, braces, greater than and minus than signs. In kword for example they happen exactly in the reverse order. Forget about all that's said previously ;)
Comment 16 Diego Iastrubni 2004-09-23 19:33:05 UTC
I can confirm what Munzir said, all brackets are reversed. KDE 3.3.0, Kword 1.3.2.
Comment 17 Diego Iastrubni 2004-09-23 19:36:58 UTC
An example:

* type some hebrew
* open barket(shift0)
* type something: hebrew or arabic
* open barket(shift0)

this one works in QTextEdit. In Kword it does not. If you paste into kword it works. If you copy from kword into QTextEdit, it's pasted as seen on kword.
Comment 18 Thomas Zander 2006-04-13 14:15:34 UTC
Is this a duplicate of 40664?
Comment 19 Diego Iastrubni 2006-04-16 22:25:45 UTC
Definetly not. 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Comment 20 Dovix 2006-07-17 19:44:31 UTC
> ------- Additional Comment #17 From cuco 2004-09-23 19:36 -------
> An example:
> 
> * type some hebrew
> * open barket(shift0)
> * type something: hebrew or arabic
> * close barket(shift9)

This scenario is still broken (parentheses reversed) for me in some koffice apps, while it's working fine in others.

$ kword --version
Qt: 3.3.6
KDE: 3.5.3
KWord: 1.5.2

$ kpresenter --version
Qt: 3.3.6
KDE: 3.5.3
KPresenter: 1.5.2

(Mandriva Cooker)

See some screenshots here:
http://qa.mandriva.com/show_bug.cgi?id=19355

Comment 21 Thomas Zander 2007-04-03 08:56:41 UTC
Fixed in KWord2
Comment 22 Shai 2007-04-28 21:41:13 UTC
In response to Comment #21:

> Fixed in KWord2

Does this mean it's not getting fixed in Kword 1.x? Because I still see it on Debian Sid:

$ kword --version
Qt: 3.3.7
KDE: 3.5.6
KWord: 1.6.1