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 137845 - [REGRESSION] Anti-aliasing is broken
Summary: [REGRESSION] Anti-aliasing is broken
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Settings (show other bugs)
Version: 6.x
Hardware: PC Windows Vista
: P2 blocker with 2 votes (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords:
: 139383 142211 144034 145450 145683 (view as bug list)
Depends on:
Blocks: 117369 123431
  Show dependency tree
 
Reported: 2008-06-20 20:19 UTC by _ gtzabari
Modified: 2008-09-05 17:59 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot (the top of the text file is especially bad!) (127.87 KB, image/png)
2008-06-20 20:21 UTC, _ gtzabari
Details
Screenshot from older release, this looks good! (122.08 KB, text/plain)
2008-06-20 20:34 UTC, _ gtzabari
Details
Older screenshot, this looks good! (122.08 KB, image/png)
2008-06-20 20:36 UTC, _ gtzabari
Details
screenshot of hudson-trunk-3663, JDK1.5.0_13-119, Mac OS X 10.5.4 (162.18 KB, image/png)
2008-09-03 15:51 UTC, Masaki Katakai
Details
this is a screenshot of trunk 3658 build on Mac OS X (244.23 KB, image/png)
2008-09-03 18:04 UTC, Masaki Katakai
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2008-06-20 20:19:54 UTC
dev build 200806201204
build 1.6.0_10-beta-b25

I upgraded from a dev build a week ago to this build. All of a sudden the fonts look a lot harder to read. It looks as
if something changed in terms of the anti-alias handling (I didn't change JDK version).
Comment 1 _ gtzabari 2008-06-20 20:21:53 UTC
Created attachment 63183 [details]
screenshot (the top of the text file is especially bad!)
Comment 2 _ gtzabari 2008-06-20 20:34:00 UTC
Created attachment 63184 [details]
Screenshot from older release, this looks good!
Comment 3 _ gtzabari 2008-06-20 20:36:00 UTC
Created attachment 63185 [details]
Older screenshot, this looks good!
Comment 4 _ gtzabari 2008-06-20 20:37:28 UTC
Please delete screenshot2.png uploaded on 19:34:00.

Then please compare screenshot.png to screenshot2.png as they show exactly what I'm talking about.
Comment 5 Peter Pis 2008-06-23 09:24:30 UTC
Reassigning to "editor".
Comment 6 Vitezslav Stejskal 2008-06-23 14:39:25 UTC
The editor on the first screenshot does not seem to be using antialiasing. There have been changes in the settings
infrastructure (see issue #90403). Could you please retry this with a fresh userdir? If the problem goes away, please
zip-up and attach your original userdir (ie. the contents under 'config/Editors' should be enough). Thanks
Comment 7 _ gtzabari 2008-06-23 18:23:35 UTC
The problem occurs even with a fresh userdir. It is especially pronounced in the "Norway Today" color profile.

BTW: Is anti-aliasing configurable from inside Netbeans? If so, where?
Comment 8 Vitezslav Stejskal 2008-06-24 10:50:30 UTC
> BTW: Is anti-aliasing configurable from inside Netbeans? If so, where?

No, it is not, but should become part of a coloring profile.
Comment 9 Vitezslav Stejskal 2008-06-26 13:46:23 UTC
What OS are you using? It seems to be working fine on my Ubuntu. That is anti-alias=off with JDK5 and anti-alias=on with
JDK6.

Product Version: NetBeans IDE Dev (Build 080626)
Java: 1.6.0_10-ea; Java HotSpot(TM) Client VM 11.0-b11
System: Linux version 2.6.22-15-generic running on i386; UTF-8; en_US (nb)
Userdir: /home/vita/devel/netbeans/main/nbbuild/testuserdir
Comment 10 _ gtzabari 2008-06-26 17:30:09 UTC
I am running under Windows Vista x64. I would appreciate it if you could increase the priority of this bug because it
prevents me from using newer dev builds. Normally I wouldn't mind the anti-aliasing setting too much but this particular
bug causes the fonts to become difficult to read (some lines render as less than one pixel wide) so I can't use it for
more than a few minutes before straining my eyes and eventually getting headaches.

BTW: Netbeans' about box doesn't really help identify your Java version. "Java: 1.6.0_10-ea; Java HotSpot(TM) Client VM
11.0-b11" doesn't tell me which update 10 build you're using. I'm running build 25, what about you?
Comment 11 _ gtzabari 2008-06-27 05:08:11 UTC
BTW: How do you switch anti-aliasing on and off?

PS: You won't notice this problem with the default profile because of the white background. You really must use "Norway
Today" to reproduce it.
Comment 12 _ gtzabari 2008-07-07 02:43:50 UTC
vstejskal,

I've answered all your questions and this issue is rather annoying. Is there anything more I can do on my side to speed
up a fix? I am concerned that the longer we get away from the date it got introduced, the harder it will be to track down.

At the very least, can we get someone from the Netbeans staff to try to reproduce the problem under Windows XP with the
latest dev build? I want to figure out whether this is Vista-specific or whether it occurs elsewhere.
Comment 13 _ gtzabari 2008-07-10 18:48:20 UTC
I found two possible workarounds:

1) If the default font is Monospace, you need to disable anti-aliasing across the entire OS by going into Control Panel
-> Appearance and Personalization -> Personalization -> Window Color and Appearance -> Open classic appearance
properties for more colors -> Appearance Settings -> Effects -> uncheck "Use the following method to smooth edges of
screen fonts"

This will result in jagged but readable fonts. If you do not disable Cleartype the Monospace font will render blurry and
hurts the eyes.

2) Change the default font from Monospace to Consolas which renders much nicer.
Comment 14 _ gtzabari 2008-07-14 23:08:01 UTC
This issue is also reproducible on 6.5 M1.
Comment 15 Petr Dvorak 2008-07-29 12:00:15 UTC
*** Issue 139383 has been marked as a duplicate of this issue. ***
Comment 16 Jiri Prox 2008-07-30 12:23:15 UTC
*** Issue 142211 has been marked as a duplicate of this issue. ***
Comment 17 Jiri Prox 2008-07-30 12:30:33 UTC
*** Issue 142211 has been marked as a duplicate of this issue. ***
Comment 18 Petr Dvorak 2008-07-30 17:37:55 UTC
Hi! Try to start NetBeans from the command line using:

"netbeans.exe -J-Dswing-aatext=false" or "./netbeans -J-Dswing-aatext=false"

This should disable anti-aliasing, right?
Comment 19 _ gtzabari 2008-07-30 17:39:33 UTC
Yes that will disable anti-aliasing. Then you have to put up with the case of the jaggies ;)

Has any Netbeans staff been able to reproduce this problem?
Comment 20 Vitezslav Stejskal 2008-08-18 12:36:39 UTC
*** Issue 144034 has been marked as a duplicate of this issue. ***
Comment 21 deftex 2008-08-19 18:19:56 UTC
I don't know if this posting will help any, but I followed a suggestion from vstejskal re: issue 144034 (which has been marked as a duplicate of this issue) 
to set a new userdir (using the 6.5 beta, by changing entry in netbeans.conf) and it fixed my IDE font problems:

Here's my message on that issue:

"As you suggested, I have changes the userdir and the ide fonts are rendered perfectly.

I guess it must be some setting brought in from 6.1 that screws up the 6.5 ide font rendering?

I now have a usable IDE - many thanks.

Nevertheless, the importing of previous settings should not screw the IDE up like this, so I guess there is some work to do to stop that happening?"

Comment 22 _ gtzabari 2008-08-19 18:28:52 UTC
I guess I need to give this issue a second try. When I first reported it using a fresh userdir (not importing from 6.1
or anything) did not fix the problem. Perhaps something has changed in the meantime. I'll report back soon with what I find.
Comment 23 _ gtzabari 2008-08-19 19:11:15 UTC
I can still reproduce this bug in 6.5 dev build 200808190201 and 6.5 M2 with a fresh userdir.

BTW: I should clarify, there are three kinds of renderings modes you should watch out for:

1) Anti-aliasing fully disabled
2) Emulated Anti-aliasing enabled (Rendered by Java)
3) Native Anti-aliasing enabled (Rendered by Windows)

The bug I am reporting is that #3 used to work in Netbeans 6.1 and now only #2 works. The rendering is noticeably worse
as the screenshots show.

deftex, are you sure you're not simply moving from #1 to #2? Also, what operating system are you using?
Comment 24 _ gtzabari 2008-08-19 19:23:03 UTC
By the way, Netbeans 6.5 dev build June 11th, 2008 had anti-aliasing working perfectly (I used a local copy to confirm
this fact) and if I remember correctly the dev build around two weeks later had it was broken. At the very least you now
have a specific version number where you know this was working. Hopefully you can diff against it to see what's changed.
Comment 25 Vitezslav Stejskal 2008-08-21 14:54:26 UTC
This may sound stupid, but how do you tell the difference between #2 and #3? What should we be looking at? Is this even
possible on linux? Can this somehow be controlled on the JDK level (eg. some property)? Thanks
Comment 26 _ gtzabari 2008-08-21 19:23:00 UTC
Take a look at the screenshots I've attached. If you compare the letters "e" and "c" in the screenshots you will notice
that in screenshot.png they are semi-transparent and more jagged than in screenshot2.png. In the latter, all characters
are solid (easier to read) and smooth.

Take a look at http://www.ffnn.nl/pages/articles/java/java-2-se-6.0-aesthetics-preview.php and
http://www.nabble.com/Menu-fonts,-ClearType,-and-Windows-td12959314.html for more discussion with respect to what
happens on Linux.

In short, I don't think there is a system property for toggling the behavior and it seems that native rendering (#3)
only occurs under Windows. Linux only supports sub-pixel rendering (#2)
Comment 27 Petr Jiricka 2008-08-22 08:30:10 UTC
Given the number of duplicates, I would say this should be raised to P2.
Comment 28 Torbjorn Norbye 2008-08-22 18:52:42 UTC
From Ruby alias discussion:
I'm a bit puzzled. You said that Native Windows rendering was working for you a while back with a specific NetBeans build.

That should not be possible - that is only supported by the upcoming Java 6 Update N release.  I wrote about this (as a
followup to an older font rendering thread referenced from this issue) here:
http://www.nabble.com/Re%3A-Menu-fonts%2C-ClearType%2C-and-Windows----Hopefully-Fixed-p15704395.html

Is it possible that the given NetBeans build happened to be pointing (via etc/netbeans.conf's jdkhome setting) to an
early access release of JDK6updateN, and your other builds are not?  What happens if you try a current 6.5 build with
JDK6 update N, does it look the way you want?
Comment 29 _ gtzabari 2008-08-22 20:01:52 UTC
I've been using Java6 Update N for all releases mentioned in this issue, which is why I expect this to work. But thanks
for pointing it out, can someone from the Netbeans staff please try reproducing this issue with the Update N release?
Comment 30 Petr Dvorak 2008-08-31 00:24:24 UTC
I agree with pjiricka...
Comment 31 Petr Dvorak 2008-08-31 00:32:22 UTC
*** Issue 145683 has been marked as a duplicate of this issue. ***
Comment 32 Jiri Prox 2008-09-01 12:37:57 UTC
*** Issue 145450 has been marked as a duplicate of this issue. ***
Comment 33 Jan Becicka 2008-09-02 14:09:02 UTC
Vito, please take a look at it. Thanks.
Comment 34 Vitezslav Stejskal 2008-09-02 16:47:06 UTC
I tried it on Windows Vista and I can confirm that the native antialiasing is not used in Netbeans editor. I checked 
both Norway Today and the default themes and here are my findings:

1. The JVM correctly recognizes -Dswing.aatext=<true|false> flag and turns antialiasing on/off.
2. By default (no swing.aatext specified) antialiasing is on.
3. However, it is always only the emulated antialising and never the native Windows one. I checked that by taking 
screenshots of Netbeans, saving them as PNG and zooming in on text to see what pixels are there. If I get Gilis 
explanation correctly pixels around text rendered with the emulated antialising algorithm are all in grades of shade 
(with white background), while with native antialiasing the pixels are in different colours.

Now, the problem really seems to be only in the Netbeans editor, because when I zoomed in on the main menu bar I could 
see coloured pixels around text. But in the editor only the grades of shade. I have no idea why this is so, but I'm 
pulling the sourcebase now and will experiment with the rendering hints we use in the editor and see if I can find the 
right ones.

Product Version: NetBeans IDE Dev (Build 200809020201)
Java: 1.6.0_10-rc; Java HotSpot(TM) Client VM 11.0-b15
System: Windows Vista version 6.0 running on x86; Cp1250; cs_CZ (nb)
Userdir: C:\Users\vita\.netbeans\dev

java version "1.6.0_10-rc"
Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b28)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
Comment 35 Miloslav Metelka 2008-09-03 09:09:59 UTC
Not sure but this could be because other components are from the windows L&F while our editor is rendered entirely by us.
I'll try to find out whether there's any special hint in the rendering hints map that the windows L&F could turn on when
on windows.
Comment 36 Vitezslav Stejskal 2008-09-03 11:38:03 UTC
I just pushed fix for this. According to my tests the editor is now using native antialiasing (if available). That is, 
I can now see cloured pixels around text in the editor.

Gili (and others), could you please download a build, which contains the changset below and confirm that the 
antialiasing in Netbeans editor is now working according to your expectations? You can either use Hudson trunk builds 
from http://deadlock.netbeans.org/hudson/job/trunk/ or development builds from netbeans.org. Thanks

http://hg.netbeans.org/main/rev/06619e663be5
Comment 37 Masaki Katakai 2008-09-03 15:43:52 UTC
I tried hudson-trunk-3663 on Mac OS X. Glyphs in editor are different from previous one (I used 3658). It looks
antialiasing is not working.
Comment 38 Masaki Katakai 2008-09-03 15:51:51 UTC
Created attachment 68956 [details]
screenshot of hudson-trunk-3663, JDK1.5.0_13-119, Mac OS X 10.5.4
Comment 39 Quality Engineering 2008-09-03 17:28:07 UTC
Integrated into 'main-golden', will be available in build *200809031401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/06619e663be5
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #137845: use system default value for KEY_TEXT_ANTIALIASING unless forced to turn it off
Comment 40 _ gtzabari 2008-09-03 17:50:00 UTC
masaki,

Can you please attach a screenshot of what it looked like before? That is, the exact same content using the two
different builds.
Comment 41 Masaki Katakai 2008-09-03 18:04:09 UTC
Created attachment 68976 [details]
this is a screenshot of trunk 3658 build on Mac OS X
Comment 42 _ gtzabari 2008-09-03 18:16:24 UTC
The trunk 3658 version does look softer, though not as good as I would expect from a native renderer. For example, take
a look at "URLDisplayer" in the import section. It looks a bit fuzzy on my monitor.

Taking a look at the changeset, I'm not sure why this would break anything under MacOSX. I assume you have anti-aliasing
enabled in your OS (the equivalent of ClearType)?

I'm still waiting for the main-golden code drop to confirm whether this fixes anything under Windows because I don't
know how to install the hudson builds. Once we establish that we should investigate whether we see the same problem when
comparing JDK 1.5 to 1.6 update 10 on Windows. Ideally we should find out whether this is a JDK version issue or a
platform specific issue. I think it is fair to say this issue needs to be reopened until it works fine under Mac as well.
Comment 43 Torbjorn Norbye 2008-09-03 19:22:58 UTC
Hi Vita, on Mac OSX, change 06619e663be5 made things worse. I think it's best to special-handle that platform. The JVM
will do antialiasing on its own, so on that platform it's probably best to leave the JDK aliasing flags alone.
Comment 44 _ gtzabari 2008-09-03 19:25:41 UTC
Is there such a thing as Java 6 or Java6 update 10 on MacOSX? Has anyone tried this fix against those versions?
Comment 45 Vitezslav Stejskal 2008-09-03 19:33:13 UTC
> needs to be reopened until it works fine under Mac as well

Sure. I've another independent complaint from Tor that antialiasing is not working on Mac.


> Taking a look at the changeset, I'm not sure why this would break anything under MacOSX. I assume you have
> anti-aliasing enabled in your OS (the equivalent of ClearType)?

Well, it could. With the changeset if there are any desktopHints they will be used without change unless atialiasing is
explicitly turned off. The problem could be that Mac OS X uses JDK5, where antialiasing is turned off by default.

Anyway, Masaki, could you please start Netbeans with
'-J-Dorg.netbeans.modules.editor.settings.storage.fontscolors.CompositeFCS.level=FINE' and send me the log file (or
attach it here)? It should contain a message saying whether the antialiasing is on or off and why. Thanks
Comment 46 Torbjorn Norbye 2008-09-03 20:07:33 UTC
When I start the IDE on OSX with that logging flag, I get these two entries in the console:
FINE [org.netbeans.modules.editor.settings.storage.fontscolors.CompositeFCS]: Text Antialiasing was set ON by running on
Mac OSX.
FINE [org.netbeans.modules.editor.settings.storage.fontscolors.CompositeFCS]: Text Antialiasing was set ON by running on
Mac OSX.
Comment 47 _ gtzabari 2008-09-04 06:31:25 UTC
Hallelujah! My eyes.... they can see again! The latest build fixes ClearType rendering under Windows Vista 64-bit :)

By the way, I posted a question to the Java2D team regarding ClearType rendering:
http://forums.java.net/jive/thread.jspa?threadID=46572

Hopefully there is a more solid way of patching this... At the very least we should discuss what action to take on
platforms that have anti-aliasing disabled by default, such as JDK5 (which is mainstream on Mac). If the Netbeans team
wishes to override this default (I suspect this is what users want) then you should probably update the patch accordingly.

vstejskal, thanks again for fixing this issue! It's been bugging me for a very long time now :)
Comment 48 Vitezslav Stejskal 2008-09-04 15:20:33 UTC
Thanks to everybody for testing this. I just pushed another patch to trunk. Tested myself on Ubuntu and Vista with JDK5
and 6. Tor, Masaki, could you please try it on Mac. The changeset is http://hg.netbeans.org/main/rev/327e74fde286. If
you guys confirm that text AA is back to normal on Mac I'll close this issue as FIXED. Thanks


Here is a little story for those who have time to read it:

> Hi Vita, on Mac OSX, change 06619e663be5 made things worse. I think it's best to special-handle that platform.
> The JVM will do antialiasing on its own, so on that platform it's probably best to leave the JDK aliasing flags alone.

I understand that JVM can do antialiasing by itself, if it is instructed to do so. And that is the problem. JDK5 does
not detect OS Font AA settings at all, JDK6 can detect these settings on _some_ systems. So, the problem is not in the
rendering itself, but in detecting the rendering hints that the JVM should used. JDK6 seem to detect OS settings
correctly on Windows (I tried Vista, but from what I've read it should work well on XP too) and GTK (maybe others too).
But apparently on Mac the JDK does not detect the OS AA settings (according to Tor's log messages posted here).

We (Netbeans) have been advertising 'swing.aatext' system property for turning text AA on/off in JVM. According to what
I've learned so far this is wrong. The property does nothing; JVM does not recognize it (I can confirm this on JDK
1.5.0_14 and 1.6.0_10ea). However, Netbeans do (!) recognize this property and try to set correct rendering hints. The
problem here is that the rendering hint used for text AA are not a simple on/off flag. There is a handful values that
you can use and which have to do with how your screen (LCD) physically works with pixels. Don't ask details, because I
don't understand it at all. So, we can comfortably tell JVM to turn text AA off if -Dswing.aatext=false, but we have no
idea what hint we should use when -Dswing.aatext=true and so we defensively use the hint that turns on the emulated AA
mode. This is the best we can do (without some fancy GUI customizer) if JVM can't detect OS AA settings. On the other
hand if JVM detected the OS AA settings and they contain one of the 'AA is on' values we should not interfere.

Some interesting links:
http://java.sun.com/javase/6/docs/api/java/awt/doc-files/DesktopProperties.html
http://java.sun.com/javase/6/docs/technotes/guides/2d/flags.html#aaFonts
Comment 49 _ gtzabari 2008-09-04 17:02:34 UTC
vstejskal, what was the value of KEY_TEXT_ANTIALIASING before Netbeans changed it to VALUE_TEXT_ANTIALIAS_ON?

Also be sure to check the discussion at http://forums.java.net/jive/thread.jspa?messageID=297224
Comment 50 Torbjorn Norbye 2008-09-04 17:40:26 UTC
Hi Vita,
I updated my build and everything is fine on OSX now.
Comment 51 Masaki Katakai 2008-09-05 03:58:02 UTC
New build is fine on my Mac too. Great!
Comment 52 Quality Engineering 2008-09-05 06:07:03 UTC
Integrated into 'main-golden', will be available in build *200809050201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/327e74fde286
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #137845: a few more adjustments to correctly support text AA on Mac OS; also ignoring the old 'textAntialiasing' setting
Comment 53 Vitezslav Stejskal 2008-09-05 08:50:51 UTC
Masaki, Tor, thanks for checking. I'm marking this as FIXED.


> vstejskal, what was the value of KEY_TEXT_ANTIALIASING before Netbeans changed it to VALUE_TEXT_ANTIALIAS_ON?

With JDK6 on Vista and Ubuntu/Gnome it is exactly what I specify in the OS. That is, on my laptop it's
VALUE_TEXT_ANTIALIAS_LCD_HRGB. I tried changing the OS settings and they were reflected, so the detection algorithm in
JDK6 works ok.

As far as I understand it VALUE_TEXT_ANTIALIAS_ON refers to the emulated AA mode and has been available at least since
JDK5. Basically, the values *_OFF and *_DEFAULT mean that AA is off, any other value (a) means that AA is on and (b)
specifies the actual rendering algorithm used.


> Also be sure to check the discussion at http://forums.java.net/jive/thread.jspa?messageID=297224

Yes, I'm following that discussion.
Comment 54 _ gtzabari 2008-09-05 16:02:22 UTC
There is a typo in your patch ;) Search for "oficial".

Also, I filed issue 146336 for handling runtime changes to the anti-aliasing setting. Right now it hangs Netbeans hard
and the entire IDE must be killed. It could be really hanging or perhaps the rendering is just dieing somewhere. Either
way this needs to be fixed.
Comment 55 philrace 2008-09-05 17:59:10 UTC
>As far as I understand it VALUE_TEXT_ANTIALIAS_ON refers to the emulated AA mode 
> and has been available at least since JDK5.

I can tell you quite definitely that "ON" means use a greyscale AA algorithm
and goes back to JDk 1.2 (1998).
People who complaine about "fuzziness" were perhaps seeing the editor (or
something else) hardwiring the value to "ON", rather than the desktop setting.
The NB editor used to do this once upon a time.

> Basically, the values *_OFF and *_DEFAULT mean that AA is off,

True for sun implementations, but I believe Apple use something else as default.

> any other value (a) means that AA is on and (b) specifies the actual rendering algorithm used.

That is correct, although values like "GASP" (== windows 'Standard Font Smoothing') obeys
info in the font which typically says do B&W at screen resolutions. People find this surprising
buts its correct.

-phil.