sub new {
my $class = shift;
- my %hsh=(color=>Imager::Color->new(255,0,0,0),
+ my %hsh=(color=>Imager::Color->new(255,0,0,255),
size=>15,
@_);
#!perl -w
use strict;
-use Test::More tests => 189;
+use Test::More tests => 193;
use Cwd qw(getcwd abs_path);
use Imager qw(:all);
-use Imager::Test qw(diff_text_with_nul is_color3);
+use Imager::Test qw(diff_text_with_nul is_color3 is_color4 isnt_image);
-d "testout" or mkdir "testout";
my $fontname=$ENV{'TTFONTTEST'} || $deffont;
- -f $fontname or skip("cannot find fontfile $fontname", 188);
+ -f $fontname or skip("cannot find fontfile $fontname", 189);
my $bgcolor=i_color_new(255,0,0,0);
ok($font, "found font by drive relative path")
or print "# path $drive_path\n";
}
-
+ { # RT 71469
+ my $font1 = Imager::Font->new(file => $deffont, type => "ft2", index => 0);
+ my $font2 = Imager::Font::FT2->new(file => $deffont, index => 0);
+
+ for my $font ($font1, $font2) {
+ print "# ", join(",", $font->{color}->rgba), "\n";
+
+ my $im = Imager->new(xsize => 20, ysize => 20, channels => 4);
+
+ ok($im->string(text => "T", font => $font, y => 15),
+ "draw with default color")
+ or print "# ", $im->errstr, "\n";
+ my $work = Imager->new(xsize => 20, ysize => 20);
+ my $cmp = $work->copy;
+ $work->rubthrough(src => $im);
+ isnt_image($work, $cmp, "make sure something was drawn");
+ }
+ }
}
sub align_test {
sub new {
my $class = shift;
- my %hsh=(color=>Imager::Color->new(255,0,0,0),
+ my %hsh=(color=>Imager::Color->new(255,0,0,255),
size=>15,
@_);
#!/usr/bin/perl -w
use strict;
use Imager;
-use Test::More tests => 9;
+use Imager::Test qw(isnt_image);
+use Test::More tests => 13;
# extracted from t/t36oofont.t
"write t36oofont1.ppm")
or print "# ",$img->errstr,"\n";
+{ # RT 71469
+ my $font1 = Imager::Font->new(file => $fontname_pfb, type => "t1");
+ my $font2 = Imager::Font::T1->new(file => $fontname_pfb);
+
+ for my $font ($font1, $font2) {
+ print "# ", join(",", $font->{color}->rgba), "\n";
+
+ my $im = Imager->new(xsize => 20, ysize => 20, channels => 4);
+
+ ok($im->string(text => "T", font => $font, y => 15),
+ "draw with default color")
+ or print "# ", $im->errstr, "\n";
+ my $work = Imager->new(xsize => 20, ysize => 20);
+ my $cmp = $work->copy;
+ $work->rubthrough(src => $im);
+ isnt_image($work, $cmp, "make sure something was drawn");
+ }
+}
+
unless ($ENV{IMAGER_KEEP_FILES}) {
unlink "testout/t36oofont1.ppm";
}
# since Win32's HFONTs include the size information this
# is just a stub
sub new {
- my ($class, %opts) = @_;
+ my $class = shift;
+ my %opts =
+ (
+ color => Imager::Color->new(255, 0, 0),
+ size => 15,
+ @_,
+ );
return bless \%opts, $class;
}
#!perl -w
use strict;
-use Test::More tests => 55;
+use Test::More tests => 59;
use Imager qw(:all);
-use Imager::Test qw(diff_text_with_nul);
+use Imager::Test qw(diff_text_with_nul isnt_image);
++$|;
ok(-d "testout" or mkdir("testout"), "testout directory");
diff_text_with_nul("utf8 dash\0dash vs dash - channel", "$dash\0$dash", $dash,
font => $font, channel => 1, utf8 => 1);
}
+
+ { # RT 71469
+ my $font1 = Imager::Font->new(face => $fontname, type => "w32");
+ my $font2 = Imager::Font::W32->new(face => $fontname );
+
+ for my $font ($font1, $font2) {
+ print "# ", join(",", $font->{color}->rgba), "\n";
+
+ my $im = Imager->new(xsize => 20, ysize => 20, channels => 4);
+
+ ok($im->string(text => "T", font => $font, y => 15),
+ "draw with default color")
+ or print "# ", $im->errstr, "\n";
+ my $work = Imager->new(xsize => 20, ysize => 20);
+ my $cmp = $work->copy;
+ $work->rubthrough(src => $im);
+ isnt_image($work, $cmp, "make sure something was drawn");
+ }
+ }
}
my $class = shift;
my $self = {};
my ($file, $type, $id);
- my %hsh=(color => Imager::Color->new(255,0,0,0),
+ my %hsh=(color => Imager::Color->new(255,0,0,255),
size => 15,
@_);
sub new {
my $class = shift;
- my %hsh=(color=>Imager::Color->new(255,0,0,0),
+ my %hsh=(color=>Imager::Color->new(255,0,0,255),
size=>15,
@_);
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
-use Test::More tests => 12;
+use Test::More tests => 16;
BEGIN { use_ok('Imager') };
+BEGIN {
+ require Imager::Test;
+ Imager::Test->import(qw(isnt_image));
+}
+
-d "testout" or mkdir "testout";
Imager->open_log(log => "testout/t36oofont.log");
SKIP:
{
$Imager::formats{"tt"} && -f $fontname_tt
- or skip("FT1.x missing or disabled", 10);
+ or skip("FT1.x missing or disabled", 14);
my $img=Imager->new(xsize=>300, ysize=>100) or die "$Imager::ERRSTR\n";
my @has_chars = $font->has_chars(string=>"\x01A");
ok(!$has_chars[0], "has_chars list 0");
ok($has_chars[1], "has_chars list 1");
+
+ { # RT 71469
+ my $font1 = Imager::Font->new(file => $fontname_tt, type => "tt");
+ my $font2 = Imager::Font::Truetype->new(file => $fontname_tt);
+
+ for my $font ($font1, $font2) {
+ print "# ", join(",", $font->{color}->rgba), "\n";
+
+ my $im = Imager->new(xsize => 20, ysize => 20, channels => 4);
+
+ ok($im->string(text => "T", font => $font, y => 15),
+ "draw with default color")
+ or print "# ", $im->errstr, "\n";
+ my $work = Imager->new(xsize => 20, ysize => 20);
+ my $cmp = $work->copy;
+ $work->rubthrough(src => $im);
+ isnt_image($work, $cmp, "make sure something was drawn");
+ }
+ }
}
ok(1, "end");