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

NullPointerException when no embedded fonts are found.

XMLWordPrintable

      In the VT, we need to get all the font families and their associated names.
      It works well on most of the OS, but recently I received a standard Oracle laptop (Win7),
      and get the following NPE when trying to get names for most of the families, although the fonts seems to be installed on the machine.
      I only get font names (no NPE) for : Monospaced, SansSerif, Serif, System


      The exception raised:

      Caused by: java.lang.NullPointerException
          at com.sun.t2k.T2KFontFactory.getFontFullNames(T2KFontFactory.java:994)
          at com.sun.javafx.font.PrismFontLoader.getFontNames(PrismFontLoader.java:168)
          at javafx.scene.text.Font.getFontNames(Font.java:124)
          at helloworld.HelloFontSize.start(HelloFontSize.java:29)


      To check this, one only need to add in an Fx example :

              for (String family : Font.getFamilies()) {
                  System.out.println("\n===========================");
                  System.out.println(family);
                   try {
                  for (String name : Font.getFontNames(family)) {
                      System.out.println("\t" + name);
                  }
                  } catch (Exception ex) {
                      System.out.println("Exception for family : " + family);
                  }
              }

            prr Philip Race
            jcambon Jerome Cambon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: