1 package Font::TTF::AATKern;
5 Font::TTF::AATKern - AAT Kern table
14 use Font::TTF::AATutils;
15 use Font::TTF::Kern::Subtable;
17 @ISA = qw(Font::TTF::Table);
21 Reads the table into memory
29 $self->SUPER::read or return $self;
31 my ($dat, $fh, $numSubtables);
32 $fh = $self->{' INFILE'};
35 ($self->{'version'}, $numSubtables) = TTF_Unpack("vL", $dat);
38 foreach (1 .. $numSubtables) {
39 my $subtableStart = $fh->tell();
42 my ($length, $coverage, $tupleIndex) = TTF_Unpack("LSS", $dat);
43 my $type = $coverage & 0x00ff;
45 my $subtable = Font::TTF::Kern::Subtable->create($type, $coverage, $length);
48 $subtable->{'tupleIndex'} = $tupleIndex if $subtable->{'variation'};
49 $subtable->{' PARENT'} = $self;
50 push @$subtables, $subtable;
53 $self->{'subtables'} = $subtables;
60 Writes the table to a file either from memory or by copying
68 return $self->SUPER::out($fh) unless $self->{' read'};
70 my $subtables = $self->{'subtables'};
71 $fh->print(TTF_Pack("vL", $self->{'version'}, scalar @$subtables));
73 foreach (@$subtables) {
80 Prints a human-readable representation of the table
88 $self->read unless $self->{' read'};
90 $fh = 'STDOUT' unless defined $fh;
92 $fh->printf("version %f\n", $self->{'version'});
94 my $subtables = $self->{'subtables'};
95 foreach (@$subtables) {
102 my ($self, $fh) = @_;
103 $self->read unless $self->{' read'};
105 my $post = $self->{' PARENT'}->{'post'};
108 $fh = 'STDOUT' unless defined $fh;
109 $fh->printf("<kern version=\"%f\">\n", $self->{'version'});
111 my $subtables = $self->{'subtables'};
112 foreach (@$subtables) {
113 $fh->printf("<%s", $_->type);
114 $fh->printf(" vertical=\"1\"") if $_->{'vertical'};
115 $fh->printf(" crossStream=\"1\"") if $_->{'crossStream'};
116 $fh->printf(" variation=\"1\"") if $_->{'variation'};
117 $fh->printf(" tupleIndex=\"%s\"", $_->{'tupleIndex'}) if exists $_->{'tupleIndex'};
122 $fh->printf("</%s>\n", $_->type);
125 $fh->printf("</kern>\n");
136 Jonathan Kew L<Jonathan_Kew@sil.org>. See L<Font::TTF::Font> for copyright and