Bug 222582 - [Perspectives] BIDI3.4:HCG Wrong caption alignment in Customize Perspecitve dialog with Hebrew translation
Summary: [Perspectives] BIDI3.4:HCG Wrong caption alignment in Customize Perspecitve d...
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: 3.4 RC1   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 226830 226831 (view as bug list)
Depends on:
Blocks: 226830
  Show dependency tree
 
Reported: 2008-03-13 10:48 EDT by Helena Halperin CLA
Modified: 2008-05-26 12:50 EDT (History)
8 users (show)

See Also:
gheorghe: review+


Attachments
incorrect alignment of caption and text (54.72 KB, image/jpeg)
2008-03-13 10:48 EDT, Helena Halperin CLA
no flags Details
Customize Perpsective dialog (30.30 KB, image/png)
2008-04-22 14:18 EDT, Paul Webster CLA
no flags Details
CP dialog with the NL pack (13.90 KB, image/png)
2008-04-23 08:48 EDT, Paul Webster CLA
no flags Details
CP dialog with \u200E (13.87 KB, image/png)
2008-04-23 11:44 EDT, Paul Webster CLA
no flags Details
Colon in a wrong place (285.89 KB, image/png)
2008-04-23 12:01 EDT, Szymon Brandys CLA
no flags Details
With SWT.NONE instead of SWT.WRAP (13.88 KB, image/png)
2008-04-24 12:10 EDT, Paul Webster CLA
no flags Details
Customize Perpsective dialog I20080516-1333 (41.21 KB, image/png)
2008-05-20 11:08 EDT, Paul Webster CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Helena Halperin CLA 2008-03-13 10:48:23 EDT
Created attachment 92442 [details]
incorrect alignment of caption and text

Run Eclipse with Hebrew translation.

1. Install:  - Eclipse Base Platform Runtime eclipse-RCP-3.4M5-linux-gtk.tar.gz 
             - NLpackBidi-eclipse-RCP-3.4M5-linux-gtk.zip 
             - Eclipse IDE Platform Runtime eclipse-platform-3.4M5-linux-gtk.tar.gz 
             - NLpackBidi-eclipse-platform-3.4M5-linux-gtk.zip
             - JDT Runtime eclipse-JDT-3.4M5.zip 
             - NLpackBidi-eclipse-JDT-3.4M5.zip   
2. Set default locale to Hebrew
3. Run Eclipse with command line including following argument -nl iw
4. Open Resource perspective.
5. Right click on "Resource" and choose "Customize..." (in Hebrew).
6. Inspect the opened view.

Expected result: captions "Submenus:" and "Shortcuts" (in Hebrew) are right aligned, description text is right aligned.

Actual result: captions "Submenus:" and "Shortcuts" (in Hebrew) are left aligned, description text is left aligned.
Comment 1 Paul Webster CLA 2008-04-22 08:57:20 EDT
Tod, Don't they need to run with -rtl as well?

When I run with -rtl the red-circled captions are right-aligned.

PW
Comment 2 Paul Webster CLA 2008-04-22 09:01:57 EDT
We're probably missing a getDefaultOrientation() in the CP dialog.

PW
Comment 3 Paul Webster CLA 2008-04-22 14:18:09 EDT
Created attachment 97063 [details]
Customize Perpsective dialog

On investigation, it appears that the dialog is correct using -nl iw *without* the NL pack, even on 3.4M5.  I'll get the NL pack and re-run my tests tomorrow.

PW
Comment 4 Paul Webster CLA 2008-04-23 08:48:58 EDT
Created attachment 97211 [details]
CP dialog with the NL pack

OK, it is incorrect with the bidi NL pack ... does that mean that there are incorrect characters imbedded in the properties file?

I'll try and dig them up.

PW
Comment 5 Paul Webster CLA 2008-04-23 08:55:16 EDT
ActionSetSelection_availableMenus=&\u05EA\u05EA-\u05EA\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD\:
ActionSetSelection_menuItems=\u05E7&\u05D9\u05E6\u05D5\u05E8\u05D9 \u05D3\u05E8\u05DA\:

Comment 6 Paul Webster CLA 2008-04-23 09:53:40 EDT
I've tried removing the chars &, -, and \: and it made no  difference.

But if I simply change it to ShortCuts, it is right-aligned.

Tod, should I send this to SWT?

PW
Comment 7 Tod Creasey CLA 2008-04-23 10:14:16 EDT
Yes you should.
Comment 8 Felipe Heidrich CLA 2008-04-23 11:16:48 EDT
I think I understand this problem.

This happens because on GTK the default paragraph direction is not determine by the presence of SWT.RIGHT_TO_LEFT but by orientation of the first strong characters in the text of the control.

Paul, can you try to add '\u200E' as the first character for that label?
Something like:

ActionSetSelection_availableMenus=\u200E&\u05EA\u05EA-\u05EA\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD\:
ActionSetSelection_menuItems=\u200E\u05E7&\u05D9\u05E6\u05D5\u05E8\u05D9
\u05D3\u05E8\u05DA\:

Does that fix the problem?

Instead of '\u200E' you could use 'a' or whatever latin letter or strong LTR character.
Comment 9 Paul Webster CLA 2008-04-23 11:44:08 EDT
Created attachment 97249 [details]
CP dialog with \u200E

That corrected the alignment.

PW
Comment 10 Felipe Heidrich CLA 2008-04-23 11:55:53 EDT
(In reply to comment #9)
> CP dialog with \u200E
> That corrected the alignment.

Yes, but it broke the reading order, the collon is on the wrong place (before the first char, it should be after the last).
Comment 11 Szymon Brandys CLA 2008-04-23 12:01:27 EDT
Created attachment 97253 [details]
Colon in a wrong place

(In reply to comment #10)
Comment 12 Felipe Heidrich CLA 2008-04-23 12:22:15 EDT
I need to know this:
Are you use a Label or a READ_ONLY Text widget in the dialog ?
Comment 13 Paul Webster CLA 2008-04-23 13:01:45 EDT
The fields in the CustomizePerspectiveDialog are labels, built like:
        SashForm sashComposite = new SashForm(menusComposite, SWT.HORIZONTAL);
....
        Composite menusGroup = new Composite(sashComposite, SWT.NONE);
....
        label = new Label(menuItemsGroup, SWT.WRAP);
        label.setText(WorkbenchMessages.ActionSetSelection_menuItems);
        label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

PW
Comment 14 Felipe Heidrich CLA 2008-04-24 11:40:33 EDT
Remove SWT.WRAP, does that fix the problem ?
For example:
label = new Label(menuItemsGroup, SWT.NONE);


If so, I can say I know what is going on.
When WRAP is on GtkLabel sets the width inside its PangoLayout causing it to align the text based in the first strong character in the text.

I believe I can write a small c program that shows this problem. This is GTK internals I don't think we can fixed. We would need API from GTK to fix this.
Comment 15 Paul Webster CLA 2008-04-24 12:10:25 EDT
Created attachment 97482 [details]
With SWT.NONE instead of SWT.WRAP

Without SWT.WRAP the labels look correct to me.

PW
Comment 16 Felipe Heidrich CLA 2008-04-24 13:55:29 EDT
(In reply to comment #15)
> Without SWT.WRAP the labels look correct to me.
Thanks Paul
That looks correct to me too.
Comment 17 Steve Northover CLA 2008-04-29 18:22:44 EDT
Under consideration for 3.4.  There is a bug in GTK that we are attempting to work around and Felipe tell me it "looks good".
Comment 18 Tomer Mahlin CLA 2008-05-04 04:18:12 EDT
The image attached in comment 15 indeed shows correctly aligned labels.
Comment 19 Felipe Heidrich CLA 2008-05-05 12:53:15 EDT
Fixed in HEAD > 20080505
Comment 20 Helena Halperin CLA 2008-05-20 05:34:46 EDT
Still reproducible in integration build I20080517
Comment 21 Paul Webster CLA 2008-05-20 11:08:37 EDT
Created attachment 101062 [details]
Customize Perpsective dialog I20080516-1333

I tested RC1 with the M5 NL pack.  Is this not the correct alignment? 

PW
Comment 22 Felipe Heidrich CLA 2008-05-20 11:49:30 EDT
(In reply to comment #20)
> Still reproducible in integration build I20080517

Are you testing on a Solaris machine ? or on a 64 bits machine ?
What version of GTK are you runnign ?
Can you try on Eclipse 3.4 RC1?
Comment 23 Bogdan Gheorghe CLA 2008-05-20 14:49:41 EDT
I believe Helena was using an internal build to test that was not based on RC1. Closing as WORKSFORME.
Comment 24 Felipe Heidrich CLA 2008-05-20 15:33:05 EDT
*** Bug 226830 has been marked as a duplicate of this bug. ***
Comment 25 Helena Halperin CLA 2008-05-21 04:01:40 EDT
Verified in build I20080520-1149
Comment 26 Felipe Heidrich CLA 2008-05-26 12:50:51 EDT
*** Bug 226831 has been marked as a duplicate of this bug. ***