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

Inconsistent list of font families when using Font API

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7u6
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
    • Environment:

      JavaFX 2.2 b15

      Description

      I'm trying to build a list of available font families in order to implement a Font picker. I discovered that you get different results depending on which API call you use.
      For instance, if you do 1.:

              Font f = Font.getDefault();
              double defSize = f.getSize();
              Set<Font> allFonts = new TreeSet<Font>(Fonts.fontComparator);

              for (String familly : Font.getFamilies()) {
                  for (String name : Font.getFontNames(familly)) {
                      Font font = new Font(name, defSize);
                      allFonts.add(font);
                  }
              }

      then extract a set of families from the list of fonts in allFonts, you don't get the same result as if you do 2.:

              for (String name : Font.getFontNames()) {
                  Font font = new Font(name, defSize);
                  allFonts.add(font);
              }

      then extract a set of families from the list of fonts in allFonts.

      On my windows machine, if I use 1. then my list of families does not contain "Lucida Sans", but if I use 2. it does.

      Shouldn't both sets be the same in the end? Why aren't they?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                prr Philip Race
                Reporter:
                dfuchs Daniel Fuchs
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: