7

This are screen captures of the same text in JavaFX (lcd and gray font smoothing) and Swing (default) on Windows 7 (Java JDK 8u45):

Both JavaFX and Swing fonts are the same (family: Segoe UI, style: Regular, size: 12).

JavaFX 8 (lcd) enter image description here JavaFX 8 (lcd)

JavaFX 8 (gray) enter image description here JavaFX 8 (gray)

Swing enter image description here Swing

Differences are not big, but are noticable.

Note: I don't want to include Swing components in JavaFX.

5
  • I wonder if this is noticeable only with white text on dark background Commented May 25, 2015 at 7:52
  • 2
    It is still noticable with dark text on bright background. For example "H" is still wider in Swing then JavaFX, although colored pixels of lcd smoothing are not so noticable. Swing rendering stil seems a little bit more clear and consistent. Commented May 25, 2015 at 8:29
  • Maybe this issue is about the same problem you're experiencing: javafx-jira.kenai.com/browse/RT-36146 Commented May 25, 2015 at 12:48
  • I think it could be useful if you provide the Java and OS version you used to make the screenshots Commented May 25, 2015 at 12:49
  • I edited the question to include Java and OS versions. Commented May 25, 2015 at 20:57

1 Answer 1

7

tl;dr: It's not possible to get the Swing font rendering it via any combination of available JavaFX font knobs. It seems that your only option is to dig into JavaFX sources, fix it and/or bring it to JavaFX mailing list.


Difference on Linux is so big, that it's practically unusable for any kind of GUI where you read text for longer time. I did fair comparison with Swing and reported it twice[1][2]:

It's somewhat better on Windows, but as you say, in fair comparison with Swing, the difference is noticable: https://i.sstatic.net/bLxsO.png

Quoting Phillip from second bug report:

The main (only?) reason for the difference is that FX by design and across all platforms (including Windows) renders text unhinted, so as to preserve the shapes.

Note that his comments about unfair comparison are false for both bug reports. In the second report there's the test case I made where I specifically used same colors, fonts and sizes, and made the results for all possible combinations of available knobs.


I did the tests on Fedora 23 with freetype-freeworld from rpmfusion:

Xft.autohint:   0
Xft.antialias:  1
Xft.hinting:    1
Xft.hintstyle:  hintfull
Xft.rgba:   rgb
Xft.lcdfilter:  lcddefault
Sign up to request clarification or add additional context in comments.

2 Comments

Woky, take the high ground here. Your contributions can be valuable.
I removed all the not constructive rant parts, feel free to rollback it if you want. I think you could quote a part of the official reply in the second bug report to confirm that it is indeed not possible because it was "by design".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.