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

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 40 CC 2 SCAR 11.5
CC
2
Cov
0%
XML_end
6.0
read
2.0
out_xml
2.0
CRAP 3.1
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: Prep.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $
25 #
26 #=======================================================================
27 package PDF::API3::Compat::API2::Basic::TTF::Prep;
28
29 =head1 NAME
30
31 PDF::API3::Compat::API2::Basic::TTF::Prep - Preparation hinting program. Called when ppem changes
32
33 =head1 DESCRIPTION
34
35 This is a minimal class adding nothing beyond a table, but is a repository
36 for prep type information for those processes brave enough to address hinting.
37
38 =cut
39
40 use strict;
41 use vars qw(@ISA $VERSION);
42 use PDF::API3::Compat::API2::Basic::TTF::Utils;
43
44 @ISA = qw(PDF::API3::Compat::API2::Basic::TTF::Table);
45
46 $VERSION = 0.0001;
47
48
49 =head2 $t->read
50
51 Reads the data using C<read_dat>.
52
53 =cut
54
55 sub read
56 {
57 $_[0]->read_dat;
58 $_[0]->{' read'} = 1;
59 }
60
61
62 =head2 $t->out_xml($context, $depth)
63
64 Outputs Prep program as XML
65
66 =cut
67
68 sub out_xml
69 {
70 my ($self, $context, $depth) = @_;
71 my ($fh) = $context->{'fh'};
72 my ($dat);
73
74 $self->read;
75 $dat = PDF::API3::Compat::API2::Basic::TTF::Utils::XML_binhint($self->{' dat'});
76 $dat =~ s/\n(?!$)/\n$depth$context->{'indent'}/omg;
77 $fh->print("$depth<code>\n");
78 $fh->print("$depth$context->{'indent'}$dat");
79 $fh->print("$depth</code>\n");
80 $self;
81 }
82
83
84 =head2 $t->XML_end($context, $tag, %attrs)
85
86 Parse all that hinting code
87
88 =cut
89
90 sub XML_end
91 {
92 my ($self) = shift;
93 my ($context, $tag, %attrs) = @_;
94
95 if ($tag eq 'code')
96 {
97 $self->{' dat'} = PDF::API3::Compat::API2::Basic::TTF::Utils::XML_hintbin($context->{'text'});
98 return $context;
99 } else
100 { return $self->SUPER::XML_end(@_); }
101 }
102
103 1;
104
105 =head1 BUGS
106
107 None known
108
109 =head1 AUTHOR
110
111 Martin Hosken Martin_Hosken@sil.org. See L<PDF::API3::Compat::API2::Basic::TTF::Font> for copyright and
112 licensing.
113
114 =cut
115