Why does JavaFX add extra letter spacing when using the Text component and how to fix it?

I am trying to use the JavaFX text component to create a beautiful typography in my application. As if the letters in the text were not evenly distributed. For example, in the word “visit”, the “iting” part seems to be disconnected from the first part.

sample text image

In the sample sample, I use Arial, but this bad spacing occurs with every font I tried.

This only happens when gray smoothing ( -fx-font-smoothing-type: gray;) is used. One obvious solution would be to change -fx-font-smoothing-typeto lcd, but this will cause the text to have jagged edges.

The only thing that remotely mentions something like this is the jira RT-14187 problem , but that seems to have been resolved in javafx 8 (jre 8).

+2
source share

Source: https://habr.com/ru/post/1694546/


All Articles