Next message: Arnar Mar Hrafnkelsson: "Re: New Font with Imager:Font"
I'm trying to define a new font as outlined in the examples on this page:
http://www.eecs.umich.edu/~addi/perl/Imager/docs/Font-pm.html. However I'm getting an error message that sayes "Cannot create font: Font type not found at imager.cgi line 11." I've just ftp'd a true type font from a Windows2000 machine (verdana.ttf) and am trying to use it. Is that the problem?
Thanks for the help,
Greg
=======================
#!/usr/bin/perl
use CGI;
use CGI::Carp qw/fatalsToBrowser/;
use Imager;
use Imager::Font;
require 'fsbo_common.cgi';
&header;
$t1font = Imager::Font->new(file => '/home/.../www/cgi-bin/verdana.ttf') or die "Cannot create font: ",Imager->errstr;
$red = Imager::Color->new("#FF0000");
$img=Imager->new();
$img->read(file=>"/home/.../www/fsbo/listings/359_orig.jpg");
$img->string(font=>$t1font,
text=>"Model-XYZ",
x=>0,
y=>40,
size=>40,
color=>$red);
$img->write(file=>"/home/.../www/fsbo/listings/359_changed.jpg");
print "Has truetype" if $Imager::formats{tt};
print "Has t1 postscript" if $Imager::formats{t1};
print "Has Win32 fonts" if $Imager::formats{w32};
print "Has Freetype2" if $Imager::formats{ft2};
print "<img src='../fsbo/listings/359_changed.jpg'>";
&footer;
exit;
####################################
## HEADER
####################################
sub header {
print "Content-type: text/html\n\n";
open(FILE,"$basedir/includes/top_complete.html");
while($entry = <FILE>) {
print $entry;
}
close(FILE);
print "
<p align=right><br><img src='$hdr_sellers_area_graphic'></p>
";
}
####################################
## FOOTER
####################################
sub footer {
open(FILE,"$basedir/includes/bottom_complete.html");
while($entry = <FILE>) {
print $entry;
}
close(FILE);
}