in reply to GD::Image-stringTTF() problems....

The following test works fine with ActiveState (build 623, their GD ver 1.27.2]. My guess is you are trying to print characters that aren't defined in the font you are specifying, except that doesn't seem likely with simple numbers. Anyway, there is nothing fancy about the string, to answer that part of the question.
use strict; use warnings; use GD; my $im = new GD::Image(150,60); my $white = $im->colorAllocate(255,255,255); # UPDATE without this th +e background # will be the same as th +e text colour my $blue = $im->colorAllocate(0,0,255); # might as well allocate this + too while I'm at it... my @bounds = $im->stringTTF($blue,'c:/i386/Arial.ttf',22,0,0,36,'123 J +aPh!'); if (!@bounds) {print "TTF error: $@\n";} print join ':', @bounds; open OUT, '>foo.jpg' or die "Couldn't open output: $!"; binmode OUT; print OUT $im->jpeg; close OUT;
Update: Aargh you're correct! I actually did test this but as part of a larger script which had already set some colours. I've corrected the above code as marked (thanks!). And for the record this was under NT4. I'll have to try it on a Win9x box sometime.

--
I'd like to be able to assign to an luser

Replies are listed 'Best First'.
Waitasec...
by Anonymous Monk on May 04, 2001 at 01:01 UTC
    ...you only made one call to colorAllocate, though; wouldn't that set the background color to the font color and give you just a blue square? (At least that's what it did for me...)

    Anyways, think I found my problem -- apparently, it's a WinNT/Win9x incompatability thing, because I migrated my code over to the server and it works fine. *sighs*

    Thanks for the help, though. =)