JavaFX font does not load fonts registered through AWT (worked in 1.3, broken in 2.0)

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P4
    • None
    • Affects Version/s: fx2.0
    • Component/s: javafx
    • Environment:

      Buggy for me (Windows 7). Not sure the system the above code was executed on.

      The following code (credited to badgerbadgerbadger on the forum) does not produce an expected behavior.

      java.awt.Font awtFont = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,
              new File("E:/Java/examples/FRE3OF9X.TTF"));
      GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(awtFont);
      System.out.println("AWT Font:");
      System.out.println(awtFont.getName());
      System.out.println(awtFont.getFamily());
      System.out.println("---------------------");
       
      javafx.scene.text.Font fxFont = new javafx.scene.text.Font(awtFont.getName(), 20);
      System.out.println("FX Font:");
      System.out.println(fxFont.getName());
      System.out.println(fxFont.getFamily());

      The output is:

      AWT Font:
      Free 3 of 9 Extended Regular
      Free 3 of 9 Extended
      ---------------------
      FX Font:
      Free 3 of 9 Extended Regular
      Lucida Sans


      As you see the two outputs should be consistent, but it is not.

            Assignee:
            Philip Race
            Reporter:
            Javic Forsky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: