Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337354

Summary: org.eclipse.java2d.label broken in bidi when text string has embedded brackets
Product: [Eclipse Project] Platform Reporter: Michael R Cooper <coopermr>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe
Version: 4.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Michael R Cooper CLA 2011-02-16 15:19:59 EST
Build Identifier: 3.6.2

code sample here:

public class PrimaryView extends ViewPart {
	private Button clickMeButton;
	
	public PrimaryView() {
		super();
	}

	public void createPartControl(final Composite parent)
	{
		
	    Canvas canvas = new Canvas(parent, SWT.NULL);
	    
	    LightweightSystem lws = new LightweightSystem(canvas);
	    
	    Label lb = new Label();
	    lb.setText("[this is a test of bracket]Is this BIDI enabled");
	    lws.setContents(lb);


		
	}

	public void setFocus() {
	}

}

the output will look like this when in bidi:

... is a test of bracket]Is this BIDI enabled]





Reproducible: Always

Steps to Reproduce:
1.build the code snippet
2.put in bidi env
3.run snippet
Comment 1 Felipe Heidrich CLA 2011-02-16 17:09:06 EST
That is the correct bidi reordering.
Comment 2 Michael R Cooper CLA 2011-02-16 17:25:47 EST
expecting:

[... is a test of bracket]Is this BIDI enabled

not

... is a test of bracket]Is this BIDI enabled]


The error we have in our product using eclipse is:

NON-BIDI
[Deprecated]Use Browser URL

BIDI
Deprecated]Use Browser URL]


That is incorrect - the only thing that should be done is the whole text string should just get right justified.
Comment 3 Felipe Heidrich CLA 2011-02-17 09:43:38 EST
Please read 
http://www.unicode.org/reports/tr9/

You can use the TextProcessor to solve your problem:
http://wiki.eclipse.org/New_Bidi_APIs