Community
Participate
Working Groups
Code snippet showing the problem: Display d = new Display(); Shell shell = new Shell(d, SWT.RIGHT_TO_LEFT | SWT.SHELL_TRIM); final String s = "org.eclipse.gef"; Canvas canvas = new Canvas(shell, SWT.NONE); canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.drawString(s, 0, 0); } }); GC gc = new GC(shell); Point p = gc.stringExtent(s); canvas.setBounds(0, 0, p.x, p.y); gc.dispose(); shell.open(); while (!shell.isDisposed()) while (!d.readAndDispatch()) d.sleep(); If you don't specify the SWT.RTL style in the Shell's constructor, there are no problems. I could reproduce this problem only with certain fonts. On my computer, the Canvas's default font is Tahoma, 8.
Can you can use drawText instead ? In Bidi more, some GC calls will draw at x=1 when the app set x=0. Bug in the OS I think. *** This bug has been marked as a duplicate of 37427 ***
drawText is slower than drawString, isn't it? We may have to use TextLayout *all* the time due to inconsistencies in character width for chinese characters (TextLayout.getLocation() vs. GC.stringExtent()).
reopen (in order to close it again)
*** This bug has been marked as a duplicate of 67652 ***