All font weights other than FontWeight.BOLD are ignored. To get the light font you want to do something like this:
private static final Font UNIT_FONT = Font.font("Segoe UI", FontWeight.LIGHT, 24);
We have the API but it is ignored and not implemented at the moment. The only way to get a light font is via its name not family name. Like:
private static final Font UNIT_FONT = new Font("Segoe UI Light",24);
You can see where it is ignored in:
com.sun.javafx.font.PrismFontLoader#font(String family, FontWeight weight, FontPosture posture, float size)
It even has a comment that we should come back and fix it :-)
// REMIND. Some day need to have better granularity.
boolean bold = weight != null &&
weight.ordinal() >= FontWeight.BOLD.ordinal();
boolean italic = posture == FontPosture.ITALIC;
PGFont prismFont = fontFactory.createFont(family, bold, italic, size);
So at the moment its just treated as 2 booleans not a enum from Prism down.
private static final Font UNIT_FONT = Font.font("Segoe UI", FontWeight.LIGHT, 24);
We have the API but it is ignored and not implemented at the moment. The only way to get a light font is via its name not family name. Like:
private static final Font UNIT_FONT = new Font("Segoe UI Light",24);
You can see where it is ignored in:
com.sun.javafx.font.PrismFontLoader#font(String family, FontWeight weight, FontPosture posture, float size)
It even has a comment that we should come back and fix it :-)
// REMIND. Some day need to have better granularity.
boolean bold = weight != null &&
weight.ordinal() >= FontWeight.BOLD.ordinal();
boolean italic = posture == FontPosture.ITALIC;
PGFont prismFont = fontFactory.createFont(family, bold, italic, size);
So at the moment its just treated as 2 booleans not a enum from Prism down.
- relates to
-
JDK-8087986 Light/Thin font rendering is ugly on Mac compared to native
-
- Open
-
-
JDK-8088391 javafx.scene.text.Font broken for families with more weights than Regular & Bold; especially on Mac
-
- Open
-