problems GD and GD::Text::Wrap

J

john.swilting

I do not understand
Why the text displays badly and swindles
my code compil nice
It is letters and figures that display vaguenesses

#!/usr/bin/perl -w
use strict;
use GD;
use GD::Text::Wrap;
use CGI;
use CGI::Carp;
require "Random.pm";

my $q = new CGI;

##my $outfile = shift || "GDWrap.png";

my $gd = GD::Image->new(400,240);
my $white = $gd->colorAllocate(255,255,255);
my $black = $gd->colorAllocate( 0, 0, 0);
my $blue = $gd->colorAllocate(127,127,255);
my $red = $gd->colorAllocate(127, 0, 0);


my $text = Random->new();

my $wp = GD::Text::Wrap->new($gd,
width => 180,
line_space => 4,
color => $black,
text => $text,
);

$wp->set(align =>'center', para_space => 10, preserve_nl => 0);
$wp->set_font(['arial', 'Dustismo_Sans'], 10);
$gd->rectangle($wp->get_bounds(10,10), $blue);
$wp->draw(10,10);

$text =~ tr/\n//d;
$wp->set(text => $text);
$wp->set(colour => $white, align => 'center', line_space => 2);
$wp->set_font(gdMediumBoldFont, 12);
$wp->draw(20,10);

print $q->header( -type => "image/png", -expires => "-1d");
binmode STDOUT ;
print $gd->png();
 
J

john.swilting

john.swilting wrote:

When I put align =>'left'
The text displays well

its very obvious for me
 
J

john.swilting

john.swilting wrote:

that code its ok
compil
#!/usr/bin/perl -w
use strict;
use GD;
use GD::Text::Wrap;
use CGI;
use CGI::Carp;
require "Random.pm";

my $q = new CGI;


my $gd = GD::Image->new(400,240);
my $white = $gd->colorAllocate(255,255,255);
my $black = $gd->colorAllocate( 0, 0, 0);
my $blue = $gd->colorAllocate(127,127,255);
my $red = $gd->colorAllocate(127, 0, 0);


my $text = Random->new();

my $wp = GD::Text::Wrap->new($gd,
width => 180,
line_space => 4,
color => $black,
text => $text,
);


$wp->set(align =>'center', para_space => 10, preserve_nl => 0);
$wp->set_font(['arial', 'Dustismo_Sans'], 10);
$gd->rectangle($wp->get_bounds(10,10), $blue);
$wp->draw(10,10);

$text =~ tr/\n//d;
$wp->set(text => $text);
$wp->set(colour => $white, align => 'center', line_space => 2);
$wp->set_font(gdMediumBoldFont, 12);
$wp->draw(20,10);

print $q->header( -type => "image/png", -expires => "-1d");
binmode STDOUT ;
print $gd->png();
 
J

john.swilting

john.swilting said:
john.swilting wrote:

When I put align =>'left'
The text displays well

its very obvious for me
when I put align =>'left'
the text displays badly and swildles again
The size of the image is better
my code compil nice
its very obvious for me


#!/usr/bin/perl -w
use strict;
use GD;
use GD::Text::Wrap;
use CGI;
use CGI::Carp;
require "Random.pm";

my $q = new CGI;

##my $outfile = shift || "GDWrap.png";

my $gd = GD::Image->new(1000,60);
my $white = $gd->colorAllocate(255,255,255);
my $black = $gd->colorAllocate( 0, 0, 0);
my $blue = $gd->colorAllocate(127,127,255);
my $red = $gd->colorAllocate(127, 0, 0);


my $text = Random->new();

my $wp = GD::Text::Wrap->new($gd,
width => 100,
line_space => 4,
color => $black,
text => $text,
);


$wp->set(align =>'center', para_space => 10, preserve_nl => 0);
$wp->set_font(['arial', 'Dustismo_Sans'], 10);
$gd->rectangle($wp->get_bounds(10,10), $blue);
$wp->draw(10,10);

$text =~ tr/\n//d;
$wp->set(text => $text);
$wp->set(colour => $white, align => 'center', line_space => 2);
$wp->set_font(gdMediumBoldFont, 12);
$wp->draw(10,10);

print $q->header( -type => "image/png", -expires => "-1d");
binmode STDOUT ;
print $gd->png();
 
J

Joe Smith

john.swilting said:
my code compil nice

A better way to express that is "My code compiles without warning or errors".
its very obvious for me

If it is very obvious, then it means you don't have a problem. Right?

If you don't understand what is wrong, you're suppose to say:

It's not obvious to me.

or

I cannot see the problem.



-Joe
 
J

john.swilting

Joe said:
A better way to express that is "My code compiles without warning or
errors".


If it is very obvious, then it means you don't have a problem. Right?

If you don't understand what is wrong, you're suppose to say:

It's not obvious to me.

or

I cannot see the problem.



-Joe
its ok
my code conpil nice
the pod is nice
#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::Carp;
use GD;
use GD::Text::Wrap;
require "Random.pm";
my $q = new CGI;
my $gd = GD::Image->new(800,600);
my $white = $gd->colorAllocate(255,255,255);
my $black = $gd->colorAllocate( 0, 0, 0);
my $blue = $gd->colorAllocate(127,127,255);
my $red = $gd->colorAllocate(127, 0, 0);

my $text = Random->new();

my $wrapbox = GD::Text::Wrap->new( $gd,
line_space => 4,
color => $black,
text => $text,
);

$wrapbox->set_font(gdMediumBoldFont);
$wrapbox->set_font('arial',12);
$wrapbox->set(align => 'center', width => 120);
$wrapbox->draw(10,140);

$gd->rectangle($wrapbox->get_bounds(10,140),$red);
print $q->header( -type => "image/png", -expires => "-1d");
binmode STDOUT ;
print $gd->png();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top