File: lib.pl

package info (click to toggle)
libgd-text-perl 0.86-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: perl: 840; makefile: 8
file content (33 lines) | stat: -rw-r--r-- 770 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# allow a 2 pixel difference between the values in array ref 1 and array
# ref 2

# pull Dustismo_Sans from the Debian package fonts-dustin
use File::Copy;
use File::Path qw(make_path);
copy("/usr/share/fonts/truetype/dustin/Dustismo.ttf", "./Dustismo_Sans.ttf")
    or die "copy failed: $!";
make_path('demo');

eval { local $SIG{'__WARN__'}; require Test::More };
if ($@)
{
    # Test::More is not available
    print "1..1\n";
    print "ok 1 # skip Skipping all tests: No Test::More\n";
    exit 0;
}

sub main::aeq
{
    my ($a1, $a2, $e) = @_;
    $e = 0 unless $e;
    return 0 if @$a1 != @$a2;
    for (my $i = 0; $i < @$a1; $i++)
    {
        return 0 if $a1->[$i] > $a2->[$i] + $e || 
                    $a1->[$i] < $a2->[$i] - $e;
    }
    return 1;
}

1;