-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.2.1
-
sparc
-
solaris_7
In our product we have a number of places where Font.decode("times-bold-14") is used. In jdk 1.1 this worked fine for both English and Asian locales. In java2 it only works for English locales. It causes Asian locales to have the translated text show up as little squares. This also fails for "helvetica" and "courier". If I replace "times" with "dialog", "sansserif" or "serif" it works ok. If there is a change we need to make, then please advise (and document). A simple test case is included. FontTest.java: import java.awt.*;
import javax.swing.*;
import java.util.*;
class FontTest extends JFrame {
ResourceBundle bundle;
public FontTest() {
bundle = ResourceBundle.getBundle("TestBundle", Locale.getDefault());
JPanel p = new JPanel();
JLabel l = new JLabel(bundle.getString("browser"));
l.setFont(Font.decode("serif-bold-14"));
p.add(l);
getContentPane().add(p);
}
public static void main(String[] args) {
FontTest ft = new FontTest();
ft.pack();
ft.validate();
ft.show();
}
} TestBundle.properties:
browser=Browser TestBundle_zh_TW.properties:
browser=\u700f\u89bd\u5668
import javax.swing.*;
import java.util.*;
class FontTest extends JFrame {
ResourceBundle bundle;
public FontTest() {
bundle = ResourceBundle.getBundle("TestBundle", Locale.getDefault());
JPanel p = new JPanel();
JLabel l = new JLabel(bundle.getString("browser"));
l.setFont(Font.decode("serif-bold-14"));
p.add(l);
getContentPane().add(p);
}
public static void main(String[] args) {
FontTest ft = new FontTest();
ft.pack();
ft.validate();
ft.show();
}
} TestBundle.properties:
browser=Browser TestBundle_zh_TW.properties:
browser=\u700f\u89bd\u5668