JDK-4502804 : FontSmoothing/AntiAlias not utilized by default despite OS setting
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0,1.4.1,1.4.2,5.0
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2001-09-13
  • Updated: 2005-05-31
  • Resolved: 2005-05-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 betaFixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description

Name: bsT130419			Date: 09/13/2001


java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

or

java version "1.4.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)


This is reproducible on 98,ME,2000 & XP.

* From right click on desktop click "Properties"

* From the plus tab select font smoothing (or clear type from XP's
Appearance/Effects/Font Smoothing ... where it's more obvious)

* Apply the settings.

* Inspecting any TTF/OTF font from any (non-java) program in detail should
reveal anti-aliasing behavior (this will not apply to rasterized fonts such as
System or Lucidia or Courier ). A typical example may be courier new italic
under notepad at a large size. Notice the smoothness of an l or I when it is
italic.


* Go to %JAVA_HOME% (pick your favorite jdk) and run the stylepad demo
in /demo/jfc/Stylepad with ../../../bin/java -jar Stylepad.jar

* Compare the results to what you saw with notepad. Pick any equivalent font.
Set the size equally high. It will be jagged. There will be no way (other then
to set the Rendering hint programmatically to force anti-aliased output) to
produce anti-aliased results.

It would be nice if this setting followed the OS default.

The antialias setting is a combination of the font-quality flag passed in at
the time the font is created (it should be highest-quality not 0 ) and the
surface the text is drawn on (printers for example are not antialiased).

I have tried to modify this default by search/replacing the font quality on
all create fonts that I could find in awt.dll and jawt.dll without success
which leads me to believe the problem is related to the property of the
drawing surface or a font created in Graphics2D. I would bet that a flag on
the creation of the drawing surface would fix the problem.
(Review ID: 131598) 
======================================================================

Comments
EVALUATION This is an interesting idea that deserves further investigation. ###@###.### 2001-11-14 This has been implemented for Gnome (5030990), so that this bug is now just against Windows. A bug was recently filed against this (5057309), here is the evaluation from that bug: From Phil: > If you look closely at a windows desktop you'll > see that asking windows to do A-A does *NOT* A-A all or even most text. > We have no way to express that and in fact at almost all typical > GUI sizes fonts say "please do NOT AA me". This is in the > table of a TrueType/OpenType font and almost all fonts say not > to do so for 7->14 pts which is the size range you'll see in most GUIs. > So by turning it on on windows in a blanket fashion we'd actually >be more divergent than we are now! > > Addressing this needs a new hint or other mechanism and additional > supporting code etc. Additionally our use of composite fonts makes this a bit tricky: > We'd probably have to pick the behaviour of just one > of those fonts, probably slot 0. To do otherwise a > single string would be drawn with AA and non AA glyphs > which would not only look weird but be a nightmare for > our blitting loops. The customer also added: > I took a screenshot of my Windows XP desktop with zoomed-in parts of > various text. I posted it at http://kano.net/in/desktop. When you look > at the image you will see that there is no text on my desktop nor on any > of the open program windows, which is not anti-aliased. I did not enable > anything special to do this. And Phil comments: > I looked at the snapshot and it was immediately obvious > that's because he's enabled ClearType anti-aliasing, not > standard anti-aliasing. > > ClearType works differently and always > anti-aliases. If he switches back to "standard" he will see > the behaviour I described. Its accessed in the same place > as the standard smoothing user option, its just a different option. > > We have an existing RFE (which you are welcome to look up > as I don't have the bug ID handy) to implement something similar > to cleartype. So, there are two issues here: 1. We need a way to get whether or not we should turn on AA for the font we're using, this will come from 2d. 2. We need to support clear type. The 2nd issue is already filed as 4871297 which is waiting on the 2d bug 4726365, so this bug is now just against 1. ###@###.### 2004-06-04 The 2D bug for 1 is 5057760. ###@###.### 2004-06-04 4726365 and 5057760 have been implemented, as well as 4871297 which enables the AA settings for the platform look and feels. This bug is being marked fixed to reflect that Swing's Java Look and Feel (Metal) also now picks up on start up (or L&F installation), the same desktop font AA settings and applies them. This doesn't change the font that Metal uses, but it picks up the AA technique that the host OS desktop would use for the Metal font and is applied automatically applied (ie by default as requested). ###@###.### 2005-05-19 18:21:16 GMT
2005-05-19

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
2004-10-02

WORK AROUND Name: bsT130419 Date: 09/13/2001 Set the anti-aliasing render hint on the object before drawing to it however this is distinctly different then using the windows os to do font aliasing b/c the font metrics are forced to be the same aliased or not (unlike java which antialiasing will change the font metrics ). Also windows forces the font smoothing on programs rather then programs having to specifically have built- in support for it. Thus it's relatively low-impact to make the change to the jdk (even a properties setting would be cool ). ======================================================================
2004-10-02