JavaFX 2.2 font rendering problematic

Viewed 1306

We can't satisfactorily get the Roboto Thin font displaying in our JavaFX app at the size we want. It suffers from aliasing in the rending.

We took the Roboto font from here. (actually from maven)

It looks fine at 100px which is too large for our purposes. 100pxImage

Ideally we want this to be re-sizable and stretchable. However, it looks jagged even at 50px which should be the most accommodated since its divisible by 2 (no fallover pixels from the perfect looking 100). We've tried other small sizes with equal dissatisfaction.

50pxImage

If you look at this link of RobotoThin100 rendered as a Google web font, it is much smaller and doesn't have any of these aliasing issues.

We are planning on using this porting framework to run on android which means we need to use Java 7 and can't upgrade to JavaFX 8 as we currently understand it. However, the screenshots are simply from the Windows 7 version at the moment.

Our CSS looks like the following:

.label
  {
    -fx-text-fill:#ffffff;/*white*/
    -fx-font-size: 100px;
    -fx-font-family: "Roboto Thin";
  }

Are we doing something wrong?

Thanks in advance.

2 Answers

Add these two lines to your code:

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

This fixed my problem with font rendering.

Related