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

Bug 124021

Summary: [Graphics] TextLayout reports incorrect offset and trailing
Product: [Eclipse Project] Platform Reporter: Randy Hudson <hudsonr>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: eclipse.felipe, heath.borders, niraj.modi, ppshah
Version: 3.2Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Randy Hudson CLA 2006-01-16 14:46:31 EST
TextLayout layout = new TextLayout(null);
layout.setText("\u0634");
System.out.println(layout.getOffset(new Point(0,0), new int[1]));

The above code constructs a string consisting of 1 Arabic character. The API test simulates clicking on the trailing side of the char (non-mirrored scenario). The expected result is 0, with trailing of {1}. Instead 1, {0} is returned.
Comment 1 Randy Hudson CLA 2006-01-16 14:55:25 EST
the point (-1, 0) also returns unexpected results. Since the text layout is LTR, anything to the left of the origin should return offset 0, right?

Another test case (clicking beyond the end of the "line"):
layout.setText("a\u0634");
int trailing[] = new int[1];
System.out.println(layout.getOffset(new Point(100,0),
    trailing) + "{" + trailing[0] + "}");

In this test case, the expected result is 2{1}, instead 1{0} is returned.
Comment 2 Steve Northover CLA 2006-01-16 17:06:55 EST
Is it the old Microsoft off by one bug in RTL?
Comment 3 Felipe Heidrich CLA 2009-08-20 09:39:04 EDT
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
Comment 4 Eclipse Genie CLA 2020-06-04 13:50:34 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.