When I try this:
     $graph->set_x_label_font('Arial', 10) || die "Could not open font file:
$!.";;

I get this error:
     Could not open font file: No such file or directory.

I get no errors when I give a directory path to the ttf file.  If I change
the path to a different directory, one where the ttf is not, I get the same
error as above.  Giving the full path is what they do in the documentation
for GD::Graph.


Scott, what do you mean by "Are you specifying a font path"?  Isn't that
what I was doing?  Like this:
     $graph->set_x_label_font('c:\code\perl\arial.ttf', 10);


I forgot to mention that this is running in an ASP page.  For those who are
interested, here's the code I'm using to make the graph (inside the asp
file):

#--------------------------------------------------------------
use GD::Graph::lines;
my $graph = GD::Graph::lines->new(650, 250);
$graph->set_x_label_font('e:\intranet\stats\arial.ttf', 10) || die "Could
not open font file: $!.";

$graph->set(
  x_label    =>
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
  y_label    => 'CPU Utilization',
  x_label_position => 0.5,  x_labels_vertical => 1,
  x_label_skip  => 10,  y_tick_number  => 7,
  y_max_value   => $max,  y_min_value   => 0,
  y_number_format  => "%3d",
  t_margin   => 16,  b_margin   => 16,
  l_margin   => 10,  r_margin   => 16,
 );

my $gd = $graph->plot(\@graphdata);
my $fillColor = $gd->colorAllocate(240,240,240);
$gd->fill(47,18,$fillColor);

open(IMG,">plot_server_time.png") or die ("Failed to write file: $!");
binmode IMG;
print IMG $gd->png();
close IMG;
#--------------------------------------------------------------


Thanks,

Paul O.


>>> "Edward G. Orton" 04/18/02 05:53 PM >>>

> > I've looked through the archives and I haven't seen anyone
> post a solution
> > to the GD with TrueType fonts problem some are having
> (including me).  I'm
> > using GD::Graph and want to set the font+size on the text, but
> when I set
> > the font to a truetype font I get these square boxes where the
> text should
> > be.  I've reinstalled GD, GDGraph, and GDTextUtil several
> times.  I'm using
> > something like this:
> >
> > $graph->set_x_label_font('c:\code\perl\arial.ttf', 10);
> >
> > And yes, "$graph->can_do_ttf()" returns true.  I'm running
> build 623 on
> > Windows 2000.
> >
> > Does anyone know what the problem is?
> I'm not sure, but all I ever specify is the font name, not the
> font file, and it works for me:
> $graph->set_x_label_font('Arial', 10);
>
> ego
> Edward G. Orton, GWN Consultants Inc.
> Phone: 613-764-3186, Fax: 613-764-1721
> email: [EMAIL PROTECTED]
>
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to