Community
Participate
Working Groups
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
Upping severity to correspond to triggering PR.
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.
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.
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()); } } }
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.
Fuse-san are you getting the following warning to the console when running this? Warning: locale not supported by C library, locale unchanged
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.
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.
Yes Fuse san you are right. I will close the PR.