Hi everyone,

We have noticed that, for JavaFX applications on Windows HiDPI displays,
subpixel antialiasing often produces very poor rendering results for many
fonts.

For example, when using the MiSans font on a display scaled to 150%, the
edges of English letters rendered with subpixel antialiasing show very
noticeable jagged artifacts:

https://imgur.com/ZpzDWZ5


For Chinese text, the results of subpixel antialiasing are even more
disastrous. Many strokes either blur together or show obvious
inconsistencies in thickness, making the text look very poor.

To address this issue, we tried forcing grayscale font antialiasing by
adding -Dprism.lcdtext=false. After testing many fonts, we found that on
HiDPI displays, grayscale antialiasing is never worse than subpixel
antialiasing, and it fixes rendering issues for many fonts. On non-HiDPI
displays, that is, at 100% scaling, grayscale antialiasing and subpixel
antialiasing each have their own advantages and disadvantages.

We then added a workaround in our application: on Windows, if the primary
screen scale is greater than 100%, the application automatically adds the
JVM option -Dprism.lcdtext=false to enable grayscale antialiasing. After a
year of real-world use, we have not received any user complaints about this
strategy.

I hope JavaFX can provide a built-in mechanism for automatically selecting
the appropriate antialiasing algorithm, so that users do not have to adjust
these options manually.

Glavo

Reply via email to