I'm stumped. How can I load up an external font and have GD use it? I just want to print out a string into an image, then save it as a png. Nothing fancy. But I haven't been able to track down an example that works.
My gd config summary tells me that I have support for PNG, JPEG, Freetype 2.x, Fontconfig, Xpm, and pthreads. My GD is up to date w/2.35, and my gd version is 2.0.33. I'm running 10.4.8 on a macbook w/a core duo. Sample script along with sample results are attached. What do I need to change to make this work? Did I miss the proper incantation to produce my string, or am I doing it properly with one of the methods down below and something external is thwarting me? Any pointers appreciated.
my ($w, $h) = (50, 50);
my $img = GD::Image->new($w, $h);
my $white = $img->colorAllocate(255,255,255);
my $black = $img->colorAllocate(0,0,0);
my %pixmap = ();
my $monaco = GD::Font->load('/System/Library/Fonts/Monaco.dfont')
or die "Can't load monaco!";
#this gives me a bus error
#this does nothing
#this dies with "font is not of type GD::Font "
#this one does nothing
open (IMG, ">/Users/jim/Desktop/img.png");
print IMG $img->png;