Introduce src dir.
[librarian.git] / src / librarian / font-optimizer / ext / Font-TTF / lib / Font / TTF / Cvt_.pm
1 package Font::TTF::Cvt_;
2
3 =head1 NAME
4
5 Font::TTF::Cvt_ - Control Value Table in a TrueType font
6
7 =head1 DESCRIPTION
8
9 This is a minimal class adding nothing beyond a table, but is a repository
10 for cvt type information for those processes brave enough to address hinting.
11
12 =head1 INSTANCE VARIABLES
13
14 =over 4
15
16 =item val
17
18 This is an array of CVT values. Thus access to the CVT is via:
19
20     $f->{'cvt_'}{'val'}[$num];
21
22 =back    
23
24 =head1 METHODS
25
26 =cut
27
28 use strict;
29 use vars qw(@ISA $VERSION);
30 use Font::TTF::Utils;
31
32 @ISA = qw(Font::TTF::Table);
33
34 $VERSION = 0.0001;
35
36 =head2 $t->read
37
38 Reads the CVT table into both the tables C<' dat'> variable and the C<val>
39 array.
40
41 =cut
42
43 sub read
44 {
45     my ($self) = @_;
46
47     $self->read_dat || return undef;
48     $self->{' read'} = 1;
49     $self->{'val'} = [TTF_Unpack("s*", $self->{' dat'})];
50     $self;
51 }
52
53
54 =head2 $t->update
55
56 Updates the RAM file copy C<' dat'> to be the same as the array.
57
58 =cut
59
60 sub update
61 {
62     my ($self) = @_;
63
64     return undef unless ($self->{' read'} && $#{$self->{'val'}} >= 0);
65     $self->{' dat'} = TTF_Pack("s*", @{$self->{'val'}});
66     $self;
67 }
68
69 1;
70
71 =head1 BUGS
72
73 None known
74
75 =head1 AUTHOR
76
77 Martin Hosken Martin_Hosken@sil.org. See L<Font::TTF::Font> for copyright and
78 licensing.
79
80 =cut
81