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

Incorrect and inconsistent handling of null and unknown font names

XMLWordPrintable

              System.out.println(Font.getDefault());
              System.out.println(Font.font(null, 13));
              System.out.println(new Font(null, 14));
              System.out.println(Font.font("foo", 15));
              System.out.println(new Font("bar", 16));

      Font[name=Amble Condensed, family=Amble Cn, style=Regular, size=12.0]
      Font[name=Lucida Sans Regular, family=Lucida Sans, style=Regular, size=13.0]
      Font[name=Amble Condensed, family=Amble Cn, style=Regular, size=14.0]
      Font[name=Lucida Sans Regular, family=Lucida Sans, style=Regular, size=15.0]
      Font[name=bar, family=Lucida Sans, style=Regular, size=16.0]


      The last one doesn't even report the correct full name, it just uses what was passed in.
      I think all of these should report the same and none of them should be Lucida.

      It should be either "SansSerif" or "Amble Condensed".

      The ones for which Amble is reported are getting it from hard coded names
      in Font.java .. and the Font.font(null) one is failing because that file
      uses the full name as the family name.


      In addition Font.getFontNames(String family) needs to handle unknown and null families

            prr Philip Race
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: