Java 8 vs. Java 9 rendering

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
iidennku4
Posts: 1
Joined: Thu Aug 05, 2021 6:54 pm
antibot: No, of course not.

Java 8 vs. Java 9 rendering

Post by iidennku4 » Thu Aug 05, 2021 7:32 pm

I have a unit test that uses ChartFactory.createXYLineChart and calls JFreeChart.createBufferedImage(). I am trying to get the same pixels when the code is run under either Java 8 or Java 9, and when run on the local machine vs. run on the continuous integration machine. However, the changes under the hood in the JDK are making this difficult. Initially, there were many differences in the chart title and the square border of the chart. I tried turning off anti-aliasing, e.g.,

chart.setRenderingHints(new RenderingHints(
ImmutableMap.<Key, Object> builder()
.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)
.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY)
.build()));

but there's still a pixel that differs in the capital letter "C" of the chart title. Is it actually possible to get the text to render the same between Java 8 and Java 9, and on different machines with potentially different scaling/resolution options? I am not sure what other options exist that I can use to tinker with the rasterized image output.

Locked