API3/Compat/API2/Basic/TTF/Fmtx.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 57 CC 4 SCAR 14.8
CC
4
Cov
0%
init
6.0
read
6.0
out
6.0
CRAP 4.4
1 #=======================================================================
2 # ____ ____ _____ _ ____ ___ ____
3 # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \
4 # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) |
5 # | __/| |_| | _| _ _ / ___ \| __/| | / __/
6 # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____|
7 #
8 # A Perl Module Chain to faciliate the Creation and Modification
9 # of High-Quality "Portable Document Format (PDF)" Files.
10 #
11 #=======================================================================
12 #
13 # THIS IS A REUSED PERL MODULE, FOR PROPER LICENCING TERMS SEE BELOW:
14 #
15 #
16 # Copyright Jonathan Kew L<Jonathan_Kew@sil.org>
17 #
18 # No warranty or expression of effectiveness, least of all regarding
19 # anyone's safety, is implied in this software or documentation.
20 #
21 # This specific module is licensed under the Perl Artistic License.
22 #
23 #
24 # $Id: Fmtx.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $
25 #
26 #=======================================================================
27 package PDF::API3::Compat::API2::Basic::TTF::Fmtx;
28
29 =head1 NAME
30
31 PDF::API3::Compat::API2::Basic::TTF::Fmtx - Font Metrics table
32
33 =head1 DESCRIPTION
34
35 This is a simple table with just standards specified instance variables
36
37 =head1 INSTANCE VARIABLES
38
39 version
40 glyphIndex
41 horizontalBefore
42 horizontalAfter
43 horizontalCaretHead
44 horizontalCaretBase
45 verticalBefore
46 verticalAfter
47 verticalCaretHead
48 verticalCaretBase
49
50 =head1 METHODS
51
52 =cut
53
54 use strict;
55 use vars qw(@ISA %fields @field_info);
56
57 require PDF::API3::Compat::API2::Basic::TTF::Table;
58 use PDF::API3::Compat::API2::Basic::TTF::Utils;
59
60 @ISA = qw(PDF::API3::Compat::API2::Basic::TTF::Table);
61 @field_info = (
62 'version' => 'f',
63 'glyphIndex' => 'L',
64 'horizontalBefore' => 'c',
65 'horizontalAfter' => 'c',
66 'horizontalCaretHead' => 'c',
67 'horizontalCaretBase' => 'c',
68 'verticalBefore' => 'c',
69 'verticalAfter' => 'c',
70 'verticalCaretHead' => 'c',
71 'verticalCaretBase' => 'c');
72
73 sub init
74 {
75 my ($k, $v, $c, $i);
76 for ($i = 0; $i < $#field_info; $i += 2)
77 {
78 ($k, $v, $c) = TTF_Init_Fields($field_info[$i], $c, $field_info[$i + 1]);
79 next unless defined $k && $k ne "";
80 $fields{$k} = $v;
81 }
82 }
83
84
85 =head2 $t->read
86
87 Reads the table into memory as instance variables
88
89 =cut
90
91 sub read
92 {
93 my ($self) = @_;
94 my ($dat);
95
96 $self->SUPER::read or return $self;
97 init unless defined $fields{'glyphIndex'};
98 $self->{' INFILE'}->read($dat, 16);
99
100 TTF_Read_Fields($self, $dat, \%fields);
101 $self;
102 }
103
104
105 =head2 $t->out($fh)
106
107 Writes the table to a file either from memory or by copying.
108
109 =cut
110
111 sub out
112 {
113 my ($self, $fh) = @_;
114
115 return $self->SUPER::out($fh) unless $self->{' read'};
116
117 $fh->print(TTF_Out_Fields($self, \%fields, 16));
118 $self;
119 }
120
121
122 1;
123
124
125 =head1 BUGS
126
127 None known
128
129 =head1 AUTHOR
130
131 Jonathan Kew L<Jonathan_Kew@sil.org>. See L<PDF::API3::Compat::API2::Basic::TTF::Font> for copyright and
132 licensing.
133
134 =cut