Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 321607 - Some characters are not displayed correctly if antialias or alpha enabled
Summary: Some characters are not displayed correctly if antialias or alpha enabled
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows 7
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-03 10:59 EDT by Alexandr CLA
Modified: 2021-11-06 07:14 EDT (History)
3 users (show)

See Also:


Attachments
Class for reproducing bug (1.29 KB, application/octet-stream)
2010-08-03 10:59 EDT, Alexandr CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandr CLA 2010-08-03 10:59:39 EDT
Created attachment 175785 [details]
Class for reproducing bug

I have a problem with drawing some UTF symbols (for example 'ߐ') using draw2d when I am using antialias or alpha .
I am attaching class that can reproduce it is behaviour.

For reproducing you must uncomment one of lines in the method BadTest::paintFigure
Comment 1 Alexandr CLA 2010-08-04 05:54:39 EDT
Table with characters that not displayed - http://en.wikipedia.org/wiki/N%27Ko
Comment 2 Felipe Heidrich CLA 2010-08-04 12:08:05 EDT
Does the problem happen with this snippet: 
	public static void main(String args[]) {
		Display d = new Display();
		Shell shell = new Shell(d);
		shell.setSize(500, 500);
		shell.addListener(SWT.Paint, new Listener() {
			public void handleEvent(Event e) {
				TextLayout layout = new TextLayout(e.display);
				//U+07C0 to U+07FA 
				layout.setText("Magic Symbol - \u07d0");
				layout.draw(e.gc, 10, 10);
				e.gc.setAlpha(127);
				layout.draw(e.gc, 10, 50);
				layout.dispose();
			}
		});
		shell.open();
		while (!shell.isDisposed()) {
			if (!d.readAndDispatch())
				d.sleep();
		}
		d.dispose();
	}


setAlpha/setTextAntialias/etc causes the TextLayout to draw text using GPI+, it is possible that your system does not have a font compatible with GDI+ that supports N'Ko script.
Comment 3 Felipe Heidrich CLA 2010-08-04 15:21:08 EDT
I see the problem happens on GC#drawText() (TextLayout is fine)

public static void main335 (String[] args) {
	Display d = new Display();
    Shell shell = new Shell(d);
    shell.setSize(500, 500);
    shell.addListener(SWT.Paint, new Listener() {
        public void handleEvent(Event e) {
            TextLayout layout = new TextLayout(e.display);
            //U+07C0 to U+07FA 
            layout.setText("Magic Symbol - \u07d0");
            layout.draw(e.gc, 10, 10);
            e.gc.drawText("Magic Symbol - \u07d0", 160, 10);
            e.gc.setAlpha(127);
            layout.draw(e.gc, 10, 50);
            e.gc.drawText("Magic Symbol - \u07d0", 160, 50);
            layout.dispose();
        }
    });
    shell.open();
    while (!shell.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.dispose();
}

When Advance is true, TextLayout draws with Graphics_DrawDriverString (the glyphs are get using ScriptShape()) and GC draw with Graphics_DrawString
Comment 4 Alexandr CLA 2010-08-05 04:09:18 EDT
I don't understand - what solution for fixing this bug?

I posted this sample because in my real code I can modify only paintFigure method. I can't add listener to the Shell because I don't have access to it object.
Comment 5 Felipe Heidrich CLA 2010-08-05 09:54:18 EDT
Sorry Alexandr,

I was justing trying to narrow down your example to a SWT only example (no draw2d). This information is no use for you, unless you know draw2d internals and find a way to make it draw text using SWT TextLayout instead of SWT GC (i.e. maybe there are different ways to draw text in draw2d and one uses TextLayout).
Comment 6 Alexandr CLA 2010-08-05 10:52:58 EDT
In MacOS it works perfectly.
Comment 7 Alexandr CLA 2010-08-05 10:53:40 EDT
But I need this behaviour on Windows 7
Comment 8 Eclipse Webmaster CLA 2019-09-06 16:11:09 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.

If you have further information on the current state of the bug, please add it. 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.
Comment 9 Eclipse Genie CLA 2021-11-06 07:14:15 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.