How to force anti-aliasing in JavaFX fonts?

By default, JavaFX 8 uses modena.css to set the LCD anti aliasing, which doesn’t seem to smooth out fonts in some cases. When the font size is larger than 80 px, the AA technique switches to grey scale AA (for performance reasons). So, to achieve smooth edges at any size, grey scale AA should be used instead.

This can be done either via JavaFX CSS:

.text{
    -fx-font-smoothing-type: gray;
}

Or system arguments:

-Dprism.lcdtext=false

Or setting system properties (before loading the FXML):

System.setProperty("prism.lcdtext", "false");

Thanks everyone who replied on Jira!

Leave a Comment