javafx.scene.text.Font can't load bold or italic font under non-english locale. How to reproduce:
String fontName="Times New Roman";
Font f1=Font.font(fontName, 22);
System.out.println(f1.getName());
Font f2=Font.font(fontName, FontWeight.BOLD,FontPosture.ITALIC,22);
System.out.println(f2.getName());
Output:
Times New Roman
SansSerif Bold Italic -- it is wrong
Solution: change com.sun.javafx.font.PrismFontLoader. It seeks font style by english name. But fonts has non-english style names for non-english locale.
String fontName="Times New Roman";
Font f1=Font.font(fontName, 22);
System.out.println(f1.getName());
Font f2=Font.font(fontName, FontWeight.BOLD,FontPosture.ITALIC,22);
System.out.println(f2.getName());
Output:
Times New Roman
SansSerif Bold Italic -- it is wrong
Solution: change com.sun.javafx.font.PrismFontLoader. It seeks font style by english name. But fonts has non-english style names for non-english locale.
- duplicates
-
JDK-8111513 Prism incorrectly render FontPosture.ITALIC and FontWeight.BOLD
- Closed