in reply to GD::Graph Problems: Missing "built-in" font & AUTOLOAD deprecation

I reinstalled gd2 via MacPorts and reinstalled GD.pm. I'm still getting the same errors.

MacPorts has supposedly resolved an issue with failure to find the fonts directory, but this seems to be a problem with GD::Graph::Lines itself (or rather, GD::Text since the error actually references that module):

Text.pm:94: Can't locate auto/GD/gdSmallFont.al in @INC

This appears to be an automatic requirement for a font that's not even used!

  • Comment on Re: GD::Graph Problems: Missing "built-in" font & AUTOLOAD deprecation
  • Download Code

Replies are listed 'Best First'.
Re^2: GD::Graph Problems: Missing "built-in" font & AUTOLOAD deprecation
by zentara (Cardinal) on Jul 28, 2012 at 10:08 UTC
    Hi, see Font question regarding GD.pm

    Your PhP script had no use of True Type Fonts, so just because it ran, dosn't mean your GD libs are up to doing TrueType.

    Your problem is just setting up your True Type fonts correctly.

    It is a well known problem that GD requires full path names to the ttf file. Just specifying 'arial' won't do. Also read "perldoc GD" and look for the section "Character and String Drawing", wherein it says

    $font = GD::Font->load($fontfilepath) This method dynamically loads a font file, returning a font + that you can use in subsequent calls to drawing methods. For example: my $courier = GD::Font->load('./courierR12.fnt') or die +"Can't load font"; $image->string($courier,2,10,"Peachy Keen",$peach);
    Even in the docs, the ./courierR12.fnt file is in the scripts working directory. Try copying your arial font file to the CWD of the script. There is also mention of using stringFT for TrueType fonts, google for examples if you need them.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh