JavaFX 2.2 font rendering problematic
Asked Answered
B

2

9

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.

Brandenburg answered 6/12, 2013 at 10:7 Comment(0)
C
2

so @Aliana you mean you want your text to be re-sizable on its on throughout the devices, if so insted of 100px you must place 100dp(digital pixels) and not pixels

Costrel answered 11/12, 2013 at 13:18 Comment(1)
The question is about aliasing. If you look at the second picture, you can see that it is more jagged with rough edges (not smooth) than the top picture. The Google-Web-Font has better rendering than the second image despite its size being smaller. The resizing intention whether being set in css as relative or setting particular resolutions for particular devices, is immaterial.Brandenburg
M
2

Add these two lines to your code:

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

This fixed my problem with font rendering.

Markup answered 22/2, 2022 at 10:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.