Community
Participate
Working Groups
Created attachment 246513 [details] Program that illustrates the problem. The method "Rectangle getLineBounds(int lineIndex) on TextLayout is supposed to return the bounding box for the given line of text. It works correctly when the orientation is set to SWT.LEFT_TO_RIGHT. When the orientation is set to SWT.RIGHT_TO_LEFT, however, the returned bounding box is flipped from the displayed text for SWT.LEFT or SWT.RIGHT alignment. I have attached a sample program that exhibits the problem. It renders text using a TextLayout and draws a rectangle on the bounds of each line. There is a check box that flips the LEFT_TO_RIGHT/RIGHT_TO_LEFT setting. To repeat, compile and run the program then select the "RTL" check box. Notice that the bounding box for each line has the wrong alignment. I believe that the problem is in the getLineBounds method itself. Removing the following lines from that method appears to fix the problem: if (OS.pango_context_get_base_dir(context) == OS.PANGO_DIRECTION_RTL) { x = width() - x - width; } Jim Mayer
I can reproduce the issue on SWT master as of today.
New Gerrit change created: https://git.eclipse.org/r/127589
Gerrit change https://git.eclipse.org/r/127589 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=23d65c30e28bf3ac50666f5d621156cd02248454
(In reply to Eclipse Genie from comment #3) > Gerrit change https://git.eclipse.org/r/127589 was merged to [master]. > Commit: > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/ > ?id=23d65c30e28bf3ac50666f5d621156cd02248454 Patch is in master, thanks Xi.
Verified in I20180821-2000.