Here I am planning to assign non-standard font(MetricWeb-BlackItalic.woff) to a JLabel. Have written below snippet and it doesn't seems to work. Its taking default font.
String htmlText = "<html><style type=\"text/css\"> @font-face {font-family: \"MyCustomFont\";src: url('MetricWeb-BlackItalic.woff') format(\"woff\");}"+
" p.customfont { font-family: \"MyCustomFont\"}</style> <p class=\"customfont\">Hello world!</p></html>";
JLabel label = new JLabel(htmlText);
System.out.println(htmlText+label.getFont());
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(label);
frame.pack();
frame.setVisible(true);**Output** : Default font frame - javax.swing.plaf.FontUIResource [family=Dialog,name=Dialog,style=bold,size=12]
Note: Tried with ttf, otf and woff font formats.
Can anyone help to resolve this issue ? or is there any other way to solve this problem?