I thought I had made the necessary modifications to achieve true sub-pixel
antialiasing in Batik but after consultation with Stuart Pook I have found
that this is not the case. This is proving very problematic.
So, what would prevent Batik from rendering text using true sub-pixel
antialiasing? I have gone through the entire Batik code base and changed
everything that looked relevant but it still doesn't work. I have even gone
to the extent of replacing the code in the draw() method of
AWTGVTGlyphVector where the text is actually rendered with this:
graphics2D.setColor(Color.BLACK);
graphics2D.setPaint(new Color(0, 0, 0));
graphics2D.setTransform(new AffineTransform());
graphics2D.setFont(new Font("Segoe UI", Font.PLAIN, 13));
graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
graphics2D.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_PURE);
graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST, 120);
graphics2D.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
graphics2D.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
graphics2D.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
graphics2D.drawString("Some test text", 20, 20);
As you can see, I am setting every possible relevant rendering hint to
achieve sub-pixel antialiasing and this code fragment produces the desired
results when used outside of the Batik context. But within Batik, the text
is rendered using standard antialiasing only.
It seems that something in either the graphics configuration or component
configuration within this Batik method is preventing true sub-pixel
antialiasing from happening even though I am explicitly requesting it. What
could possibly be causing this?
Thanks,
-JCT