|
Re: Can't get Bidi to work like StyledText [message #445313 is a reply to message #445241] |
Mon, 01 November 2004 17:20 |
Eclipse User |
|
|
|
Originally posted by: felipe_heidrich.oti.com
StyledText never passes line breaks "\n" to TextLayout.
TextLayout on Windows is failing to reorder text containing "\n", pls file
a bug against SWT about this problem.
The correct reordering of string in the example is shown by StyledText.
Felipe
Randy Hudson wrote:
> I'm trying to reproduce Bidi text rendering. I can't figure out why the
> following two controls paint the same text in a different way.
> public static void main(String[] args) {
> final Display display = new Display();
> final Shell shell = new Shell(SWT.SHELL_TRIM | SWT.RIGHT_TO_LEFT);
> shell.setLayout(new GridLayout());
> final String message = "ABC 890n123 ABC def";
> StyledText text = new StyledText(shell, SWT.MULTI | SWT.BORDER |
> SWT.RIGHT_TO_LEFT);
> text.setLayoutData(new GridData(GridData.FILL_BOTH));
> text.setText(message);
> final Canvas canvas = new Canvas(shell, SWT.BORDER | SWT.RIGHT_TO_LEFT);
> canvas.setLayoutData(new GridData(GridData.FILL_BOTH));
> canvas.addPaintListener(new PaintListener() {
> public void paintControl(PaintEvent e) {
> TextLayout layout = new TextLayout(shell.getDisplay());
> layout.setWidth(shell.getClientArea().width);
> layout.setOrientation(SWT.RIGHT_TO_LEFT);
> layout.setText(message);
> layout.draw(e.gc, 0, 0);
> layout.dispose();
> }
> });
> shell.setSize(400, 300);
> shell.open();
> while (!shell.isDisposed())
> if (!display.readAndDispatch())
> display.sleep();
> }
|
|
|
Powered by
FUDForum. Page generated in 0.03400 seconds