Fonts changed from 1.0.10 to 1.0.11

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mickish
Posts: 29
Joined: Tue Jan 08, 2008 11:15 pm
Location: Venice, Florida

Fonts changed from 1.0.10 to 1.0.11

Post by mickish » Tue Nov 11, 2008 8:28 pm

Here is a picture of my chart rendered in a ChartPanel using JFreeChart 1.0.10 on the left, and 1.0.11 on the right. The two charts were drawn using exactly the same code, only with different JFreeChart jar files.

All of the 1.0.11 fonts (right) are smaller than they were using 1.0.10 (left). For example, in the upper-left corner of the chart, there is a TextTitle that uses Helvetica,PLAIN,16. This looks rather bold in the older version, compared to the newer version.

Is this font size difference expected? Needless to say, I liked them the way they were. :-)

I see that the font sizes in the PDF versions of the files are still the same.

If I change the fonts to BOLD or increase the size, they look wrong in the PDF.

I am using Windows and JDK 6. Thanks for any suggestions!

--Andrew Mickish

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Tue Nov 11, 2008 9:18 pm

Code: Select all

ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
should restore the previous drawing behaviour

mickish
Posts: 29
Joined: Tue Jan 08, 2008 11:15 pm
Location: Venice, Florida

Post by mickish » Tue Nov 11, 2008 10:17 pm

Restoring the legacy theme was the first thing I tried, but it does not make a difference.

I am specifically setting the TextTitle fonts, the axis fonts, and pretty much every font in the chart to particular font objects, passing new Font("Times", Font.BOLD, 8) as an argument in the TextTitle constructor.

Would a theme override those specific font requests?

mickish
Posts: 29
Joined: Tue Jan 08, 2008 11:15 pm
Location: Venice, Florida

SOLVED

Post by mickish » Wed Nov 12, 2008 10:14 pm

The problem was the change in the ChartPanel drawing dimensions from from 1.0.10:

Code: Select all

    /** The default limit below which chart scaling kicks in. */
    public static final int DEFAULT_MAXIMUM_DRAW_WIDTH = 800;

    /** The default limit below which chart scaling kicks in. */
    public static final int DEFAULT_MAXIMUM_DRAW_HEIGHT = 600;
to 1.0.11:

Code: Select all

    /** The default limit below which chart scaling kicks in. */
    public static final int DEFAULT_MAXIMUM_DRAW_WIDTH = 1024;

    /** The default limit below which chart scaling kicks in. */
    public static final int DEFAULT_MAXIMUM_DRAW_HEIGHT = 768;
My fonts looked bigger in 1.0.10 because the whole image was being scaled larger.

Do you think those comments should be changed to "above which" ?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Nov 13, 2008 9:28 am

Yes, those comments are wrong. I'll fix it now.

You'll be able to get the old behaviour for your charts by adding:

Code: Select all

panel.setMaximumDrawWidth(800);
panel.setMaximumDrawHeight(600);


when you create your ChartPanel. Sorry for the inconvenience (lots of people have been asking why the fonts get distorted for large panels, which is why I made the defaults a little higher).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked