Bug 216655 - Font anti aliasing broken when using Java SE 7
Font anti aliasing broken when using Java SE 7
Status: RESOLVED INVALID
Product: platform
Classification: Unclassified
Component: JDK Problems
7.4
Macintosh (x86) Mac OS X
: P2 with 15 votes (vote)
: 7.4
Assigned To: Antonin Nebuzelsky
issues@platform
issue_reviewed, 74patch2-fixed
: JDK_1.7, JDK_SPECIFIC
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-10 10:46 UTC by ota
Modified: 2014-02-16 11:24 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Using java SE 7 (66.89 KB, image/png)
2012-08-10 10:46 UTC, ota
Details
Using java SE 6 (76.87 KB, image/png)
2012-08-10 10:47 UTC, ota
Details
Eclipse Java 6 (28.70 KB, image/png)
2012-10-12 08:04 UTC, ota
Details
Eclipse Java 7 (28.70 KB, image/png)
2012-10-12 08:05 UTC, ota
Details
java version "1.6.0_43" (24.60 KB, image/png)
2013-04-18 10:51 UTC, larsomat
Details
java version "1.7.0_21" (22.38 KB, image/png)
2013-04-18 10:52 UTC, larsomat
Details
SwingSet demo rendering in JDK 1.7 and JDK 1.6 (144.89 KB, image/png)
2013-06-13 09:00 UTC, Stanislav Aubrecht
Details
Broken Java 1.7 AA screenshot (451.51 KB, image/png)
2013-10-15 19:51 UTC, snagnever
Details
7.4 (java 1.8) vs 7.3.1 (java 1.6) - Netbeans 7.4 Product Version: NetBeans IDE 7.4 (Build 201310111528) Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b45 Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b103 - Netbeans 7.3 Product Ver (96.88 KB, image/png)
2013-10-21 09:36 UTC, friimaind
Details
Font comparison of Netbeans 7.3 + Java 1.6 against 7.4 + Java 1.7 on LInux (59.66 KB, image/png)
2013-10-21 15:05 UTC, airdrik
Details
-J-Dorg.netbeans.editor.aa.fractional=true (61.95 KB, image/png)
2013-11-13 09:31 UTC, friimaind
Details
NB 7.3.1/Java 1.6, NB 7.4/1.7, NB DEV/1.8 with aa.fractional (113.03 KB, image/png)
2013-11-13 20:05 UTC, drillingman
Details
NB 7.3.1 with JDK1.6 and UseQuartz=false|true (174.89 KB, image/png)
2013-11-27 14:54 UTC, tveimo
Details
NB 7.3.1/Java 1.6 useQuartz true|false (105.32 KB, image/png)
2013-11-27 19:35 UTC, drillingman
Details
NB 7.4-nightly w jdk1.7.0_05 vs jdk1.6.0 with UseQuartz=true (172.69 KB, image/png)
2013-11-28 10:48 UTC, tveimo
Details
NB 7.4 w JDK 1.7.0_25 (123.25 KB, image/png)
2014-01-09 04:36 UTC, augf87
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ota 2012-08-10 10:46:33 UTC
Created attachment 122985 [details]
Using java SE 7

Hey i recently updated to java 1.7 and the font anti aliasing seems to be broken, again. 

There is an old issue http://netbeans.org/bugzilla/show_bug.cgi?id=194676 that includes various configuration recommendations, but none of them help anymore.

For a better compersion i included
Comment 1 ota 2012-08-10 10:47:22 UTC
Created attachment 122986 [details]
Using java SE 6
Comment 2 ota 2012-08-10 10:49:01 UTC
Submitted to early :)!

Included are two screenshots for better comparison.
Comment 3 Petr Somol 2012-08-10 11:36:57 UTC
I took a close look at the screenshots and my conclusion is as follows. This is not a case of antialiasing actually broken, it is a case of slight difference in rendering. The attachment broken.png clearly shows that characters are antialiased. Though I agree they look different in 1.7 from those in 1.6, where they are clearly more legible.

But the difference between 1.7 and 1.6 is completely outside NetBeans code. The past problems NetBeans had with antialiasing, afaik, were related to disabled antialiasing where it should have been enabled or so, what is not the case here.

I attribute the difference in the two attachments to the fact that they have been produced by different vendors - there is no unambiguous definition of how an antialised text should be actually rendered or postprocessed - I suspect that in your 1.6 the JDK detects the fact that bright characters are rendered on dark background and increases slightly the contrast and character weight (in typography it is known that the same white letters on black background are perceived by human eye as thinner that the same in black on white background) while 1.7 either does not do it or does it differently.

I am closing it here as JDK issue unrelated to NetBeans.
Comment 4 ota 2012-09-14 14:36:30 UTC
Hey thanks for the response - after investigating further i am unable to find any issues with the 1.7 jdk regarding the font rendering. The problem also does not occur in eclipse or any other java apps. Are you sure this is not netbeans related?
Comment 5 Petr Somol 2012-09-17 08:29:22 UTC
(In reply to comment #4)
> Hey thanks for the response - after investigating further i am unable to find
> any issues with the 1.7 jdk regarding the font rendering. The problem also does
> not occur in eclipse or any other java apps. Are you sure this is not netbeans
> related?

Would you please attach a screenshot comparing the NB and Eclipse rendered fonts on your 1.7 JDK ?
Comment 6 ota 2012-10-01 12:55:06 UTC
Please see the two attached files i added when opening this issue for the difference.
Comment 7 Petr Somol 2012-10-08 14:13:41 UTC
(In reply to comment #6)
> Please see the two attached files i added when opening this issue for the
> difference.

If I understand it right the two original attachments show font rendering of JDK6 and JDK7, both in NetBeans. It would be good to show the same (both JDK6 and JDK7) comparison on Eclipse..
Comment 8 ota 2012-10-12 08:04:42 UTC
Created attachment 125831 [details]
Eclipse Java 6
Comment 9 ota 2012-10-12 08:05:03 UTC
Created attachment 125832 [details]
Eclipse Java 7
Comment 10 ota 2012-10-12 08:05:56 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Please see the two attached files i added when opening this issue for the
> > difference.
> 
> If I understand it right the two original attachments show font rendering of
> JDK6 and JDK7, both in NetBeans. It would be good to show the same (both JDK6
> and JDK7) comparison on Eclipse..

Ah i see! I attached two new screenshots which compare the eclipse font rendering. Hope it helps.
Comment 11 snagnever 2013-02-13 05:16:54 UTC
any solution, so far?
i have the same problem
Comment 12 larsomat 2013-04-17 09:52:20 UTC
I just installed the nightly of Netbeans. I had to install the Java 7 from Oracle before I could do that. And now I have the same problem. Ugly!
Comment 13 larsomat 2013-04-18 10:51:59 UTC
Created attachment 133559 [details]
java version "1.6.0_43"
Comment 14 larsomat 2013-04-18 10:52:47 UTC
Created attachment 133560 [details]
java version "1.7.0_21"
Comment 15 larsomat 2013-04-18 10:54:06 UTC
I added some screenshots with Netbeans 7.3. Same font settings in both, the only difference is the Java version.
Comment 16 Petr Somol 2013-04-18 10:56:10 UTC
Standa, you might know more than me about how JDK version affects our font rendering, would you please evaluate this ?
Comment 17 Stanislav Aubrecht 2013-04-18 11:27:37 UTC
Looks like a JDK issue. Please run some plain Swing app, e.g. Anagrams game from NetBeans samples and compare how it looks like when running with JDK 1.6 and JDK 1.7
Comment 18 Stanislav Aubrecht 2013-06-13 09:00:16 UTC
Created attachment 135741 [details]
SwingSet demo rendering in JDK 1.7 and JDK 1.6
Comment 19 Stanislav Aubrecht 2013-06-13 09:01:27 UTC
HTML rendering did change in JDK 1.7, see the attached screen shot showing SwingSet demo running under JDK 1.7 update 21 and JDK 1.6 update 45.
It seems that JDK 1.7 uses also different default fonts.
Comment 20 erusev 2013-08-22 10:11:34 UTC
I'm not sure it is correct to say this is a JDK issue as the fonts of other IDEs (such as PHPStorm) running the same JDK don't seem to have the same issue.
Comment 21 larsomat 2013-08-23 08:35:53 UTC
For me personally, this is a "blocker".

I don't use nightly builds anymore since the change and won't update Netbeans until this issue has been adressed.
Comment 22 erusev 2013-08-23 12:42:59 UTC
I feel the same way as larsomat. I would also not update Netbeans until this issue has been addressed.
Comment 23 mym 2013-10-02 22:05:30 UTC
I had to manually set netbeans_jdkhome to use 1.6 as this is definitely a blocker. Many plugins refuse to work with 1.6 though...
Comment 24 erusev 2013-10-14 16:51:23 UTC
Is it realistic to expect any progress on this? It is a major issue.
Comment 25 larsomat 2013-10-14 16:58:01 UTC
I'd like to know this, too. I stopped using nightly builds as I stated before. And therefore I stopped submitting any bug reports on them. This issue needs to be addressed before I even think of going back to nightly builds.

I'm pretty sure it's the same for many developers on OSX who are not commenting here. That's a major loss for Netbeans development (on OSX)...
Comment 26 snagnever 2013-10-15 19:51:42 UTC
Created attachment 141113 [details]
Broken Java 1.7 AA screenshot
Comment 27 snagnever 2013-10-15 19:56:01 UTC
It IS a major problem for developers on Mac OS.
I will stick to NB 7.3.1 until it is fixed, it's impossible to use the ide with this broken AA

http://d.pr/i/UqCE
Comment 28 erusev 2013-10-16 09:35:35 UTC
Here are 2 more screenshots:

NetBeans 7.3.1: http://d.pr/i/t2xm
NetBeans 7.4: http://d.pr/i/3b8T
Comment 29 tveimo 2013-10-17 12:21:21 UTC
It seems it's possible to bring back subpixel font antialiasing in jdk 1.7 on OSX by using fractional metrics. Would it be possible to get a netbeans build with fractional metrics enabled for the editor component, to see if that fixes the issues people have with the font rendering in jdk 1.7 on OSX?

See https://bugs.openjdk.java.net/browse/JDK-8023794, there's an example font program where one can add fractional metrics to the source, to see the results.
Comment 30 pemedina 2013-10-17 12:22:36 UTC
Same issue here

7.4   / java version "1.7.0_40" Bad.
7.3.1 / java version "1.6.0_65" Ok.

Running Mac OS X 10.7.5
Comment 31 friimaind 2013-10-17 14:03:00 UTC
Same problem here.

About my system:
- Mac 10.7.5
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

Netbeans 7.3.1 looks fine
Netbeans 7.4 looks broken
Screenshot comparison: http://imgur.com/SQcdaFv

Any news? It's impossible to work with 7.4 :(
Comment 32 tveimo 2013-10-18 13:55:58 UTC
Looks like all the netbeans font rendering code during setup checks the awt.font.desktophints property, which if present is added to the rendering hints, eg from SceneComponent.java; 

Graphics2D gr = (Graphics2D) g;

Object props = Toolkit.getDefaultToolkit ().getDesktopProperty ("awt.font.desktophints"); // NOI18N
if (props instanceof Map)
  gr.addRenderingHints ((Map) props);
gr.setRenderingHint (RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
gr.setRenderingHint (RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

But it's not possible to configure a map property value outside Java code.
Comment 33 tveimo 2013-10-18 14:09:08 UTC
Would it be possible to create a netbeans module that calls

Map desktopHints = new HashMap();
desktopHints.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
Toolkit.setDesktopProperties("awt.font.desktophints", desktopHints);

before the rest of netbeans is initialized?
Comment 34 evacchi 2013-10-19 20:11:29 UTC
I've tried to create a module like the one suggested in Comment #33

I don't think it is working, but I encourage people to clone/fork to try the code.

https://github.com/evacchi/netbeans-fractionalmetrics-fix
Comment 35 friimaind 2013-10-21 09:36:10 UTC
Created attachment 141337 [details]
7.4 (java 1.8) vs 7.3.1 (java 1.6)

- Netbeans 7.4
Product Version: NetBeans IDE 7.4 (Build 201310111528)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b45
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b103

- Netbeans 7.3
Product Ver

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Comment 36 tveimo 2013-10-21 12:08:11 UTC
You might rather want to look at

org.netbeans.modules.editor.settings.storage.fontscolors.CompositeFCS.java

in the editor.settings.storage module. It's where the renderingHints are defined for the editor. If you build netbeans locally, you can experiment with the hints defined there. Eg try the -J-Dorg.netbeans.editor.aa.extra.hints=true parameter. While it turns on fractional metrics, it doesn't specify LCD_HRGB for text antialiasing, which is required for subpixel antialiasing on OSX.

However, I've tried to add this hint, but there's still no subpixel font rendering, so there must be some other setting somewhere that is preventing it, maybe something like the bit depth of the buffer the editor renders into.

Eg try running the AntialiasDemo.java program defined in the bugreport here;

https://bugs.openjdk.java.net/secure/attachment/15546/AntialiasDemo.java

on a mac with jdk1.7+ to see which hints are required to produce subpixel font rendering.
Comment 37 airdrik 2013-10-21 15:05:27 UTC
Created attachment 141356 [details]
Font comparison of Netbeans 7.3 + Java 1.6 against 7.4 + Java 1.7 on LInux

Piping in to mention that this is not an OSX-specific bug.  I'm seeing it on linux (ubuntu 12.04, 64-bit) as well.
Screenshot comparing Netbeans 7.3 on Java 1.6 with Netbeans 7.4 on Java 1.7, using Ubuntu font.

font options used: -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd

After a some more investigation, most fonts render identically between 7.3 and 7.4 (Ubuntu is one of the few that I'd tried that .  My preferred font (Avdira) also doesn't render properly in 7.4 (appears similarly over-bold), but it is excluded from selection entirely in 7.3 so I can't provide that comparison.  I could provide a comparison of Avdira between NB 7.4 and other native apps (kwrite, spyder) if that is worthwhile.
Comment 38 friimaind 2013-10-21 15:24:23 UTC
Comment on attachment 141337 [details]
7.4 (java 1.8) vs 7.3.1 (java 1.6)

- Netbeans 7.4
Product Version: NetBeans IDE 7.4 (Build 201310111528)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b45
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b103

- Netbeans 7.3
Product Ver

Edit, my fault:

- Netbeans 7.4
Product Version: NetBeans IDE 7.4 (Build 201310111528)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b45
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b103

- Netbeans 7.3
Product Version: NetBeans IDE 7.3.1 (Build 201306052037)
Java: 1.6.0_65; Java HotSpot(TM) 64-Bit Server VM 20.65-b04-462
Runtime: Java(TM) SE Runtime Environment 1.6.0_65-b14-462-11M4609
Comment 39 evacchi 2013-10-22 12:58:35 UTC
the code that I have put on GitHub does effect rendering if you select VALUE_TEXT_ANTIALIAS_LCD_HRGB and VALUE_FRACTIONALMETRICS_ON but the result is ugly. I don't see any improvements in the other cases. This is certainly a JDK bug, but I would like to find a workaround for Netbeans
Comment 40 jeremyclarke 2013-11-04 22:00:58 UTC
+1 for this being a horrible problem. I can barely look at my code with this change. As stated in other comments it seems to disproportionately affect dark-background color schemes, but to my eyes it's a problem no matter what. 

This is going to be the thing that forces me to try PHPStorm :(
Comment 41 pemedina 2013-11-05 12:07:16 UTC
So i am wondering how are you people dealing with this issue?
In my case, i was forced to stay with 7.3.

Should we expect a fix for this?
Comment 42 LuCiAn0 2013-11-06 15:19:15 UTC
I had to stay with 7.3. I don't think this problem is going to get fixed any soon. I'm currently looking for a new IDE.
Comment 43 tveimo 2013-11-07 11:13:36 UTC
The problem is twofold; subpixel antialiasing is not working, and if it was, the font rendering in the jdk is sub-par compared to the one provided by apples own JDK (which I presume use OSX native font rendering). So if you solved the subpixel antialiasing issue, it would render like intellij renders on OSX with JDK 7/8.

But it wouldn't give the same font rendering as netbeans 7.3 on apples JDK.

If you get a retina display, the problem mostly goes away, since even grayscale antialiasing produces visually decent results, when the JDK gets to work with the native resolution (with JDK 8 and JDK 7u40 upwards), although scrolling performance is degraded (See https://netbeans.org/bugzilla/show_bug.cgi?id=237724).
Comment 44 Miloslav Metelka 2013-11-11 14:44:40 UTC
(In reply to tveimo from comment #36)
> You might rather want to look at
> 
> org.netbeans.modules.editor.settings.storage.fontscolors.CompositeFCS.java
> 
> in the editor.settings.storage module.

IMHO the CompositeFCS.getRenderingHints() is rather complex and instead we should just add the desktop hints to existing hints in the Graphics.
Possibly we can allow for some extra hints such as fractional metrics (but individually not like org.netbeans.editor.aa.extra.hints which adds a set of additional properties at once).
I've made a fix to view hierarchy (in jet-main repository) which does that and a possibility to run the IDE with

-J-Dorg.netbeans.editor.aa.fractional=true

to set the fractional metrics hint whether makes any improvement or not to the rendering.

The fix also allows to see the a complete set of hints by using

-J-Dorg.netbeans.editor.view.settings.level=FINE

there should be an output like this:

DocumentView.updateFontColorSettings() Antialiasing Rendering Hints:
    Graphics: {Text-specific antialiasing enable key=Default antialiasing text mode, Text-specific LCD contrast key=140, Fractional metrics enable key=Integer text metrics mode, Stroke normalization control key=Default stroke normalization, Global antialiasing enable key=Nonantialiased rendering mode, Global rendering quality key=Default rendering methods}
    Desktop Hints: {Text-specific antialiasing enable key=LCD HRGB antialiasing text mode}
    Extra Hints: null

where "Graphics:" means output of Graphics.getRenderingHints() before adding additional hints by NetBeans.
"Extra hints" would be set if the "org.netbeans.editor.aa.fractional" would be set to true.
I can add additional properties if there would be any demand for them.

http://hg.netbeans.org/jet-main/rev/f2ba621880bf
Comment 45 Quality Engineering 2013-11-13 03:07:04 UTC
Integrated into 'main-silver', will be available in build *201311130002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f2ba621880bf
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #216655 - Font anti aliasing broken when using Java SE 7.
Comment 46 Jiri Prox 2013-11-13 06:24:45 UTC
Can someone try the new switch, please?

You can provide switch on command line when starting netbeans or you can add it to property netbeans_default_options in the netbeans.conf (located in {install_dir}/etc)

Thanks
Comment 47 friimaind 2013-11-13 09:30:07 UTC
I've installed build 201311130002 and tested the new boot option.
Maybe I missed something but I do not see any difference:

Screenshot: http://i.imgur.com/bgBAAqH.png

I've edited the netbeans.conf like that:

netbeans_default_options="-J-Dorg.netbeans.editor.aa.fractional=true -J-client etc.."
Comment 48 friimaind 2013-11-13 09:31:19 UTC
Created attachment 142118 [details]
-J-Dorg.netbeans.editor.aa.fractional=true
Comment 49 pemedina 2013-11-13 13:35:46 UTC
No luck on my side.

Added " -J-Dorg.netbeans.editor.aa.fractional=true -J-Dorg.netbeans.editor.view.settings.level=FINE" to netbeans.conf and i can see


DocumentView.updateFontColorSettings() Antialiasing Rendering Hints:
    Graphics: {Fractional metrics enable key=Integer text metrics mode, Text-specific antialiasing enable key=Default antialiasing text mode, Stroke normalization control key=Default stroke normalization, Text-specific LCD contrast key=140, Global antialiasing enable key=Nonantialiased rendering mode, Global rendering quality key=Default rendering methods}
    Desktop Hints: {Text-specific antialiasing enable key=Antialiased text mode, Global antialiasing enable key=Antialiased rendering mode}
    Extra Hints: {Fractional metrics enable key=Fractional text metrics mode}

in ide log.

But nothing as changed on font rendering.
Comment 50 drillingman 2013-11-13 20:05:07 UTC
Created attachment 142154 [details]
NB 7.3.1/Java 1.6, NB 7.4/1.7, NB DEV/1.8 with aa.fractional

I was testing with different Netbeans versions and Java versions and the switch 
"-J-Dorg.netbeans.editor.aa.fractional=true -J-Dorg.netbeans.editor.view.settings.level=FINE". 
It seems that there is no difference between Java 1.7 and 1.8 or using the switch or not while NB 7.3.1 with Java 1.6 renders font much better.

IDE log:
DocumentView.updateFontColorSettings() Antialiasing Rendering Hints:
    Graphics: {Fractional metrics enable key=Integer text metrics mode, Text-specific LCD contrast key=140, Global rendering quality key=Default rendering methods, Global antialiasing enable key=Nonantialiased rendering mode, Stroke normalization control key=Default stroke normalization, Text-specific antialiasing enable key=Default antialiasing text mode}
    Desktop Hints: {Global antialiasing enable key=Antialiased rendering mode, Text-specific antialiasing enable key=Antialiased text mode}
    Extra Hints: {Fractional metrics enable key=Fractional text metrics mode}
updateCharMetrics(): FontRenderContext: AA=true, AATransformed=false, AAFractMetrics=true, AAHint=Antialiased text mode

I use OSX 10.9
Comment 51 tveimo 2013-11-18 14:27:10 UTC
Are the netbeans devs able to get any feedback from the jdk team about this issue?
Comment 52 Miloslav Metelka 2013-11-19 14:08:38 UTC
I've added some more AA command line parameters support described at
http://wiki.netbeans.org/EditorAntialiasing

http://hg.netbeans.org/jet-main/rev/eada3c10e3d9
Comment 53 Miloslav Metelka 2013-11-19 15:28:52 UTC
So IIUC the font rendering changed between Java 6 and Java 7 on Mac OSX (the native font rendering possibly changed to java's own font rendering) and so we can't resolve the problem in NB. Could anyone please check if the issue occurs when running NB 7.3.1 on both Java 6 and Java 7 (please check that you have one of the latest Java 7 versions when doing the comparison)? You can force the JDK by using --jdkhome command line parameter when running NB (possibly see http://wiki.netbeans.org/FaqStartupParameters for help). Thanks.
Comment 54 drillingman 2013-11-19 19:21:04 UTC
Using NB 7.3.1 with Java 1.7 is exactly the same rendering result as in NB 7.4 with Java 1.7 on  OS X (see my screenshot above, no difference to NB 7.4/1.7). 

So I am forced to use 7.3.1 with Java 1.6.

I will try your new switches later.
Comment 55 tveimo 2013-11-20 11:45:56 UTC
Regarding http://wiki.netbeans.org/EditorAntialiasing:

RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB is mentioned twice, assume one of them should be _VRGB. Is this reflected in the java code?

Regarding the actual setting options, somehow they still don't work. I can't even turn off antialiasing for text using .aa.text=off

Running with the command line options 

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dnetbeans.logger.console=true -J-ea -J-Dapple.laf.useScreenMenuBar=true -J-Dplugin.manager.check.updates=false -J-Dorg.netbeans.editor.aa.fractional=false -J-Dorg.netbeans.editor.view.settings.level=FINE -J-Dorg.netbeans.editor.aa=off -J-Dorg.netbeans.editor.aa.text=off"

doesn't provide non-antialiased text. So it appears there must be something somewhere else that overrides the swing 2D settings. Does the 'Desktop Hints' setting override the 'Graphics' setting? If it does, there's no wonder that it's not possible to turn off antialiasing, or turn on subpixel antialiasing.

This is with MacOS 10.9, jdk 1.8.0_111, netbeans dev 201311200002, producing the following debug output; 

DocumentView.updateFontColorSettings() Antialiasing Rendering Hints:
    Graphics: {Global rendering quality key=Default rendering methods, Stroke normalization control key=Default stroke normalization, Text-specific antialiasing enable key=Default antialiasing text mode, Fractional metrics enable key=Integer text metrics mode, Text-specific LCD contrast key=140, Global antialiasing enable key=Nonantialiased rendering mode}
    Desktop Hints: {Text-specific antialiasing enable key=Antialiased text mode, Global antialiasing enable key=Antialiased rendering mode}
    Extra Hints: null
Comment 56 tveimo 2013-11-20 11:48:07 UTC
Additionally, according to http://stackoverflow.com/questions/1910964/how-can-i-inherit-the-systems-anti-alias-setting-for-painting-text-to-off-scree,

"the subpixel AA hints appear to only be respected when painting directly to the AWT graphics context; when I paint to a double-buffer image it just does standard AA; but when I bypass the double-buffer image the subpixel AA is done."

So there might be some issues with netbeans use of double buffering and antialiased text. Is it possible to turn off double buffering to test this?
Comment 57 Miloslav Metelka 2013-11-21 09:56:03 UTC
(In reply to tveimo from comment #56)
> Additionally, according to
> http://stackoverflow.com/questions/1910964/how-can-i-inherit-the-systems-
> anti-alias-setting-for-painting-text-to-off-scree,
> 
> "the subpixel AA hints appear to only be respected when painting directly to
> the AWT graphics context; when I paint to a double-buffer image it just does
> standard AA; but when I bypass the double-buffer image the subpixel AA is
> done."
> 
I'll add a switch for RepaintManager.setDoubleBufferingEnabled().
Since "Extra Hints: null" it looks that the last commit is no in main-silver yet (it's only in jet-main so you would have to checkout and build jet-main). I'll add a switch and build a .jar for you.

Thanks for RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB - I've fixed that in the documentation; the changeset is fine.
Comment 58 tveimo 2013-11-23 09:53:51 UTC
Ok running on jet-main, I am actually able to turn off antialiasing completely. No subpixel rendering yet though. Did you get to implement the double buffer toggle?

Running with:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dnetbeans.logger.console=true -J-ea -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dplugin.manager.check.updates=false -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes -J-Dorg.netbeans.editor.aa.fractional=true -J-Do
rg.netbeans.editor.view.settings.level=FINE -J-Dorg.netbeans.editor.aa=on -J-Dorg.netbeans.editor.aa.text=hrgb

Gives this output

DocumentView.updateFontColorSettings() Antialiasing Rendering Hints:
    Graphics: {Text-specific antialiasing enable key=Default antialiasing text mode, Stroke normalization control key=Default stroke normalization, Global antialiasing enable key=Nonantialiased rendering mode, Global rendering quality key=Default rendering methods, Text-specific LCD contrast key=140, Fractional metrics enable key=Integer text metrics mode}
    Desktop Hints: {Text-specific antialiasing enable key=Antialiased text mode, Global antialiasing enable key=Antialiased rendering mode}
    Extra Hints: {Text-specific antialiasing enable key=LCD VRGB antialiasing text mode, Global antialiasing enable key=Antialiased rendering mode, Fractional metrics enable key=Fractional text metrics mode}
updateCharMetrics(): FontRenderContext: AA=true, AATransformed=false, AAFractMetrics=true, AAHint=LCD VRGB antialiasing text mode
Comment 59 tveimo 2013-11-23 11:47:26 UTC
Tried with -J-Dorg.netbeans.editor.double.buffered=false with no difference; still no subpixel antialiasing.
Comment 60 Miloslav Metelka 2013-11-25 12:38:14 UTC
The JComponent.setDoubleBuffered() is not honored even when called up in all parent components (sharing the same buffer).
 So the only way seems to be RepaintManager.setDoubleBuffered() which affects the whole app since RepaintManager.currentManager(Component) uses a shared instance.
 tveimo please try jet-main with the following changeset:
http://hg.netbeans.org/jet-main/rev/885e54ab9159
Comment 61 larsomat 2013-11-25 19:18:58 UTC
It seems to be a Java related problem. Netbeans and Java belong to the same company (Oracle). There should be a way to tackle this problem from the source... shouldn't it?
Comment 62 tveimo 2013-11-26 05:45:56 UTC
I can definitely see that double buffering gets turned off with that latest change. But still no subpixel rendering though. 

arsomat@netbeans.org is right in that it would be an idea to get a comment from the JDK guys as to under what circumstances the font renderer changes from subpixel to normal antialiasing.
Comment 63 Miloslav Metelka 2013-11-27 09:28:58 UTC
> I can definitely see that double buffering gets turned off with that latest
> change. But still no subpixel rendering though. 
I was asked if you could run NB 7.3.1 on 1.6 once with

-J-Dapple.awt.graphics.UseQuartz=true

and once with

-J-Dapple.awt.graphics.UseQuartz=false

Please attach the results to this issue. Thanks in advance.


> 
> arsomat@netbeans.org is right in that it would be an idea to get a comment
> from the JDK guys as to under what circumstances the font renderer changes
> from subpixel to normal antialiasing.

Yes, I've contacted AWT developers and they said that it looks like greyscale vs LCD problem (the subpixel rendering is missing).
 JDK7 still uses Apple's font rasterizer. Apple has maintained development of JDK6 and they used a lot of private Apple's APIs regarding font rendering. This was no longer possible for OpenJDK7 so Apple has contributed a modified port of that code. There used to be some greyscale vs LCD related problems in that contributed code.
Comment 64 tveimo 2013-11-27 14:54:53 UTC
Created attachment 142644 [details]
NB 7.3.1 with JDK1.6 and UseQuartz=false|true

Attached NB 7.3.1 with jdk 1.6 and UseQuartz=true|false. This is with "Merlo 12" as text-editor font.
Comment 65 drillingman 2013-11-27 19:35:22 UTC
Created attachment 142654 [details]
NB 7.3.1/Java 1.6 useQuartz true|false

I added a screenshot too with a dark background. It shows more clearly that the behaviour of this switch is the difference between good font rendering and the problematic NB 7.3 or 7.4 with Java 1.7.
Comment 66 dhatadi 2013-11-28 01:27:55 UTC
Using this version of Java seems to fix the problem, at least on Linux (CentOS release 5.6):

java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
Comment 67 tveimo 2013-11-28 10:46:25 UTC
Indeed it looks like 1.7.0_05 does render with subpixel antialiasing when fractional metrics are enabled. Font rendering is definitely subpar jdk1.6 using quartz though.
Comment 68 tveimo 2013-11-28 10:48:11 UTC
Created attachment 142668 [details]
NB 7.4-nightly w jdk1.7.0_05 vs jdk1.6.0 with UseQuartz=true
Comment 69 tveimo 2013-11-29 13:14:36 UTC
Tested working with jdk1.7.0_25, but not with jdk1.7.0_40, so something happened between those jdk releases.
Comment 70 tveimo 2013-12-05 12:40:47 UTC
I guess this bug can be closed, there's now sufficient support in netbeans to configure fonts, it's now really a JDK issue. 

According to this; https://bugs.openjdk.java.net/browse/JDK-8023794 a fix doesn't seem to be planned until JDK 9.
Comment 71 larsomat 2013-12-05 12:53:28 UTC
I think it should stay open until it's fixed in the JDK, even if the Netbeans team can't do anything about it, because this is a serious issue.

But I don't know how you generally handle those kinds of bugs here.
Comment 72 Miloslav Metelka 2013-12-05 14:38:59 UTC
I agree with tveimo to close this issue. This is a JDK problem that we cannot fix on NB side. The problem is covered by the existing issue https://bugs.openjdk.java.net/browse/JDK-8023794

I have transplanted all changesets of this issue (extra anti-aliasing command-line options) into release74 so that they will be part of 7.4 patch2:
f2ba621880bf transplanted to 00929006425e
eada3c10e3d9 transplanted to 3f8effd41707
1bcafecfb1f4 transplanted to d32741c7b1aa
885e54ab9159 transplanted to 5a43dad65cdf

Reassigning to platform/JDK problems.
Comment 73 Quality Engineering 2013-12-06 01:02:07 UTC
Integrated into 'releases/release74', will be available in build *201312052201* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/00929006425e
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #216655 - Font anti aliasing broken when using Java SE 7.
(transplanted from f2ba621880bf20b423ed9f4be4fa6f8ffe4044b7)
Comment 74 tveimo 2013-12-06 10:11:10 UTC
Any chance some pressure could be put on the JDK guys to prioritize font rendering for JDK 8? 

Also, it doesn't seem possible to vote for or comment on the OpenJDK bugs.
Comment 75 krur 2013-12-09 09:23:19 UTC
(In reply to Quality Engineering from comment #73)
> Integrated into 'releases/release74', will be available in build
> *201312052201* or newer. Wait for official and publicly available build.

i just tried latest nightly build.. but no improvements
Comment 76 tveimo 2013-12-09 10:42:31 UTC
If you'd read through the comments, you'd notice it only works for jdk 1.7.0 u25 or earlier, and then it doesn't render properly, due to a bug in the JDK that require fractional metrics to be enabled for subpixel font rendering. 

Thus, it's a JDK bug and needs a JDK fix.
Comment 77 Miloslav Metelka 2013-12-16 10:04:24 UTC
tveimo does https://bugs.openjdk.java.net/browse/JDK-8023794 cover the problem (my assumption) or not?

Just to clarify I assume that it does not help if you'd force an extra RenderingHints.VALUE_FRACTIONALMETRICS_ON by using

-J-Dorg.netbeans.editor.aa.fractional=true

on >1.7.0u25 or does it?
Comment 78 tveimo 2013-12-16 13:49:33 UTC
No it doesn't help.
Comment 79 tveimo 2014-01-06 06:11:40 UTC
mmetelka, sorry didn't see the first part of the question:

Bug https://bugs.openjdk.java.net/browse/JDK-8023794 only describes part of the problem, ie. whenever subpixel rendering is enabled on jdk1.7.0_25 or earlier, the font rendering is not acceptable. 

See left side of the picture here; https://bugzilla-attachments-216655.netbeans.org/bugzilla/attachment.cgi?id=142668

Fractional metrics makes subpixel rendering unusable on OSX. 


On jdk1.7.0_40 and later, subpixel rendering is not enabled simply by turning on fractional metrics, thus a separate jdk bug is required to describe this. Unfortunately, I don't have access to the jdk bug system. 

I've only seen this with netbeans, simple font rendering demo apps doesn't trigger it.

If you can get comments from the JDK guys on this issue, they can probably easily find out where things regressed between _25 and _40.
Comment 80 augf87 2014-01-09 04:36:23 UTC
Created attachment 143732 [details]
NB 7.4 w JDK 1.7.0_25

Running under Linux (Mint 16) I tried many JVM combinations (1.7.0_45, 1.7.0_25, 1.6.0_45) with NB 7.3.1 and 7.4. Still can't get antialiasing to get enabled in any way, the same look as the first time started remains.

I have already added in netbeans_default_options "-J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd -J-Dorg.netbeans.editor.aa.fractional=true".
Comment 81 tveimo 2014-01-27 15:08:48 UTC
Try using the parameters

-J-Dorg.netbeans.editor.aa.fractional=true -J-Dorg.netbeans.editor.view.settings.level=FINE -J-Dorg.netbeans.editor.aa.text=hrgb
Comment 82 tveimo 2014-01-27 15:20:02 UTC
augf87, your attachment shows fonts rendered using subpixel antialiasing. Did I misunderstand your question?
Comment 83 Jackie_Rosen 2014-02-16 11:24:31 UTC
SPAM - Removed by Administrator


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo