Bug in Chart fonts handling

I played with chart module and found that the fonts settings are
incorrect.

In share/html/Search/Chart, the only font setting is made by set_legend_font, but there
is no legends on graphs so … not very usefull.

Instead it would be better to use one or every of the followings:

For bars:

set_x_label_font
set_y_label_font
set_x_axis_font
set_y_axis_font
set_values_font

For pies:

set_label_font
set_value_font

Also it’s often needed to specify the font path, here is a tested
example:

use GD::Text;
GD::Text->font_path("/usr/share/fonts/truetype/ttf-bitstream-vera");

And of course, if those settings can be customized in RT_SiteConfig.pm,
it would be very nice :wink:

That’s my two cents…

Here is my current diff (RT 3.6.3), also replacing the default non-free (verdana) by free fonts from bitstream:

— ./share/html/Search/Chart 2007-10-10 17:41:24.000000000 +0200
+++ ./local/html/Search/Chart 2007-10-10 17:46:00.000000000 +0200
@@ -10,6 +10,7 @@
my $chart_class;
use GD;
use GD::Text;
+GD::Text->font_path("/usr/share/fonts/truetype/ttf-bitstream-vera");

if ($ChartStyle eq ‘pie’) {
require GD::Graph::pie;
@@ -34,7 +35,15 @@
y_label => ‘Tickets’,
show_values => 1
);

  • $chart->set_legend_font( [‘verdana’, ‘arial’, gdMediumBoldFont], 12);
  • $chart->set_legend_font( [‘VeraBd’, ‘verdana’, ‘arial’, gdMediumBoldFont], 12);
  • $chart->set_x_label_font( [‘VeraBd’, ‘verdana’, ‘arial’, gdMediumBoldFont], 12);
  • $chart->set_y_label_font( [‘VeraBd’, ‘verdana’, ‘arial’, gdMediumBoldFont], 12);
  • $chart->set_x_axis_font( [‘Vera’, ‘verdana’, ‘arial’, gdMediumBoldFont], 10);
  • $chart->set_y_axis_font( [‘Vera’, ‘verdana’, ‘arial’, gdMediumBoldFont], 10);
  • $chart->set_values_font( [‘Vera’, ‘verdana’, ‘arial’, gdMediumBoldFont], 10);
    +} elsif ($chart_class eq “GD::Graph::pie”) {
  • $chart->set_label_font( [‘VeraBd’, ‘verdana’, ‘arial’, gdMediumBoldFont], 12);
  • $chart->set_value_font( [‘Vera’, ‘verdana’, ‘arial’, gdMediumBoldFont], 10);
    }

my %class = (

I played with chart module and found that the fonts settings are
incorrect.

In share/html/Search/Chart, the only font setting is made by
set_legend_font, but there
is no legends on graphs so … not very usefull.

Instead it would be better to use one or every of the followings:

We’ve actually already done a fair bit of this in RT 3.7. I’m hoping
to start tightening up RT 3.8 for release “soon”

-jesse

PGP.sig (186 Bytes)

Actually the changes Jesse’s talking about are in 3.6.5 :)On 10/11/07, Jesse Vincent jesse@bestpractical.com wrote:

On Oct 10, 2007, at 10:47 AM, Emmanuel Lacour wrote:

I played with chart module and found that the fonts settings are
incorrect.

In share/html/Search/Chart, the only font setting is made by
set_legend_font, but there
is no legends on graphs so … not very usefull.

Instead it would be better to use one or every of the followings:

We’ve actually already done a fair bit of this in RT 3.7. I’m hoping
to start tightening up RT 3.8 for release “soon”

-jesse

For bars:

set_x_label_font
set_y_label_font
set_x_axis_font
set_y_axis_font
set_values_font

For pies:

set_label_font
set_value_font

Also it’s often needed to specify the font path, here is a tested
example:

use GD::Text;
GD::Text->font_path(“/usr/share/fonts/truetype/ttf-bitstream-vera”);

And of course, if those settings can be customized in
RT_SiteConfig.pm,
it would be very nice :wink:

That’s my two cents…

Here is my current diff (RT 3.6.3), also replacing the default non-
free (verdana) by free fonts from bitstream:

— ./share/html/Search/Chart 2007-10-10 17:41:24.000000000 +0200
+++ ./local/html/Search/Chart 2007-10-10 17:46:00.000000000 +0200
@@ -10,6 +10,7 @@
my $chart_class;
use GD;
use GD::Text;
+GD::Text->font_path(“/usr/share/fonts/truetype/ttf-bitstream-vera”);

if ($ChartStyle eq ‘pie’) {
require GD::Graph::pie;
@@ -34,7 +35,15 @@
y_label => ‘Tickets’,
show_values => 1
);

  • $chart->set_legend_font( [‘verdana’, ‘arial’,
    gdMediumBoldFont], 12);
  • $chart->set_legend_font( [‘VeraBd’, ‘verdana’, ‘arial’,
    gdMediumBoldFont], 12);
  • $chart->set_x_label_font( [‘VeraBd’, ‘verdana’, ‘arial’,
    gdMediumBoldFont], 12);
  • $chart->set_y_label_font( [‘VeraBd’, ‘verdana’, ‘arial’,
    gdMediumBoldFont], 12);
  • $chart->set_x_axis_font( [‘Vera’, ‘verdana’, ‘arial’,
    gdMediumBoldFont], 10);
  • $chart->set_y_axis_font( [‘Vera’, ‘verdana’, ‘arial’,
    gdMediumBoldFont], 10);
  • $chart->set_values_font( [‘Vera’, ‘verdana’, ‘arial’,
    gdMediumBoldFont], 10);
    +} elsif ($chart_class eq “GD::Graph::pie”) {
  • $chart->set_label_font( [‘VeraBd’, ‘verdana’, ‘arial’,
    gdMediumBoldFont], 12);
  • $chart->set_value_font( [‘Vera’, ‘verdana’, ‘arial’,
    gdMediumBoldFont], 10);
    }

my %class = (


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Best regards, Ruslan.

Actually the changes Jesse’s talking about are in 3.6.5 :slight_smile:

Thanks!

always look at the last release before making cusom changes on code ;)

But there is a typo in RT_Config 3.6.5 for Font name:

Set($ChartFont, undef);

share/html/Search/Chart uses $RT::FontForCharts

So it works here with this in RT_SiteConfig.pm:

Set($FontForCharts, ‘/appli/rt/fonts/truetype/ttf-bitstream-vera/Vera.ttf’);

Thanks. I standardized on ChartFont for 3.6.6

-jesseOn Oct 11, 2007, at 2:50 AM, Emmanuel Lacour wrote:

On Thu, Oct 11, 2007 at 04:33:18AM +0400, Ruslan Zakirov wrote:

Actually the changes Jesse’s talking about are in 3.6.5 :slight_smile:

Thanks!

always look at the last release before making cusom changes on code ;)

But there is a typo in RT_Config 3.6.5 for Font name:

Set($ChartFont, undef);

share/html/Search/Chart uses $RT::FontForCharts

So it works here with this in RT_SiteConfig.pm:

Set($FontForCharts, ‘/appli/rt/fonts/truetype/ttf-bitstream-vera/
Vera.ttf’);


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

PGP.sig (186 Bytes)