2

for some reason any version of Oracle's JDK I am using is using greyscale hinting instead of subpixel. I am noticing this using Netbeans 7.3 and even Dev nightly+JDK 8.

Cfr. these pictures:

JDK 6 on the left, vs JDK 8 on the right (same behavior with JDK 7) enter image description here

Other example, scaled up here.

How can I force Netbeans to use subpixel hinting? I have even followed the FAQ here, without much luck.

I know that Apple's JDK is fine-tuned for OS X font rendering, but I find also strange that I am getting greyscale hinting instead of subpixel.

Edoardo Vacchi
  • 1,284
  • 10
  • 18

1 Answers1

1

Looks like you need to turn on fractional metrics, like this:

g2Image.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);

See https://bugs.openjdk.java.net/browse/JDK-8023794, there's an example program there to test font aliasing as well.

Edit: OpenJDK 9 now supports proper subpixel AA font rendering. See my answer here How to enable LCD subpixel antialiasing in Swing on OS X?

Community
  • 1
  • 1
Thor
  • 737
  • 7
  • 15
  • 1
    I believe you are right. Now, is there some way to enable that without recompiling the IDE? [Like a flag](http://docs.oracle.com/javase/6/docs/technotes/guides/2d/flags.html#aaFonts)? – Edoardo Vacchi Oct 17 '13 at 15:23
  • Looks like you can use the flag -J-Dorg.netbeans.editor.aa.extra.hints=true, but it doesn't seem to work, so something else in netbeans must cause it to be disabled, see this bug report; https://netbeans.org/bugzilla/show_bug.cgi?id=216655 – Thor Oct 22 '13 at 14:04
  • I've shared a Netbeans module on Github that may help to play with the antialias params, but at this point I'm starting to believe this is really a bug in the JDK that cannot be worked around – Edoardo Vacchi Oct 24 '13 at 11:26
  • 1
    Just discovered that enabling fractional metrics allows subpixel font rendering to work in netbeans post-7.4 nightly work on jdk 1.7.0_25 or earlier. With jdk 1.7.0_40 it doesn't work, so something happened between those releases. – Thor Nov 29 '13 at 14:07