Bug 35469 - Encoding is lost in Japanese
Summary: Encoding is lost in Japanese
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: PC Linux-Motif
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-21 10:11 EST by Tod Creasey CLA
Modified: 2003-04-01 10:39 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2003-03-21 10:11:05 EST
RC2
Linux Motif Japanese

When you execute the code below you will see that the encoding portion of the
font definition is lost when the font is created.

public class FontTest {

	public static void main(String[] args) {

		FontData data =
			new FontData("1|fixed|14|0|MOTIF|1|-misc-fixed-medium-r-normal-old
style-*-140-75-75-c-*-jisx0208.1997-0");
		
		Font font = new Font(Display.getDefault(),data);
		FontData[] newData = font.getFontData();
		System.out.println(newData[0].toString());
	}

}

This will print the result 

1|fixed|14|0|MOTIF|1|-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1
Comment 1 Nick Edgar CLA 2003-03-21 12:16:12 EST
Upping severity to correspond to triggering PR.
Comment 2 Veronika Irvine CLA 2003-03-21 13:21:55 EST
It is possible that one font data when turned into a font will generate 
multiple font data when the font is queried back.  The best match for your 
original font data should appear as an entry in the font data array.  Please 
reopen if this is not the case.
Comment 3 Tod Creasey CLA 2003-03-21 13:41:08 EST
The problem is determining how to continue to use the FontDialog then which 
will only take and return one FontData - we would need to be able to get the 
full value from SWT to able to support this.
Comment 4 Tod Creasey CLA 2003-03-24 10:29:28 EST
This is a more valid test as it checks all of the FontDatas. On my machine I
still only get the iso8859-1 one. Fuse-san please verify this behaviour.

public class FontTest {

	public static void main(String[] args) {

		FontData data =
			new FontData("1|fixed|14|0|MOTIF|1|-misc-fixed-medium-r-normal-old
style-*-140-75-75-c-*-jisx0208.1997-0");
		
		Font font = new Font(Display.getDefault(),data);
		FontData[] newData = font.getFontData();
		for(int i =0; i< newData.length; i ++){
			System.out.println(newData[0].toString());
				}
		}
		

}
Comment 5 Felipe Heidrich CLA 2003-03-24 11:09:53 EST
NOTE: that your testcase has a bug. It loops to show all the font datas but
always print the font data at 0.


The font you are trying to load: 
1|fixed|14|0|MOTIF|1|-misc-fixed-medium-r-normal-oldstyle-*-140-75-75-c-*-jisx0208.1997-0"
Does not exist (in my system at least). 
(more precisily The add style "oldstyle" and the registry "jisx0208.1997" do not
exist)

Running your code I got the output:
1|fixed|14|0|MOTIF|1|-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1
1|fixed|14|0|MOTIF|1|-jis-fixed-medium-r-normal--15-140-75-75-c-150-jisx0208.1983-0
1|fixed|14|0|MOTIF|1|-misc-fixed-medium-r-normal--15-140-75-75-c-80-jisx0201.1976-0

This is right!
It has loaded what the code has asked for except by the invalid fields.

It also has loaded the right fontset for the ja_JP locale, look the XLC_LOCALE:
(less /usr/X11R6/lib/X11/locale/ja/XLC_LOCALE)

It defines that the first charset is ISO8859-1, the second is JISX0208.1983-0,
and the last is JISX0201.1976-0.



Comment 6 Tod Creasey CLA 2003-03-24 11:14:42 EST
Fuse-san are you getting the following warning to the console when running this?

Warning: locale not supported by C library, locale unchanged
Comment 7 Tod Creasey CLA 2003-03-24 11:28:08 EST
After talking to Felipe the root of the problem is that there are too many fonts
in the file dialog.

The only fonts on Motif that are valid for any given Locale are those that are
in /usr/X11R6/lib/X11/locale/<locale>/XLC_LOCALE. On my Japanese install this is
generally 2 or 3 fonts - not the 100s in the dialog.

Plus run the test below using one of the fonts in your XLC_LOCALE file - if you
need help defining them in the example please attach them to this PR.
Comment 8 Masayuki Fuse CLA 2003-03-25 01:58:42 EST
Tod, I didn't get the warning message, and I am aware your test case had a bug.
Now I get rerurn of font name as Felipe mentioned at #5.

XLC_LOCALE file defines font charset name that is a part of X window logical 
font name and can be used on Motif. But the font dialog lists all of logical 
font queried by font server. Am I right? If so, this PR should be closed.
Comment 9 Tod Creasey CLA 2003-03-25 07:57:22 EST
Yes Fuse san you are right. I will close the PR.