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..3\n"; }
10 END {print "not ok 1\n" unless $loaded;}
15 init_log("testout/t35ttfont.log",1);
18 print "ok 2 # skip\n";
19 print "ok 3 # skip\n";
24 if (!(i_has_format("tt")) ) { skip(); }
27 $fontname=$ENV{'TTFONTTEST'}||'./fontfiles/dodge.ttf';
30 print "# cannot find fontfile for truetype test $fontname\n";
37 $bgcolor = i_color_new(255,0,0,0);
38 $overlay = Imager::ImgRaw::new(200,70,3);
40 $ttraw = Imager::i_tt_new($fontname);
45 @bbox = i_tt_bbox($ttraw,50.0,'XMCLH',5);
46 print "#bbox: ($bbox[0], $bbox[1]) - ($bbox[2], $bbox[3])\n";
48 i_tt_cp($ttraw,$overlay,5,50,1,50.0,'XMCLH',5,1);
49 i_draw($overlay,0,50,100,50,$bgcolor);
51 open(FH,">testout/t35ttfont.ppm") || die "cannot open testout/t35ttfont.ppm\n";
53 $IO = Imager::io_new_fd( fileno(FH) );
54 i_writeppm_wiol($overlay, $IO);
59 $bgcolor=i_color_set($bgcolor,200,200,200,0);
60 $backgr=Imager::ImgRaw::new(500,300,3);
64 i_tt_text($ttraw,$backgr,100,100,$bgcolor,50.0,'test',4,1);
66 my $ugly = Imager::i_tt_new("./fontfiles/ImUgly.ttf");
67 i_tt_text($ugly, $backgr,100, 50, $bgcolor, 14, 'g%g', 3, 1);
68 i_tt_text($ugly, $backgr,150, 50, $bgcolor, 14, 'delta', 5, 1);
71 open(FH,">testout/t35ttfont2.ppm") || die "cannot open testout/t35ttfont.ppm\n";
73 $IO = Imager::io_new_fd( fileno(FH) );
74 i_writeppm_wiol($backgr, $IO);