1 package Font::TTF::Mort::Subtable;
 
   5 Font::TTF::Mort::Subtable - Mort subtable superclass for AAT
 
  13 use Font::TTF::AATutils;
 
  16 require Font::TTF::Mort::Rearrangement;
 
  17 require Font::TTF::Mort::Contextual;
 
  18 require Font::TTF::Mort::Ligature;
 
  19 require Font::TTF::Mort::Noncontextual;
 
  20 require Font::TTF::Mort::Insertion;
 
  27     $class = ref($class) || $class;
 
  34     my ($class, $type, $coverage, $subFeatureFlags, $length) = @_;
 
  36     $class = ref($class) || $class;
 
  40         $subclass = 'Font::TTF::Mort::Rearrangement';
 
  43         $subclass = 'Font::TTF::Mort::Contextual';
 
  46         $subclass = 'Font::TTF::Mort::Ligature';
 
  49         $subclass = 'Font::TTF::Mort::Noncontextual';
 
  52         $subclass = 'Font::TTF::Mort::Insertion';
 
  55     my ($self) = $subclass->new(
 
  56             (($coverage & 0x4000) ? 'RL' : 'LR'),
 
  57             (($coverage & 0x2000) ? 'VH' : ($coverage & 0x8000) ? 'V' : 'H'),
 
  61     $self->{'type'} = $type;
 
  62     $self->{'length'} = $length;
 
  69 Writes the table to a file
 
  77     my ($subtableStart) = $fh->tell();
 
  78     my ($type) = $self->{'type'};
 
  79     my ($coverage) = $type;
 
  80     $coverage += 0x4000 if $self->{'direction'} eq 'RL';
 
  81     $coverage += 0x2000 if $self->{'orientation'} eq 'VH';
 
  82     $coverage += 0x8000 if $self->{'orientation'} eq 'V';
 
  84     $fh->print(TTF_Pack("SSL", 0, $coverage, $self->{'subFeatureFlags'}));    # placeholder for length
 
  86     my ($dat) = $self->pack_sub();
 
  89     my ($length) = $fh->tell() - $subtableStart;
 
  90     my ($padBytes) = (4 - ($length & 3)) & 3;
 
  91     $fh->print(pack("C*", (0) x $padBytes));
 
  93     $fh->seek($subtableStart, IO::File::SEEK_SET);
 
  94     $fh->print(pack("n", $length));
 
  95     $fh->seek($subtableStart + $length, IO::File::SEEK_SET);
 
 100 Prints a human-readable representation of the table
 
 108     my ($post) = $self->{' PARENT'}{' PARENT'}{' PARENT'}{'post'};
 
 123     return $self->{' PARENT'}->feat();
 
 128     my ($self, $fh) = @_;
 
 130     my ($feat) = $self->feat();
 
 131     my ($post) = $self->post();
 
 133     $fh = 'STDOUT' unless defined $fh;
 
 135     my ($type) = $self->{'type'};
 
 136     my ($subFeatureFlags) = $self->{'subFeatureFlags'};
 
 137     my ($defaultFlags) = $self->{' PARENT'}{'defaultFlags'};
 
 138     my ($featureEntries) = $self->{' PARENT'}{'featureEntries'};
 
 139     $fh->printf("\n\t%s table, %s, %s, subFeatureFlags = %08x # %s (%s)\n",
 
 140                 subtable_type_($type), $_->{'direction'}, $_->{'orientation'}, $subFeatureFlags,
 
 141                 "Default " . ((($subFeatureFlags & $defaultFlags) != 0) ? "On" : "Off"),
 
 144                         join(": ", $feat->settingName($_->{'type'}, $_->{'setting'}) )
 
 145                     } grep { ($_->{'enable'} & $subFeatureFlags) != 0 } @$featureEntries
 
 162     $res = $types[$val] or ('Undefined (' . $val . ')');
 
 167 =head2 $t->print_classes($fh)
 
 169 Prints a human-readable representation of the table
 
 175     my ($self, $fh) = @_;
 
 177     my ($post) = $self->post();
 
 179     my ($classes) = $self->{'classes'};
 
 180     foreach (0 .. $#$classes) {
 
 181         my $class = $classes->[$_];
 
 182         if (defined $class) {
 
 183             $fh->printf("\t\tClass %d:\t%s\n", $_, join(", ", map { $_ . " [" . $post->{'VAL'}[$_] . "]" } @$class));
 
 196 Jonathan Kew L<Jonathan_Kew@sil.org>. See L<Font::TTF::Font> for copyright and