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

Hi,

I am trying to set the font for GD::Graph using the following code. But default font is not changing! Environment: Windows XP SP3, Perl v5.10

$my_graph->set_title_font('C:/WINDOWS/Fonts/arial.ttf', 14)

I have also tried using font_path method, but could not succeed.

use GD::Text; GD::Text->font_path('c:/windows/fonts/')

Could you please help me resolve this issue ? Thanks in advance

Best

Ram

Replies are listed 'Best First'.
Re: true type font in GD::Graph
by hawtin (Prior) on Sep 03, 2009 at 15:55 UTC

    Its been a while since I last looked at fonts in GD. I have an old piece of code that says:

    # $image->stringFT($line,'/dosc/windows/Fonts/arialnb.ttf', # 12,0, # $border+int($x), # int($y), # $name); $image->string(gdMediumBoldFont, int($x)-$x_offset, int($y), $name,$line);

    My recollection is that the commented out stringFT() method worked OK but there was some other issue with it (finding fonts on other machines for example). So in the end I had to resort to the gd*Font set.

    Hope that helps.