1Font::TTF::Kern(3) User Contributed Perl Documentation Font::TTF::Kern(3)
2
3
4
6 Font::TTF::Kern - Kerning tables
7
9 Kerning tables are held as an ordered collection of subtables each
10 giving incremental information regarding the kerning of various pairs
11 of glyphs.
12
13 The basic structure of the kerning data structure is:
14
15 $kern = $f->{'kern'}{'tables'}[$tnum]{'kerns'}{$leftnum}{$rightnum};
16
17 Due to the possible complexity of some kerning tables the above
18 information is insufficient. Reference also needs to be made to the
19 type of the table and the coverage field.
20
22 The instance variables for a kerning table are relatively
23 straightforward.
24
25 Version
26 Version number of the kerning table
27
28 Num Number of subtables in the kerning table
29
30 tables
31 Array of subtables in the kerning table
32
33 Each subtable has a number of instance variables.
34
35 kern
36 A two level hash array containing kerning values. The indexing
37 is left is via left class and right class. It may seem using
38 hashes is strange, but most tables are not type 2 and this
39 method saves empty array values.
40
41 type
42 Stores the table type. Only type 0 and type 2 tables are
43 specified for TrueType so far.
44
45 coverage
46 A bit field of coverage information regarding the kerning
47 value. See the TrueType specification for details.
48
49 Version
50 Contains the version number of the table.
51
52 Num Number of kerning pairs in this type 0 table.
53
54 left
55 An array indexed by glyph - left_first which returns a class
56 number for the glyph in type 2 tables.
57
58 right
59 An array indexed by glyph - right_first which returns a class
60 number for the glyph in type 2 tables.
61
62 left_first
63 the glyph number of the first element in the left array for
64 type 2 tables.
65
66 right_first
67 the glyph number of the first element in the right array for
68 type 2 tables.
69
70 num_left
71 Number of left classes
72
73 num_right
74 Number of right classes
75
77 $t->read
78 Reads the whole kerning table into structures
79
80 $t->out($fh)
81 Outputs the kerning tables to the given file
82
83 $t->XML_element($context, $depth, $key, $value)
84 Handles outputting the kern hash into XML a little more tidily
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
91 • Only supports kerning table types 0 & 2.
92
93 • No real support functions to do anything with the kerning tables
94 yet.
95
97 Martin Hosken <http://scripts.sil.org/FontUtils>.
98
100 Copyright (c) 1998-2016, SIL International (http://www.sil.org)
101
102 This module is released under the terms of the Artistic License 2.0.
103 For details, see the full text of the license in the file LICENSE.
104
105
106
107perl v5.36.0 2023-01-20 Font::TTF::Kern(3)