File Coverage

blib/lib/PDF/Make/Builder/Text/H1.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition 4 7 57.1
subroutine 5 5 100.0
pod 1 1 100.0
total 31 34 91.1


line stmt bran cond sub pod time code
1             package PDF::Make::Builder::Text::H1;
2 42     42   220 use strict;
  42         56  
  42         1291  
3 42     42   176 use warnings;
  42         70  
  42         1562  
4 42     42   169 use Object::Proto;
  42         75  
  42         2577  
5              
6             BEGIN {
7 42     42   4094 Object::Proto::define('PDF::Make::Builder::Text::H1',
8             extends => 'PDF::Make::Builder::Text',
9             'toc:Bool:default(0)',
10             );
11 42         7982 Object::Proto::import_accessors('PDF::Make::Builder::Text::H1');
12             }
13              
14             sub add {
15 30     30 1 85 my ($self, $builder) = @_;
16 30         70 my $f = font $self // {};
17 30   50     131 $f->{size} //= 50;
18 30   50     99 $f->{line_height} //= 70;
19 30         37 font $self, $f;
20 30 100 66     112 if ($self->toc && $builder->toc) {
21 5         33 $builder->toc->outline($builder, 1,
22             text => PDF::Make::Builder::Text::text($self),
23             page_num => $builder->page->num,
24             );
25             }
26 30         121 return $self->SUPER::add($builder);
27             }
28              
29             1;
30              
31             __END__