1 package Font::TTF::Fdsc;
5 Font::TTF::Fdsc - Font Descriptors table in a font
9 =head1 INSTANCE VARIABLES
15 Hash keyed by descriptor tags
22 use vars qw(@ISA %fields);
25 @ISA = qw(Font::TTF::Table);
29 Reads the table into memory
36 my ($dat, $fh, $numDescs, $tag, $descs);
38 $self->SUPER::read or return $self;
40 $fh = $self->{' INFILE'};
42 $self->{'version'} = TTF_Unpack("v", $dat);
46 foreach (1 .. unpack("N", $dat)) {
49 $descs->{$tag} = ($tag eq 'nalf') ? unpack("N", $dat) : TTF_Unpack("f", $dat);
52 $self->{'descriptors'} = $descs;
60 Writes the table to a file either from memory or by copying
69 return $self->SUPER::out($fh) unless $self->{' read'};
71 $fh->print(TTF_Pack("v", $self->{'version'}));
73 $descs = $self->{'descriptors'} or {};
75 $fh->print(pack("N", scalar keys %$descs));
76 foreach (sort keys %$descs) {
78 $fh->print(($_ eq 'nalf') ? pack("N", $descs->{$_}) : TTF_Pack("f", $descs->{$_}));
86 Prints a human-readable representation of the table
97 $fh = 'STDOUT' unless defined $fh;
99 $descs = $self->{'descriptors'};
100 foreach $k (sort keys %$descs) {
102 $fh->printf("Descriptor '%s' = %d\n", $k, $descs->{$k});
105 $fh->printf("Descriptor '%s' = %f\n", $k, $descs->{$k});
121 Jonathan Kew L<Jonathan_Kew@sil.org>. See L<Font::TTF::Font> for copyright and