dvf5907 has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to get GD::Text::Align to work on my win2k box with ActivePerl 5.6.1 Build 630. I want to write text into an image, but the string that I send ends up being a string of box characters (similar looking to this without the quotes: "[]"), that's the same number of characters as the original string. I was wondering if anyone has seen this (mis-)behavior before? And if so, could you tell me how to fix it?

Replies are listed 'Best First'.
Re: Win32 Problem with GDTextUtil
by {NULE} (Hermit) on Nov 06, 2001 at 00:07 UTC
    Hi,

    I had (have, I suppose) the exact same problem on a number of builds of ActiveState Perl in Win2k. It is not a problem with the fonts, but, I believe the library they are linking with to render those fonts. My struggles with trying to resolve the issue left me with the distinct feeling that no one was interested in fixing the problem.

    I was never able to fix the problem on Win32, but the identical code ran fine on Linux with the fonts copied over. This was after I took the time to manually download all of the dependent libraries (GD, freetype, etc) and rebuild/reinstall them. Perhaps if you have access to a build environment on Win you can have more luck.

    Sorry I couldn't be of more help,
    {NULE}

    Update: I found my old demo code - again with the appropriate path and filenames this runs fine in Linux, but not win2k. Click on the read more tag for more info.

    --
    http://www.nule.org
Re: Win32 Problem with GDTextUtil (boo)
by boo_radley (Parson) on Nov 05, 2001 at 23:26 UTC
    It sounds like there's a font problem -- either the font you're choosing may not have the chars you're typing, or a problem happened during a font load.
    Can you share some of your code?
    Update : I think -- I don't have time to test this -- that you should have, but are missing one of the following lines.
    $foo->set_font('font.ttf', 12) or die $gd_text->error; $foo->set_font(gdTinyFont); $foo->set_font(GD::Font::Tiny);
Re: Win32 Problem with GDTextUtil
by dvf5907 (Novice) on Nov 06, 2001 at 00:53 UTC
    Here's the code:
    #!/usr/bin/perl use strict; use GD; use GD::Text::Align; use GD::Text::Wrap; my $image = GD::Image->newFromJpeg('tv_click_no_words.jpg') || die(); my $black = $image->colorAllocate(0,0,0); my $string = 'Dan is the best!'; # my @bounds = $image->stringTTF($black, '/home/dvf5907/gd/fonts/comic +.ttf', 10, 0, 15,20, $string ); my $black = $image->colorAllocate(0,0,0); # my $string = "Dan is the best!!!\nI'm the lizard king"; my $string = "hello?"; my $wrapbox = GD::Text::Wrap->new( $image, color => $black, text => $string ); $wrapbox->font_path( 'C:/winnt/fonts' ); #work_area/mod_perl/dans_website/gd/fonts' ); $wrapbox->set_font('comic.ttf', 10) || die (); $wrapbox->set( align => 'center', width => '122', preserve_nl => 1 ); $wrapbox->draw(10,5);