Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How to use Imager for text

by teabag (Pilgrim)
on Oct 28, 2005 at 16:40 UTC ( #503705=note: print w/replies, xml ) Need Help??


in reply to How to use Imager for text

Hey bradcathey

I'm not sure if Imager can use macfonts? Have you tried postscript fonts? I used ttf fonts in the past without any problems though.

On Imager::Font I found something to check if Imager is t1 or truetype capable:

use Imager; 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};

I also found some link that's about Imager and .dfonts. It claims you need to add:

my $font = Imager::Font->new(file=>$font, type=>ft2) or die Imager->er +rstr;
Check the link below for the whole discussion:
http://use.perl.org/comments.pl?sid=24188&cid=37046

Good luck ;)


teabag
Blessed is the end user who expects nothing, for he/she will not be disappointed.

Replies are listed 'Best First'.
Re^2: How to use Imager for text
by bradcathey (Prior) on Oct 28, 2005 at 18:13 UTC

    Thanks teabag, but designating the type as 'ft2' didn't work. I managed to get an arial.ttf file uploaded to my cgi-bin, but still no dice. I'm surprised I getting a blank screen without any error messages, even if I substitute 'arial' for some font I know is not there. BTW, I'm getting a positive read with:

    print "Has truetype" if $Imager::formats{tt};

    Here's what I have now, for what it's worth:

    my $font = Imager::Font->new( file => "arial", type => "tt", index => 1, color => "444444", size => 30, aa => 1); $img->string( font => $font, text => "This is a test string", x => 20, y => 10);

    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2020-12-01 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (11 votes). Check out past polls.

    Notices?