What could be preventing sub-pixel antialiasing for text?
I am trying to modify a local copy of the Batik framework to make it use sub-pixel antialiasing for text rendering but I cannot get it to work as something seems to be "blocking" it. In a draw() method where the text is actually rendered I have rewritten it just for debugging to setup sub-pixel antialiasing and render some arbitrary text but the text is rendered using a standard greyscale antialiasing. The exact same code produces true sub-pixel antialiasing when run in a separate program.
So, what could be preventing the text from being rendered with true sub-pixel antialiasing? Is there something in the Graphics2D object that might be set that would cause this? Could some form of double buffering be causing this?
This is the code I am using:
<br /> graphics2D.setPaint(new Color(0, 0, 0));<br /> graphics2D.setTransform(new AffineTransform());<br /> graphics2D.setFont(new Font("Segoe UI", Font.PLAIN, 13));<br /> graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);<br /> graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);<br /> graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST, 120);<br /> graphics2D.drawString("Some test text", 20, 20);<br />
As I said, if I run this code in a separate stand-alone program then the text is rendered properly.
I am using Java 6 Update 10 on Windows Vista.
And loving it,
-Qu0ll (Rare, not extinct)
[Replace the "SixFour" with numbers to email me]