This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 177249 - Blurry font rendering, Netbeans must use Quartz on Mac OS X
Summary: Blurry font rendering, Netbeans must use Quartz on Mac OS X
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 6.x
Hardware: Macintosh (x86) Mac OS X
: P3 normal (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-19 16:35 UTC by plexi59
Modified: 2010-07-08 09:09 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Rendering of fonts with default settings (625.47 KB, image/png)
2009-11-24 22:22 UTC, plexi59
Details
Rendering of fonts with Quartz enabled (667.78 KB, image/png)
2009-11-24 22:27 UTC, plexi59
Details

Note You need to log in before you can comment on or make changes to this bug.
Description plexi59 2009-11-19 16:35:28 UTC
Repro:
1. Download and install Netbeans 6.7.1 on Mac OS X Snow Leopard with Java 1.6.0_15 (I believe this reproduces in Leopard as well).
2. Observe that fonts are blurry and hard to read.
3. Find the netbeans.conf file and add -J-Dapple.awt.graphics.UseQuartz=true to netbeans_default_options
4. Restart the IDE
5. Observe much better font rendering.

Result:
Without Quartz, the IDE is unusable due to poor font rendering which causes eye strain.

Expected result:
Netbeans IDE should use the better Quartz rendering on Mac OS X by default.
Comment 1 Ondrej Langr 2009-11-24 07:58:54 UTC
Can not reproduce on java 1.6.0_15. Fonts seem to be clear. 

Can you please attach screenshots?
Comment 2 plexi59 2009-11-24 22:22:28 UTC
Created attachment 91640 [details]
Rendering of fonts with default settings

Notice that grayscale font smoothing is used. This is particularly noticeable on lower contrast fonts, e.g. gray comments or pink class names.

The next attachment will show font rendering of the same exact code fragment, but with Quartz enabled.
Comment 3 plexi59 2009-11-24 22:27:28 UTC
Created attachment 91641 [details]
Rendering of fonts with Quartz enabled

Notice how much crisper the fonts are with Quartz subpixel rendering. Still not as crisp as in Windows version, but much more pleasant to look at for extended periods of time.

All that needs to be done to get this rendering is -J-Dapple.awt.graphics.UseQuartz=true needs to be added to netbeans_options in netbeans.conf

You might also want to add -J-Dfile.encoding=UTF-8 there while you're at it, so that Netbeans would save text files in UTF8 (as opposed to MacRoman) by default. I could file a separate bug on that, if you'd like.
Comment 4 Ondrej Langr 2009-11-26 05:52:26 UTC
Thanks for the analysis! (and yes, please file a standalone issue for the utf encoding, to track these two separately)

I don't know much about Quartz rendering I admit, but based on the screenshots I agree it should be on by default if there are no possible side-effects. 

Reassigning to editor (hope it's the correct component) for implementation ..
Comment 5 Vitezslav Stejskal 2010-05-19 13:40:20 UTC
http://hg.netbeans.org/jet-main/rev/4ecfb51a71fb
Comment 6 Quality Engineering 2010-05-20 06:16:09 UTC
Integrated into 'main-golden', will be available in build *201005192201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/4ecfb51a71fb
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #177249: adding -J-Dapple.awt.graphics.UseQuartz=true
Comment 7 Torbjorn Norbye 2010-05-20 14:20:09 UTC
The Quartz rendering is using the native rendering pipeline on Mac. This was the default in JDK5 on the Mac. In JDK6 (which is the only available JDK on Mac Snow Leopard), Apple changed the default and turned off Quartz and enabled the default JDK rendering pipeline.

What I -don't- know is WHY Apple turned off Quartz, but I do know that there are some associated memory leaks with it, and I believe that it used to cause problems for the UML support in NetBeans.  Vita, maybe you should check with any graphics-teams (e.g. mobile editor, javafx team) to make sure they aren't affected by this change the way UML used to be.

I personally run with Quartz turned on, and have for a couple of years (since the default was changed). The text rendering is much better.

But what I -don't- understand is why, on Mac, the JDK rendering pipeline doesn't give proper LCD antialiasing!  It -does- do that on all other platforms, so why it doesn't work on the Mac is not clear to me. The following article seems to indicate that it's because it needs a couple of different rendering hints set:

http://stackoverflow.com/questions/2023579/java-font-rendering-redux-must-general-aa-really-be-turned-off-for-subpixel-a

Vita, I know the editor sets some rendering hints etc during its painting. If we can adjust the flags such that the JDK rendering pipeline can be used instead of Quartz, I think that would be better; it would be the same codepath as on other platforms, and obviously Apple must have turned off Quartz for a reason. (The JavaFX release notes mention a number of leaks and other issues, but it's possible that NetBeans doesn't trigger these nearly as much as JavaFX since JavaFX is much heavier on using it for drawing all kinds of shapes, effects, etc.)
Comment 8 Torbjorn Norbye 2010-05-20 19:15:12 UTC
Actually, I hadn't read that article very carefully. It doesn't look like the rendering hints actually work on the Mac, just elsewhere. I don't know why subpixel rendering doesn't seem to work on the Mac with the sun pipeline since it works on other platforms...?
Comment 9 Vitezslav Stejskal 2010-05-21 07:10:58 UTC
Tor, thanks a lot for all this info. I'll make some more investigation...
Comment 10 Vitezslav Stejskal 2010-05-21 09:45:16 UTC
-J-Dorg.netbeans.modules.editor.settings.storage.fontscolors.CompositeFCS.level=FINE can be used to see what rendering hits are used by the editor. On my Mac KEY_TEXT_ANTIALIASING = VALUE_TEXT_ANTIALIAS_ON. This value is good for CRT, but on LCD one of the *_LCD_* constants should be used - most likely VALUE_TEXT_ANTIALIAS_LCD_HRGB.

The value is obtained from "awt.font.desktophints" desktop property, which is supplied by JDK. And so it looks like that JDK6 on Mac does not detect/set the desktop hints correctly.
Comment 11 Vitezslav Stejskal 2010-05-21 10:07:09 UTC
http://hg.netbeans.org/jet-main/rev/0ee3981678ff - no fix, just logging
Comment 12 Torbjorn Norbye 2010-05-25 22:01:34 UTC
Regarding "And so it looks like that JDK6 on Mac does not detect/set the
desktop hints correctly.":  I heard from an Apple VM engineer that LCD subpixel rendering is only implemented in the Quartz rendering engine, NOT in their alternative path. So no amount of fiddling with rendering hints will make this work, the only way to get LCD text is with Quartz on. But he also stated that Quartz is supported. (See comment from Mike at http://blogs.sun.com/tor/entry/lcd_sub_pixel_rendering#comments )
Comment 13 Vitezslav Stejskal 2010-05-26 06:14:46 UTC
Thanks Tor. I think we are done then.
Comment 14 plexi59 2010-06-16 05:08:02 UTC
The isssue is still there in 6.9 which I have just downloaded and installed. The same parameter fixes it.
Comment 15 Vitezslav Stejskal 2010-06-17 10:04:30 UTC
(In reply to comment #14)
> The isssue is still there in 6.9 which I have just downloaded and installed.
> The same parameter fixes it.

Umm, could you please check that your <nb69-inst>/etc/netbeans.conf contains -J-Dapple.awt.graphics.UseQuartz=true?
Comment 16 plexi59 2010-06-17 17:05:47 UTC
No, it did not. If I add it there by hand, the issue goes away.
Comment 17 Vitezslav Stejskal 2010-06-18 06:21:55 UTC
Ah, now I understand. The issue is fixed in trunk, but not in release69 repository. The reason for that is that the fix was delivered after the clone had been created and the issue was not a showstopper for 6.9 release. (also see target-milestone == next) I'm marking this as 6.9.1_CANDIDATE so that the fix could be ported to release691 repository.

Could you please try downloading a recent dev build and confirm that the problem is really fixed there? Thanks a lot
Comment 18 rbalada 2010-06-21 16:01:12 UTC
Please verify bugfix for this bug, so it can be integrated into release691 repository.

Thanks,
-R
Comment 19 Peter Pis 2010-06-23 08:56:11 UTC
Verified in
Product Version: NetBeans IDE Dev (Build 201006230001)
Comment 20 rbalada 2010-06-23 09:23:08 UTC
main #4ecfb51a71fb ported to release691 #65c55daeb9fd
Comment 21 Jaromir Uhrik 2010-07-08 09:09:38 UTC
Verified in the following 6.9.1 build:
Product Version: NetBeans IDE 6.9.1 Dev (Build 201007062301)
Java: 1.6.0_20; Java HotSpot(TM) 64-Bit Server VM 16.3-b01-279
System: Mac OS X version 10.5.8 running on x86_64; MacRoman; en_US (nb)

The quartz (-Dapple.awt.graphics.UseQuartz=true) switch is now on by default - the switch is visible in the IDE log.