1 package Font::TTF::Prop;
5 Font::TTF::Prop - Glyph Properties table in a font
9 =head1 INSTANCE VARIABLES
17 Hash of property values keyed by glyph number
28 use Font::TTF::AATutils;
29 use Font::TTF::Segarr;
31 @ISA = qw(Font::TTF::Table);
35 Reads the table into memory
43 my ($version, $lookupPresent, $default);
45 $self->SUPER::read or return $self;
47 $fh = $self->{' INFILE'};
49 ($version, $lookupPresent, $default) = TTF_Unpack("vSS", $dat);
52 my ($format, $lookup) = AAT_read_lookup($fh, 2, $self->{' LENGTH'} - 8, $default);
53 $self->{'lookup'} = $lookup;
54 $self->{'format'} = $format;
57 $self->{'version'} = $version;
58 $self->{'default'} = $default;
66 Writes the table to a file either from memory or by copying
73 my ($default, $lookup);
75 return $self->SUPER::out($fh) unless $self->{' read'};
77 $default = $self->{'default'};
78 $lookup = $self->{'lookup'};
79 $fh->print(TTF_Pack("vSS", $self->{'version'}, (defined $lookup ? 1 : 0), $default));
81 AAT_write_lookup($fh, $self->{'format'}, $lookup, 2, $default) if (defined $lookup);
86 Prints a human-readable representation of the table
97 $fh = 'STDOUT' unless defined $fh;
99 $fh->printf("version %f\ndefault %04x # %s\n", $self->{'version'}, $self->{'default'}, meaning_($self->{'default'}));
100 $lookup = $self->{'lookup'};
101 if (defined $lookup) {
102 $fh->printf("format %d\n", $self->{'format'});
103 foreach (sort { $a <=> $b } keys %$lookup) {
104 $fh->printf("\t%d -> %04x # %s\n", $_, $lookup->{$_}, meaning_($lookup->{$_}));
115 "Strong left-to-right",
116 "Strong right-to-left",
119 "European number separator",
120 "European number terminator",
122 "Common number separator",
127 $res = $types[$val & 0x001f] or ("Undefined [" . ($val & 0x001f) . "]");
129 $res .= ", floater" if $val & 0x8000;
130 $res .= ", hang left" if $val & 0x4000;
131 $res .= ", hang right" if $val & 0x2000;
132 $res .= ", attaches on right" if $val & 0x0080;
133 $res .= ", pair" if $val & 0x1000;
134 my $pairOffset = ($val & 0x0f00) >> 8;
135 $pairOffset = $pairOffset - 16 if $pairOffset > 7;
136 $res .= $pairOffset > 0 ? " +" . $pairOffset : $pairOffset < 0 ? " " . $pairOffset : "";
150 Jonathan Kew L<Jonathan_Kew@sil.org>. See L<Font::TTF::Font> for copyright and