Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 129908 - BIDI: Output text have contextual order layout
Summary: BIDI: Output text have contextual order layout
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-01 05:00 EST by amir CLA
Modified: 2006-05-07 09:40 EDT (History)
5 users (show)

See Also:


Attachments
screen shot of Console with mixed BiDi characters (18.30 KB, image/pjpeg)
2006-03-01 18:04 EST, Karice McIntyre CLA
no flags Details
Screen shot of console with mixed BIDI and Latin text (98.08 KB, image/png)
2006-03-02 06:30 EST, amir CLA
no flags Details
Mac Screen Shot (88.81 KB, image/png)
2006-03-02 10:05 EST, Kevin Barnes CLA
no flags Details
linux (147.71 KB, image/png)
2006-03-02 11:03 EST, Kevin Barnes CLA
no flags Details
test case (653 bytes, text/plain)
2006-03-06 18:09 EST, Kevin Barnes CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description amir CLA 2006-03-01 05:00:19 EST
Scenario:

1. Create a java project
2. Create a java class. Make sure that you enter the com.ibm.dbcstesting.javatest for the package name and you select the inclusion of main() in the wizard.
3. In Main method on the Editor, type the following code line:
System.out.println(" ABCabc ");
where capitals are Hebrew characters.
4. Run as Java application.

Result: The string is displayed on console as: "abcABC"

Expected result: The output of the string should be as shown in the editor and shouldn't have contextual ordering.
Comment 1 Dani Megert CLA 2006-03-01 05:08:40 EST
That's the console.
Comment 2 Kevin Barnes CLA 2006-03-01 10:10:10 EST
There are no hebrew speakers on the debug team. Could you please provide a test case (java class) and a screen shot of the result you are getting.
What is your default encoding?
Comment 3 Kevin Barnes CLA 2006-03-01 17:29:18 EST
Running this code, you'll see that the console shows the same thing as Swing's JOptionPane.
		String s = "\u05D2"+"\u05D2"+"\u05D2"+"\u05D1"+"\u05D0";
		System.out.println(s);
		JOptionPane.showConfirmDialog(null, s);

What is the expected behaviour here?
Comment 4 Karice McIntyre CLA 2006-03-01 18:03:27 EST
Kevin, your test string contains only Hebrew characters.  I think your test string should have mixed BiDi and Latin characters e.g.  
String s = "\u05D3\u05D2\u05D1" + "abc";
I tried this example in M5 and it rendered in the Console as I would expect.  I will attach a pic.  

Amir, what is the build id you are using (in the About dialog)?  Can you attach a screen shot?
Comment 5 Karice McIntyre CLA 2006-03-01 18:04:06 EST
Created attachment 35579 [details]
screen shot of Console with mixed BiDi characters
Comment 6 Dani Megert CLA 2006-03-02 02:17:12 EST
Kevin, I guess you'll need a BidiSegmentListener similar as it is used in the JDISourceViewer or the JavaSourceViewer. However, make sure this is only applied to things where you show programming code, like Java.

HTH
Dani
Comment 7 amir CLA 2006-03-02 06:28:03 EST
Build id: I20051215-1506

Please note that this defect is refer only for Linux platform.

When I'm running the same code that Karice had running, I get different result (contextual ordering).
I will attach a screen shot.

Comment 8 amir CLA 2006-03-02 06:30:04 EST
Created attachment 35600 [details]
Screen shot of console with mixed BIDI and Latin text
Comment 9 Karice McIntyre CLA 2006-03-02 09:46:03 EST
I was using windows - didn't notice it was platform-specific.
Comment 10 Kevin Barnes CLA 2006-03-02 10:05:44 EST
Created attachment 35612 [details]
Mac Screen Shot

Seems fine on Mac too. Will test linux this afternoon.
Comment 11 Kevin Barnes CLA 2006-03-02 11:03:20 EST
Created attachment 35616 [details]
linux

Looks good on my linux box also.
Comment 12 Karice McIntyre CLA 2006-03-02 11:15:28 EST
Hmm, not sure if this would make a difference for the Console, but what Linux is Amir using - Motif? GTK? what version/update is it?
Comment 13 amir CLA 2006-03-02 11:38:10 EST
I'm using GTK version 2.4.0
Comment 14 Kevin Barnes CLA 2006-03-06 17:44:04 EST
I'm running on an older GTK version (2.2.4). We tested this on a new version of GTK (2.6) and got the same incorrect behavior that Amir is seeing on 2.4.
Comment 15 Kevin Barnes CLA 2006-03-06 18:09:36 EST
Created attachment 35796 [details]
test case
Comment 16 Kevin Barnes CLA 2006-03-06 18:24:00 EST
Comment on attachment 35796 [details]
test case

This is reproducible with an SWT StyledText widget. 

On GTK 2.2 the Text displays "XXXabc" and on GTK 2.6 it displays "abcXXX"
Comment 17 Kevin Barnes CLA 2006-03-06 18:29:36 EST
reassigning to SWT for comment
Comment 18 Steve Northover CLA 2006-03-07 11:32:35 EST
FH?  Your thoughts?
Comment 19 Felipe Heidrich CLA 2006-03-07 18:14:49 EST
fixed in head > 20060307

the base_dir in pango 1.2 is PANGO_DIRECTION_LTR, in pango 1.4 they changed to PANGO_DIRECTION_WEAK_LTR and added the pango_layout_set_auto_dir(). To understand this problem read the for pango_layout_set_auto_dir().

SWT by design is (strong) left-to-right, to draw text with base_dir==RTL one needs to create a Canvas with SWT.RIGHT_TO_LEFT, create a TextLayout and call setOrientation() with SWT.RIGHT_TO_LEFT.

Please, verify the fix. thank you.
Comment 20 amir CLA 2006-03-20 10:18:44 EST
Verified with build id: I20060315-1200
Comment 21 amir CLA 2006-05-07 09:40:19 EDT
The problem has been fixed.