Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 192646 - TextLayout implementation on VISTA platform cannot correctly render some gb18030 characters(Mongolian Baiti, Microsoft Yi Baiti etc)
Summary: TextLayout implementation on VISTA platform cannot correctly render some gb18...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows Vista
: P3 major (vote)
Target Milestone: 3.4 M7   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-14 08:04 EDT by Wei Wang CLA
Modified: 2008-04-25 13:05 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wei Wang CLA 2007-06-14 08:04:05 EDT
Build ID: M20060629-1905

Steps To Reproduce:
1.Create a shell.
2.Create a TextLayout instance and set some gb18030 characters as its text.
3.Run the application and find that these characters 
cannot display correctly.

More information:
The code snippet used to reproduce this problem:
	/**
	 * @param args
	 */
	public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display, SWT.SHELL_TRIM);
        shell.setSize(358, 217);
        shell.addListener(SWT.Paint, new Listener() {
                public void handleEvent(Event event) {
                        TextLayout layout = new TextLayout(display);
                        event.gc.setForeground(display.getSystemColor(SWT.COLOR_BLUE));
                        String text = "sss \u1820, \u1821, \ua000, \ua001";
//                        event.gc.drawText(text, 0, 0);
                        layout.setText(text);
                        layout.setWidth(shell.getBounds().width);
                        layout.draw(event.gc, 0, 0);
                        layout.dispose();
                }
        });
        shell.open();
        while (!shell.isDisposed()) {
                if (!display.readAndDispatch()) {
                        display.sleep();
                }
        }
        display.dispose();
	}
Comment 1 Felipe Heidrich CLA 2007-06-14 14:38:23 EDT
Eclipse 3.2.x is finished, I'm testing with HEAD, please do the same when you report futher results.

A regular English XP doesn't have any font that supports mongolian and yi. If you install GB18030 support package you can set the TextLayout font to SimSun-18030 and then it will work.
Note that the fontlinking used by TextLayout doesn't work for 100% of the scripts in the world. When using a rare script you need to set the font.

In Vista, I have the same problem, font linking doesn't work. The problem is that I couldn't find one font that supports both scripts. In Vista, "Mongolian Baiti" support Mongolian and "Microsoft Yi Baiti" supports Yi. For this to work on vista I had to set the right font for each segment of text you gave.

In this platform 
Comment 2 Steve Francisco CLA 2007-08-28 11:47:59 EDT
Can this be handled for 3.3.1?
Comment 3 Felipe Heidrich CLA 2007-08-28 12:39:09 EDT
(In reply to comment #2)
> Can this be handled for 3.3.1?

Sorry, we are not changing this part of the code in the 3.3.maintenance stream.
Note: the application can workaround this problem by setting the right font.
Comment 4 Steve Northover CLA 2007-08-28 13:40:00 EDT
What Felipe is saying is that there are too many changes to put in a 3.3.x release.  The risk is too high that something will break.
Comment 5 Raji Akella CLA 2008-02-26 11:29:11 EST
Any plans to fix this in 3.4?

Comment 6 Felipe Heidrich CLA 2008-03-11 15:25:44 EDT
I don't have a fix for this. TextLayout uses MLang for font substition and this technology fails for mongolian and yi.
GDI font substituion works here.
Comment 7 Mike Wilson CLA 2008-03-27 14:11:13 EDT
Is this a platform limitation then?
Comment 8 Felipe Heidrich CLA 2008-04-04 16:50:41 EDT
Fixed in HEAD > 20080404