File Coverage

blib/lib/PDF/Make/Builder/Text/H4.pm
Criterion Covered Total %
statement 18 19 94.7
branch 1 2 50.0
condition 3 7 42.8
subroutine 5 5 100.0
pod 1 1 100.0
total 28 34 82.3


line stmt bran cond sub pod time code
1             package PDF::Make::Builder::Text::H4;
2 42     42   242 use strict;
  42         61  
  42         1836  
3 42     42   181 use warnings;
  42         77  
  42         1824  
4 42     42   157 use Object::Proto;
  42         80  
  42         2611  
5              
6             BEGIN {
7 42     42   3935 Object::Proto::define('PDF::Make::Builder::Text::H4',
8             extends => 'PDF::Make::Builder::Text',
9             'toc:Bool:default(0)',
10             );
11 42         8311 Object::Proto::import_accessors('PDF::Make::Builder::Text::H4');
12             }
13              
14             sub add {
15 2     2 1 5 my ($self, $builder) = @_;
16 2         6 my $f = font $self // {};
17 2   50     10 $f->{size} //= 25;
18 2   50     9 $f->{line_height} //= 29;
19 2         3 font $self, $f;
20              
21 2 50 33     8 if ($self->toc && $builder->toc) {
22 0         0 $builder->toc->outline($builder, 4,
23             text => PDF::Make::Builder::Text::text($self),
24             page_num => $builder->page->num,
25             );
26             }
27              
28 2         9 return $self->SUPER::add($builder);
29             }
30              
31             1;
32              
33             __END__