Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

GD::Graph cannot change font

by kp2a (Sexton)
on Apr 24, 2011 at 15:15 UTC ( #901050=perlquestion: print w/ replies, xml ) Need Help??
kp2a has asked for the wisdom of the Perl Monks concerning the following question:

I cannot change font or size for labels etc.
For example from GD::Graph sample95.pl (modified)
(It is included in the build directory of the distribution.)
my $font_spec = "Dustismo_Sans"; $my_graph->set_y_label_font($font_spec, 12); $my_graph->set_x_label_font($font_spec, 12); $my_graph->set_y_axis_font($font_spec, 10); $my_graph->set_x_axis_font($font_spec, 36); $my_graph->set_title_font($font_spec, 48); $my_graph->set_legend_font($font_spec, 8); $my_graph->set_values_font($font_spec, 8);
Dustismo_Sans.ttf is in pwd. And I have tried "Dustismo_Sans" and "Dustismo_Sans.ttf" and "/home/john/Dustismo_Sans.ttf" for $font_spec

Whatever I put in $font_spec or in the size field, the appearance of the resulting image is always the same!

Questions:

1. I assume that GD would look for the font file given a relative (to pwd) file name or an absolute file name. Correct?

2. Why can I not change size or font?

3. My OS is FC 8. I loaded msttcorefonts-2.0-1.spec, Microsoft TTL fonts, and they are usable by OpenOffice but I cannot locate corresponding .ttf files. Do they exist as such and if so, where are they?

Thanks

uname -a Linux scan 2.6.26.8-57.fc8 #1 SMP Thu Dec 18 19:19:45 EST 2008 i686 i6 +86 i386 This is perl, v5.8.8 built for i386-linux-thread-multi GD-2.45 GDGraph-1.44 GDTextUtil-0.86

Comment on GD::Graph cannot change font
Select or Download Code
Re: GD::Graph cannot change font
by Anonymous Monk on Apr 24, 2011 at 15:24 UTC
    Try like this
    $my_graph->set_y_label_font($font_spec, 12) or warn $my_graph->error;
    Hopefully there will be a warning
      Thanks. Yes, a warning
      Processing sample95 libgd was not built with FreeType font support ...caught at ./sample95.pl line 84.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://901050]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2014-12-23 03:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (133 votes), past polls