Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4076053

Toolkit.getFontList() should not return Helvetica, TimesRoman, Courier fonts

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b01
    • CPU:
      x86
    • OS:
      windows_nt
    • Verification:
      Verified

      Backports

        Description

        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,....

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                tdv Dmitri Trembovetski (Inactive)
                Reporter:
                mdavidsosunw Mark Davidson (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: