1Font::TTF::Table(3) User Contributed Perl Documentation Font::TTF::Table(3)
2
3
4
6 Font::TTF::Table - Superclass for tables and used for tables we don't
7 have a class for
8
10 Looks after the purely table aspects of a TTF table, such as whether
11 the table has been read before, locating the file pointer, etc. Also
12 copies tables from input to output.
13
15 Instance variables start with a space
16
17 read
18 Flag which indicates that the table has already been read from
19 file.
20
21 dat Allows the creation of unspecific tables. Data is simply output to
22 any font file being created.
23
24 nocompress
25 If set, overrides the font default for WOFF table compression. Is a
26 scalar integer specifying a table size threshold below which this
27 table will not be compressed. Set to -1 to never compress; 0 to
28 always compress.
29
30 INFILE
31 The read file handle
32
33 OFFSET
34 Location of the file in the input file
35
36 LENGTH
37 Length in the input directory
38
39 ZLENGTH
40 Compressed length of the table if a WOFF font. 0 < ZLENGTH < LENGTH
41 implies table is compressed.
42
43 CSUM
44 Checksum read from the input file's directory
45
46 PARENT
47 The Font::TTF::Font that table is part of
48
50 Font::TTF::Table->new(%parms)
51 Creates a new table or subclass. Table instance variables are passed in
52 at this point as an associative array.
53
54 $t->read
55 Reads the table from the input file. Acts as a superclass to all true
56 tables. This method marks the table as read and then just sets the
57 input file pointer but does not read any data. If the table has already
58 been read, then returns "undef" else returns $self
59
60 For WOFF-compressed tables, the table is first decompressed and a
61 replacement file handle is created for reading the decompressed data.
62 In this case ORIGINALOFFSET will preserve the original value of OFFSET
63 for applications that care.
64
65 $t->read_dat
66 Reads the table into the "dat" instance variable for those tables which
67 don't know any better
68
69 $t->out($fh)
70 Writes out the table to the font file. If there is anything in the
71 "dat" instance variable then this is output, otherwise the data is
72 copied from the input file to the output
73
74 $t->out_xml($context)
75 Outputs this table in XML format. The table is first read (if not
76 already read) and then if there is no subclass, then the data is dumped
77 as hex data
78
79 $t->XML_element
80 Output a particular element based on its contents.
81
82 $t->XML_end($context, $tag, %attrs)
83 Handles the default type of <data> for those tables which aren't
84 subclassed
85
86 $t->minsize()
87 Returns the minimum size this table can be. If it is smaller than this,
88 then the table must be bad and should be deleted or whatever.
89
90 $t->dirty($val)
91 This sets the dirty flag to the given value or 1 if no given value. It
92 returns the value of the flag
93
94 $t->update
95 Each table knows how to update itself. This consists of doing whatever
96 work is required to ensure that the memory version of the table is
97 consistent and that other parameters in other tables have been updated
98 accordingly. I.e. by the end of sending "update" to all the tables,
99 the memory version of the font should be entirely consistent.
100
101 Some tables which do no work indicate to themselves the need to update
102 themselves by setting isDirty above 1. This method resets that
103 accordingly.
104
105 $t->empty
106 Clears a table of all data to the level of not having been read
107
108 $t->release
109 Releases ALL of the memory used by this table, and all of its
110 component/child objects. This method is called automatically by
111 'Font::TTF::Font->release' (so you don't have to call it yourself).
112
113 NOTE, that it is important that this method get called at some point
114 prior to the actual destruction of the object. Internally, we track
115 things in a structure that can result in circular references, and
116 without calling '"release()"' these will not properly get cleaned up by
117 Perl. Once this method has been called, though, don't expect to be
118 able to do anything with the "Font::TTF::Table" object; it'll have no
119 internal state whatsoever.
120
121 Developer note: As part of the brute-force cleanup done here, this
122 method will throw a warning message whenever unexpected key values are
123 found within the "Font::TTF::Table" object. This is done to help
124 ensure that any unexpected and unfreed values are brought to your
125 attention so that you can bug us to keep the module updated properly;
126 otherwise the potential for memory leaks due to dangling circular
127 references will exist.
128
130 No known bugs
131
133 Martin Hosken <http://scripts.sil.org/FontUtils>.
134
136 Copyright (c) 1998-2016, SIL International (http://www.sil.org)
137
138 This module is released under the terms of the Artistic License 2.0.
139 For details, see the full text of the license in the file LICENSE.
140
141
142
143perl v5.34.0 2022-01-21 Font::TTF::Table(3)