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