File Coverage

blib/lib/PDF/Make/Builder/Text/H5.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::H5;
2 42     42   225 use strict;
  42         77  
  42         1241  
3 42     42   169 use warnings;
  42         52  
  42         1591  
4 42     42   191 use Object::Proto;
  42         67  
  42         2558  
5              
6             BEGIN {
7 42     42   4445 Object::Proto::define('PDF::Make::Builder::Text::H5',
8             extends => 'PDF::Make::Builder::Text',
9             'toc:Bool:default(0)',
10             );
11 42         8420 Object::Proto::import_accessors('PDF::Make::Builder::Text::H5');
12             }
13              
14             sub add {
15 2     2 1 5 my ($self, $builder) = @_;
16 2         17 my $f = font $self // {};
17 2   50     10 $f->{size} //= 20;
18 2   50     8 $f->{line_height} //= 24;
19 2         4 font $self, $f;
20              
21 2 50 33     13 if ($self->toc && $builder->toc) {
22 0         0 $builder->toc->outline($builder, 5,
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__