rakheek has asked for the wisdom of the Perl Monks concerning the following question:

Wise Monks, How can I change my Font(appearance) of the linespoints Graph title, X_label and y_label? The /font/arial.tf is not working. Please advise. Regards, Rakhee Here is my code snippet:
$mygraph->set( x_label => 'Log_Date', y_label => $y_label, x_label_skip => 30, x_labels_vertical => true, title => $title, legend_placement => 'BL', legend_marker_height => 12, dclrs => [ qw(green blue red yellow brown orange) ], ) or warn $mygraph->error; $mygraph->set_legend(@legend_keys); $mygraph->set_title_font('/fonts/arial.tf', 24); my $myimage = $mygraph->plot(\@data) or die $mygraph->error;

Replies are listed 'Best First'.
Re: How do I change font on GD graph title, x_label, y_label
by almut (Canon) on Mar 18, 2010 at 18:28 UTC
    '/fonts/arial.tf'

    Are you sure that's where the font is located, i.e. in a directory /fonts immediately below the root directory "/" ...?

    (P.S.: I suppose with "GD graph" you mean GD::Graph)

Re: How do I change font on GD graph title, x_label, y_label
by BrowserUk (Patriarch) on Mar 18, 2010 at 19:04 UTC
    $mygraph->set_title_font('/fonts/arial.tf', 24);

    What do you get if you add this to the top of your program:

    print 'Font ', -f '/fonts/arial.tf' ? 'found' : 'not found';

    Isn't the usual extension '.ttf', or is that only on Windows?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: How do I change font on GD graph title, x_label, y_label
by grantm (Parson) on Mar 18, 2010 at 20:01 UTC

    As other have pointed out, it seems likely that you're really asking about the GD::Graph module rather than GD and your problem is probably just that the file pathname in your script to the Arial font file does not match where that font actually lives on your machine.

    You might like to have a quick scan through the slides for this lightning talk on GD::Graph which was subtitled Charts that don’t suck, in 15 easy steps.

Re: How do I change font on GD graph title, x_label, y_label
by Anonymous Monk on Mar 18, 2010 at 18:16 UTC

    Which module are you talking about? GD doesn't have a set_title_font() method.

      Thank you all Monks. I am using GD::Graph::linespoints I tried $mygraph->set_title_font(GD::gdGiantFont); It does what I want for right now. Also, I don't think my fonts are in /fonts. I need to look for them. Thank u all for the wonderful support. Sometimes it can get lonely in the perl world of debugging. Regards, Rakhee
      Hi Anonymous Monk, I am using GD::Graph::linespoints I am using following $mygraph->set_title_font(GD::gdGiantFont); $mygraph->set_x_label_font(GD::gdLargeFont); $mygraph->set_y_label_font(GD::gdLargeFont); It works and changes the font for title and labels for me. ~Rakhee