Reputation: 3644
I'm using a CSS style sheet with a style class like this:
.sublabel {
-fx-font-style: italic;
-fx-font-size: 12;
}
...which has been set as the Label's Style Class in Scene Builder. The font size changes as expected (smaller, since I have -fx-font-size: 14; under the .root class but this is the only font-related setting). Bold style works fine, but it refuses to use an italic font. I'm not using a custom font anywhere, so this should be using the default font JavaFX 8 uses on Win7. I've also tried setting it under Style independently.
What could cause the style request to be ignored?
Upvotes: 11
Views: 6203
Reputation: 76
The default font in JavaFX, "system", does not support italic. You can even choose italic in SceneBuilder, but it will only work for fonts that support it.
Try using a TrueType font, e.g. Verdana, then it should work without problems.
Either use the style version below, or the more direct: Font name="Verdana Italic"
<Button style="-fx-font-style: italic;" text="Button">
<font>
<Font name="Verdana"/>
</font>
</Button>
Upvotes: 4