Version bump.
[librarian.git] / librarian / font-optimizer / ext / Font-TTF / lib / Font / TTF / Fpgm.pm
1 package Font::TTF::Fpgm;
2
3 =head1 NAME
4
5 Font::TTF::Fpgm - Font program in a TrueType font. Called when a font is loaded
6
7 =head1 DESCRIPTION
8
9 This is a minimal class adding nothing beyond a table, but is a repository
10 for fpgm type information for those processes brave enough to address hinting.
11
12 =cut
13
14 use strict;
15 use vars qw(@ISA $VERSION);
16
17 @ISA = qw(Font::TTF::Table);
18
19 $VERSION = 0.0001;
20
21 =head2 $t->read
22
23 Reading this table is simply a process of reading all the data into the RAM
24 copy. Nothing more is done with it.
25
26 =cut
27
28 sub read
29 {
30     $_[0]->read_dat;
31     $_[0]->{' read'} = 1;
32 }
33
34 =head2 $t->out_xml($context, $depth)
35
36 Outputs Fpgm program as XML
37
38 =cut
39
40 sub out_xml
41 {
42     my ($self, $context, $depth) = @_;
43     my ($fh) = $context->{'fh'};
44     my ($dat);
45
46     $self->read;
47     $dat = Font::TTF::Utils::XML_binhint($self->{' dat'});
48     $dat =~ s/\n(?!$)/\n$depth$context->{'indent'}/omg;
49     $fh->print("$depth<code>\n");
50     $fh->print("$depth$context->{'indent'}$dat");
51     $fh->print("$depth</code>\n");
52     $self;
53 }
54
55
56 =head2 $t->XML_end($context, $tag, %attrs)
57
58 Parse all that hinting code
59
60 =cut
61
62 sub XML_end
63 {
64     my ($self) = shift;
65     my ($context, $tag, %attrs) = @_;
66
67     if ($tag eq 'code')
68     {
69         $self->{' dat'} = Font::TTF::Utils::XML_hintbin($context->{'text'});
70         return $context;
71     } else
72     { return $self->SUPER::XML_end(@_); }
73 }
74
75 1;
76
77 =head1 BUGS
78
79 None known
80
81 =head1 AUTHOR
82
83 Martin Hosken Martin_Hosken@sil.org. See L<Font::TTF::Font> for copyright and
84 licensing.
85
86 =cut
87