JDK-6999513 : Subpixel antialiasing for text disabled when enabling graphics antialiasing
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u22
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2010-11-12
  • Updated: 2012-03-20
  • Resolved: 2011-03-11
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
Subpixel (LCD) antialiasing is erroneously disabled when the graphics antialiasing has been enabled.

When

KEY_ANTIALIASING=VALUE_ANTIALIAS_ON
KEY_TEXT_ANTIALIASING=VALUE_TEXT_ANTIALIAS_LCD_HRGB

text is drawn with greyscale antialiasing.  However, when

KEY_ANTIALIASING=VALUE_ANTIALIAS_OFF
KEY_TEXT_ANTIALIASING=VALUE_TEXT_ANTIALIAS_LCD_HRGB

text is drawn with proper LCD antialiasing.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
g2d.drawString("hello",0,0);


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The text antialiasing hint processing should not be disabled by the state of the graphics antialiasing hint value.
ACTUAL -
Subpixel LCD text antialiasing is disabled by setting the state of the graphics antialiasing hint value to ON.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
This behavior can also be reproduced in the Swing Font2DTest, which under the covers sets or clears the graphics antialiasing hint.  If you modify the source in FontPanel.java to always enable graphics antialasing, you will see the problem.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Set

KEY_ANTIALIASING=VALUE_ANTIALIAS_OFF

prior to drawing text.

In Swing applications, the workaround might involve overriding component or ui delegate classes.

Comments
EVALUATION Fixed in JDK 7 as 6263951: Java does not use fast AA text loops when regular AA hint is set
11-03-2011