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

filter: Statementstmt 0.0% 0 / 32 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 / 56 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 Martin Hosken <Martin_Hosken@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: PCLT.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $
25 #
26 #=======================================================================
27 package PDF::API3::Compat::API2::Basic::TTF::PCLT;
28
29 =head1 NAME
30
31 PDF::API3::Compat::API2::Basic::TTF::PCLT - PCLT TrueType font table
32
33 =head1 DESCRIPTION
34
35 The PCLT table holds various pieces HP-PCL specific information. Information
36 here is generally not used by other software, except for the xHeight and
37 CapHeight which are stored here (if the table exists in a font).
38
39 =head1 INSTANCE VARIABLES
40
41 Only from table and the standard:
42
43 version
44 FontNumber
45 Pitch
46 xHeight
47 Style
48 TypeFamily
49 CapHeight
50 SymbolSet
51 Typeface
52 CharacterComplement
53 FileName
54 StrokeWeight
55 WidthType
56 SerifStyle
57
58 Notice that C<Typeface>, C<CharacterComplement> and C<FileName> return arrays
59 of unsigned characters of the appropriate length
60
61 =head1 METHODS
62
63 =cut
64
65 use strict;
66 use vars qw(@ISA %fields @field_info);
67
68 require PDF::API3::Compat::API2::Basic::TTF::Table;
69 use PDF::API3::Compat::API2::Basic::TTF::Utils;
70
71 @ISA = qw(PDF::API3::Compat::API2::Basic::TTF::Table);
72 @field_info = (
73 'version' => 'f',
74 'FontNumber' => 'L',
75 'Pitch' => 'S',
76 'xHeight' => 'S',
77 'Style' => 'S',
78 'TypeFamily' => 'S',
79 'CapHeight' => 'S',
80 'SymbolSet' => 'S',
81 'Typeface' => 'C16',
82 'CharacterComplement' => 'C8',
83 'FileName' => 'C6',
84 'StrokeWeight' => 'C',
85 'WidthType' => 'C',
86 'SerifStyle' => 'c');
87
88 sub init
89 {
90 my ($k, $v, $c, $i);
91 for ($i = 0; $i < $#field_info; $i += 2)
92 {
93 ($k, $v, $c) = TTF_Init_Fields($field_info[$i], $c, $field_info[$i + 1]);
94 next unless defined $k && $k ne "";
95 $fields{$k} = $v;
96 }
97 }
98
99
100 =head2 $t->read
101
102 Reads the table into memory thanks to some utility functions
103
104 =cut
105
106 sub read
107 {
108 my ($self) = @_;
109 my ($dat);
110
111 $self->SUPER::read || return $self;
112
113 init unless defined $fields{'xHeight'};
114 $self->{' INFILE'}->read($dat, 54);
115
116 TTF_Read_Fields($self, $dat, \%fields);
117 $self;
118 }
119
120
121 =head2 $t->out($fh)
122
123 Writes the table to a file either from memory or by copying.
124
125 =cut
126
127 sub out
128 {
129 my ($self, $fh) = @_;
130
131 return $self->SUPER::out($fh) unless $self->{' read'};
132 $fh->print(TTF_Out_Fields($self, \%fields, 54));
133 }
134
135 1;
136
137 =head1 BUGS
138
139 None known
140
141 =head1 AUTHOR
142
143 Martin Hosken Martin_Hosken@sil.org. See L<PDF::API3::Compat::API2::Basic::TTF::Font> for copyright and
144 licensing.
145
146 =cut
147