Go Back   Garayed.com > Perl
Reply
 
LinkBack Thread Tools Search this Thread Display Modes

problems GD and GD::Text::Wrap
  #1 (permalink)  
Old 01-23-2007, 05:01 AM
john.swilting
 
Posts: n/a
Default problems GD and GD::Text::Wrap

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: problems GD and GD::Text::Wrap
  #2 (permalink)  
Old 01-23-2007, 06:08 AM
john.swilting
 
Posts: n/a
Default Re: problems GD and GD::Text::Wrap

john.swilting wrote:

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

its very obvious for me

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: problems GD and GD::Text::Wrap
  #3 (permalink)  
Old 01-23-2007, 06:48 AM
john.swilting
 
Posts: n/a
Default Re: problems GD and GD::Text::Wrap

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: problems GD and GD::Text::Wrap
  #4 (permalink)  
Old 01-23-2007, 08:05 AM
john.swilting
 
Posts: n/a
Default Re: problems GD and GD::Text::Wrap

john.swilting wrote:

> john.swilting wrote:
>
> When I put align =>'left'
> The text displays well
>
> its very obvious for me
>
>> I do not understand
>> Why the text displays badly and swindles
>> my code compil nice
>> It is letters and figures that display vaguenesses
>>

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: problems GD and GD::Text::Wrap
  #5 (permalink)  
Old 01-23-2007, 08:27 AM
Joe Smith
 
Posts: n/a
Default Re: problems GD and GD::Text::Wrap

john.swilting wrote:

> 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: problems GD and GD::Text::Wrap
  #6 (permalink)  
Old 01-23-2007, 08:34 AM
john.swilting
 
Posts: n/a
Default Re: problems GD and GD::Text::Wrap

Joe Smith wrote:

> john.swilting wrote:
>
>> 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

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:30 AM.


Powered by vBulletin® Version 3.5.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
| Home | FAQ | Members List | Calendar | Today's Posts | Search | New Posts |