1 package Font::TTF::Kern::StateTable;
 
   5 Font::TTF::Kern::StateTable - State Table Kern subtable for AAT
 
  14 use Font::TTF::AATutils;
 
  15 use Font::TTF::Kern::Subtable;
 
  18 @ISA = qw(Font::TTF::Kern::Subtable);
 
  25     $class = ref($class) || $class;
 
  31 Reads the table into memory
 
  40     my $stTableStart = $fh->tell();
 
  42     my ($classes, $states, $entries) = AAT_read_state_table($fh, 0);
 
  45         my $flags = $_->{'flags'};
 
  47         $_->{'push'} = 1        if $flags & 0x8000;
 
  48         $_->{'noAdvance'} = 1    if $flags & 0x4000;
 
  52             $fh->seek($stTableStart + $flags, IO::File::SEEK_SET);
 
  55                 my $k = TTF_Unpack("s", $dat);
 
  56                 push @$kernList, ($k & ~1);
 
  57                 last if ($k & 1) != 0;
 
  59             $_->{'kernList'} = $kernList;
 
  63     $self->{'classes'} = $classes;
 
  64     $self->{'states'} = $states;
 
  65     $self->{'entries'} = $entries;
 
  67     $fh->seek($stTableStart - 8 + $self->{'length'}, IO::File::SEEK_SET);
 
  72 =head2 $t->out_sub($fh)
 
  74 Writes the table to a file
 
  84 Prints a human-readable representation of the table
 
  96     $fh->printf("<classes>\n");
 
  97     $self->dumpClasses($self->{'classes'}, $fh);
 
  98     $fh->printf("</classes>\n");
 
 100     $fh->printf("<states>\n");
 
 101     my $states = $self->{'states'};
 
 102     foreach (0 .. $#$states) {
 
 103         $fh->printf("<state index=\"%s\">\n", $_);
 
 104         my $members = $states->[$_];
 
 105         foreach (0 .. $#$members) {
 
 106             my $m = $members->[$_];
 
 107             $fh->printf("<m index=\"%s\" nextState=\"%s\"", $_, $m->{'nextState'});
 
 108             $fh->printf(" push=\"1\"")        if $m->{'push'};
 
 109             $fh->printf(" noAdvance=\"1\"")    if $m->{'noAdvance'};
 
 110             if (exists $m->{'kernList'}) {
 
 112                 foreach (@{$m->{'kernList'}}) {
 
 113                     $fh->printf("<kern v=\"%s\"/>", $_);
 
 115                 $fh->printf("</m>\n");
 
 121         $fh->printf("</state>\n");
 
 123     $fh->printf("</states>\n");
 
 128     return 'kernStateTable';
 
 139 Jonathan Kew L<Jonathan_Kew@sil.org>. See L<Font::TTF::Font> for copyright and