Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 92825 - GC.drawString() clips text incorrectly in mirrored mode
Summary: GC.drawString() clips text incorrectly in mirrored mode
Status: RESOLVED DUPLICATE of bug 67652
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-26 16:06 EDT by Pratik Shah CLA
Modified: 2005-05-09 15:33 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pratik Shah CLA 2005-04-26 16:06:40 EDT
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.
Comment 1 Felipe Heidrich CLA 2005-04-27 13:25:00 EDT
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 ***
Comment 2 Randy Hudson CLA 2005-04-27 14:31:56 EDT
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()).
Comment 3 Felipe Heidrich CLA 2005-05-09 15:32:41 EDT
reopen (in order to close it again)
Comment 4 Felipe Heidrich CLA 2005-05-09 15:33:02 EDT

*** This bug has been marked as a duplicate of 67652 ***