blib/lib/Imager/Font/Test.pm

filter: Statementstmt 31.5% 12 / 38 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 100% 4 / 4 totaltotal 35.0% 20 / 57 CC 4 SCAR 13.0
CC
4
Cov
27%
_draw
6.0
has_chars
6.0
glyph_names
6.0
CRAP 3.7
« blib/lib/Imager/Fountain.pm ↑ Summary blib/lib/Imager/File/ICO.pm »
1 package Imager::Font::Test;
2 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = "1.003";
6  
7 1 ▶use base 'Imager::Font';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
10 1 my ($class, %opts) = @_;
11  
12 1 bless \%opts, shift;
13 }
14  
15 0 ▶sub _draw {
Subroutine _draw: not called CC=2 SCAR=17.9
16 0 my ($self, %input) = @_;
17  
18 0 my $text = $input{string};
19  
20 0 my $ppn = int($input{size} * 0.5 + 0.5);
21 0 my $desc = int($input{size} * 0.3 + 0.5);
22 0 my $asc = $input{size} - $desc;
23 0 my $width = $ppn * length $text;
24 0 my $x = $input{x};
25 0 my $y = $input{'y'};
26 0 ▶ $input{align} and $y -= $asc;
Branch: 1 branch
BranchTrueFalseTotal
$input{"align"} and $y -= $asc 0 0 0
27  
28 $input{image}->box(color => $input{color}, xmin => $x, ymin => $y,
29 0 xmax => $x + $width-1, ymax => $y + $input{size} - 1);
30  
31 0 return 1;
32 }
33  
34 0 ▶sub _bounding_box {
Subroutine _bounding_box: not called CC=1 SCAR=6.9
35 0 my ($self, %input) = @_;
36  
37 0 my $text = $input{string};
38  
39 0 my $ppn = int($input{size} * 0.5 + 0.5);
40 0 my $desc = int($input{size} * 0.3 + 0.5);
41 0 my $asc = $input{size} - $desc;
42  
43 0 return ( 0, -$desc, $ppn * length $text, $asc, -$desc, $asc, $ppn * length $text, 0 );
44 }
45  
46 0 ▶sub has_chars {
Subroutine has_chars: not called CC=2 SCAR=17.9
Pod documented
47 0 my ($self, %input) = @_;
48  
49 0 my $text = $input{string};
50 0 ▶ defined $text
Branch: 1 branch
BranchTrueFalseTotal
defined $text or return "Imager"->_set_error("has_chars: No string parameter supplied") 0 0 0
51 or return Imager->_set_error("has_chars: No string parameter supplied");
52  
53 0 return (1) x length $text;
54 }
55  
56 0 ▶sub face_name {
Subroutine face_name: not called CC=1 SCAR=6.9
Pod documented
57 0 "test";
58 }
59  
60 0 ▶sub glyph_names {
Subroutine glyph_names: not called CC=2 SCAR=17.9
Pod documented
61 0 my ($self, %input) = @_;
62  
63 0 my $text = $input{string};
64 0 ▶ defined $text
Branch: 1 branch
BranchTrueFalseTotal
defined $text or return "Imager"->_set_error("glyph_names: No string parameter supplied") 0 0 0
65 or return Imager->_set_error("glyph_names: No string parameter supplied");
66  
67 0 return (1) x length $text;
68 }
69  
70 1 1;
71  
72 =head1 NAME
73  
74 Imager::Font::Test - font driver producing consistent output for tests.
75  
76 =head1 SYNOPSIS
77  
78 my $font = Imager::Font::Test->new;
79  
80 # use $font where you use other fonts
81  
82 =head1 DESCRIPTION
83  
84 Imager::Font::Test is intended to produce consistent output without
85 being subject to the inconsistent output produced by different
86 versions of font libraries.
87  
88 The output is simple box for the whole string.
89  
90 =head1 AUTHOR
91  
92 Tony Cook <tony@develop-help.com>
93  
94 =cut
95  
« blib/lib/Imager/Fountain.pm ↑ Summary blib/lib/Imager/File/ICO.pm »