-
Bug
-
Resolution: Fixed
-
P4
-
1.1.3
-
b01
-
x86
-
windows_nt
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2016770 | 1.2.0 | Dmitri Trembovetski | P4 | Resolved | Fixed | 1.2fcs |
The method getFontList() should not return the names of deprecated and proprietary font names.
The JA local of the JDK also returns the deprecated font names and they are not mapped correctly. In the i18n version, the double byte characters for Helvetica, TimesRoman and Courier are not displayed but the text (??) is displayed in the correct font. These should be mapped according to the JDK documentation.
The following code shows the fonts returned by getFontList():
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class FontListTest extends Applet implements ItemListener {
private Label sampletext = new Label("Sample Text");
private Label fontname;
private List fontlist;
public void init() {
setLayout(new GridLayout(3, 0));
fontlist = new List();
String fontnames[] = Toolkit.getDefaultToolkit().getFontList();
for (int i = 0; i < fontnames.length; i++)
fontlist.add(fontnames[i]);
fontlist.addItemListener(this);
add(fontlist);
add(sampletext);
fontname = new Label(fontnames[0]);
add(fontname);
}
public void itemStateChanged(ItemEvent e) {
Font font = new Font(fontlist.getSelectedItem(), Font.PLAIN, 16);
sampletext.setFont(font);
fontname.setText(font.toString());
}
}
Notice that
Helvetica == SansSerif
TimesRoman == Serif
Courier == Monospaced
Also, according to the documentation, the method Font.getFamily() should return the platform specific family name of the font. But in the example, family == name on both platforms. I would expect that for name = SansSerif, family = Arial for Win32, etc,....
The JA local of the JDK also returns the deprecated font names and they are not mapped correctly. In the i18n version, the double byte characters for Helvetica, TimesRoman and Courier are not displayed but the text (??) is displayed in the correct font. These should be mapped according to the JDK documentation.
The following code shows the fonts returned by getFontList():
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class FontListTest extends Applet implements ItemListener {
private Label sampletext = new Label("Sample Text");
private Label fontname;
private List fontlist;
public void init() {
setLayout(new GridLayout(3, 0));
fontlist = new List();
String fontnames[] = Toolkit.getDefaultToolkit().getFontList();
for (int i = 0; i < fontnames.length; i++)
fontlist.add(fontnames[i]);
fontlist.addItemListener(this);
add(fontlist);
add(sampletext);
fontname = new Label(fontnames[0]);
add(fontname);
}
public void itemStateChanged(ItemEvent e) {
Font font = new Font(fontlist.getSelectedItem(), Font.PLAIN, 16);
sampletext.setFont(font);
fontname.setText(font.toString());
}
}
Notice that
Helvetica == SansSerif
TimesRoman == Serif
Courier == Monospaced
Also, according to the documentation, the method Font.getFamily() should return the platform specific family name of the font. But in the example, family == name on both platforms. I would expect that for name = SansSerif, family = Arial for Win32, etc,....
- backported by
-
JDK-2016770 Toolkit.getFontList() should not return Helvetica, TimesRoman, Courier fonts
- Resolved
- relates to
-
JDK-4026505 Toolkit.getFontList doesn't return new font names.
- Closed
-
JDK-4149679 Netscape 4.05+AWT1.1 patch does not display fonts.
- Closed