(none) imager-devel
/ help / lists / applications / search /
 

Re: New Font with Imager:Font

From: Arnar Mar Hrafnkelsson (
05294@xyz.molar.is)
Date: Fri 21 Jun 2002 - 13:02:37 UTC


My guess is that the problem is that you don't have any support libraries
for truetype font installed on the machine or that the Imager install
didn't find those libraries. You need either Freetype1 or Freetype2
on unix to be able to use truetype fonts.

During install imager prints out a summary of what it found in terms of
headers and libraries, for a given library to be used both must be
present.

So I would rerun the install, see if it finds freetype1 or freetype2
and if neither is present install freetype2.

The README file has some extra info.

Hope this helps,

-- Arnar

On Thu, 20 Jun 2002, Greg Krieser wrote:

> 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);
>
> }
>
>
>