File Coverage

blib/lib/Text/Layout/ElementRole.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1             #! perl
2              
3 3     3   41 use v5.26;
  3         12  
4 3     3   18 use Object::Pad;
  3         8  
  3         27  
5 3     3   465 use utf8;
  3         5  
  3         23  
6 3     3   114 use Carp;
  3         12  
  3         858  
7              
8             role Text::Layout::ElementRole;
9              
10             # Implementors of this role must provide the following methods:
11              
12             method parse( $ctx, $el, $atts );
13             #
14             # $ctx: context (current values for font, size, etc.)
15             # $el : the elemant name, e.g. "img"
16             # $atts: anything that follows the tag, presumably atributes
17             #
18             # If the element is "" then $el = "foo"
19             # and $atts = "bar blech".
20             #
21             # Should return a hash reference with whatever is useful.
22              
23             method render( $hash, $gfx, $x, $y );
24             #
25             # $hash: the hash as delivered by the parser
26             # $gfx : PDF graphics context
27             # $x : $x origin
28             # $y : $y origin
29             #
30             # Should return the advance box (array ref).
31              
32             method bbox( $hash );
33             #
34             # $hash: the hash as delivered by the parser
35             #
36             # Should return a hash ref with
37             # bbox : the bounding box of the image
38             # bb : the bounding box after scaling/displacement
39             # abox : the advance box
40              
41             1;