File Coverage

blib/lib/PDF/Make/Builder/Text/H3.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::H3;
2 42     42   208 use strict;
  42         63  
  42         1263  
3 42     42   169 use warnings;
  42         56  
  42         1688  
4 42     42   153 use Object::Proto;
  42         55  
  42         2348  
5              
6             BEGIN {
7 42     42   3785 Object::Proto::define('PDF::Make::Builder::Text::H3',
8             extends => 'PDF::Make::Builder::Text',
9             'toc:Bool:default(0)',
10             );
11 42         8179 Object::Proto::import_accessors('PDF::Make::Builder::Text::H3');
12             }
13              
14             sub add {
15 3     3 1 6 my ($self, $builder) = @_;
16 3         9 my $f = font $self // {};
17 3   50     28 $f->{size} //= 30;
18 3   50     12 $f->{line_height} //= 36;
19 3         5 font $self, $f;
20              
21 3 100 66     66 if ($self->toc && $builder->toc) {
22 1         6 $builder->toc->outline($builder, 3,
23             text => PDF::Make::Builder::Text::text($self),
24             page_num => $builder->page->num,
25             );
26             }
27              
28 3         15 return $self->SUPER::add($builder);
29             }
30              
31             1;
32              
33             __END__