I am having trouble using fonts, and changing the font size with the GD::Graph module, running on Win32.

I have tried lines like the following:

 

#GD::Graph->set_font('c:/windows/fonts/arial.ttf', 12);

#GD::Graph->set_font(['verdana', 'arial', gdMediumBoldFont], 14);

 

This line does change it slightly:

$my_graph->set_title_font(['verdana', 'arial', gdMediumBoldFont], 12);

 

But the fonts do not change type, and the point size has no effect.

 

Has anyone successfully used the fonts in this module?

 

Perl: v5.6.1, build 631

GD Module: v1.27.2

GDGraph Module: v1.33

GDTextUTIL Module: v0.80

 

Below is a sample of the author’s code from sample92.pl:

-------------------------------------------------------------------

@data =" ("

    ["1st","2nd","3rd","4th","5th","6th"],

    [    4,    2,    3,    4,    3,  3.5]

);

 

$my_graph = new GD::Graph::pie( 250, 200 );

 

$my_graph->set(

    title           => 'A Pie Chart',

    label           => 'Label',

    axislabelclr    => 'white',

    dclrs           => [ 'lblue' ],

    accentclr       => 'lgray',

);

 

# Set the font of the title above the pie

$my_graph->set_title_font('arial', 18);

# Set the font of the label below the pie

$my_graph->set_label_font(gdMediumBoldFont);

# Set the font of the values printed on the pie

$my_graph->set_value_font('arial', 20);

 

$my_graph->plot(\@data);

open(OUT, '>foo.png') or die $!;

binmode OUT;

print OUT $my_graph->gd->png;

close OUT;

-------------------------------------------------------------------

 

Scott Campbell

Senior Software Developer

Somix Technologies

(207) 324-8805

http://www.somix.com

 

Reply via email to