1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl test.pl'
4 ######################### We start with some black magic to print on failure.
6 # Change 1..1 below to 1..last_test_to_print .
7 # (It may become useful if the test is moved to ./t subdirectory.)
9 BEGIN { $| = 1; print "1..6\n"; }
10 END {print "not ok 1\n" unless $loaded;}
19 init_log("testout/t30t1font.log",1);
21 if (!(i_has_format("t1")) ) {
23 print "ok $_ # skip t1lib unavailable or disabled\n";
29 $fontname_pfb=$ENV{'T1FONTTESTPFB'}||'./fontfiles/dcr10.pfb';
30 $fontname_afm=$ENV{'T1FONTTESTAFM'}||'./fontfiles/dcr10.afm';
32 if (! -f $fontname_pfb) {
33 print "# cannot find fontfile for truetype test $fontname_pfb\n";
37 if (! -f $fontname_afm) {
38 print "# cannot find fontfile for truetype test $fontname_afm\n";
45 $fnum=Imager::i_t1_new($fontname_pfb,$fontname_afm); # this will load the pfb font
46 if ($fnum<0) { die "Couldn't load font $fontname_pfb"; }
48 $bgcolor=Imager::Color->new(255,0,0,0);
49 $overlay=Imager::ImgRaw::new(200,70,3);
51 i_t1_cp($overlay,5,50,1,$fnum,50.0,'XMCLH',5,1)
55 i_draw($overlay,0,50,100,50,$bgcolor);
57 @bbox=i_t1_bbox(0,50.0,'XMCLH',5);
58 print "bbox: ($bbox[0], $bbox[1]) - ($bbox[2], $bbox[3])\n";
60 open(FH,">testout/t30t1font.ppm") || die "cannot open testout/t35t1font.ppm\n";
61 binmode(FH); # for os2
62 $IO = Imager::io_new_fd( fileno(FH) );
63 i_writeppm_wiol($overlay,$IO);
66 $bgcolor=Imager::Color::set($bgcolor,200,200,200,0);
67 $backgr=Imager::ImgRaw::new(280,150,3);
70 i_t1_text($backgr,10,100,$bgcolor,$fnum,150.0,'test',4,1)
75 open(FH,">testout/t30t1font2.ppm") || die "cannot open testout/t35t1font.ppm\n";
77 $IO = Imager::io_new_fd( fileno(FH) );
78 i_writeppm_wiol($backgr, $IO);
81 $rc=i_t1_destroy($fnum);
82 if ($fnum <0) { die "i_t1_destroy failed: rc=$rc\n"; }
86 print "# debug: ",join(" x ",i_t1_bbox(0,50,"eses",4) ),"\n";
87 print "# debug: ",join(" x ",i_t1_bbox(0,50,"llll",4) ),"\n";
89 unlink "t1lib.log"; # lose it if it exists
91 print -e("t1lib.log") ? "not ok 5\n" : "ok 5\n";
93 print -e("t1lib.log") ? "ok 6\n" : "not ok 6\n";