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
37 A two level hash array containing kerning values. The indexing
38 is left value and then right value. In the case of type 2
39 tables, the indexing is via left class and right class. It may
40 seem using hashes is strange, but most tables are not type 2
41 and this method saves empty array values.
42
43 type
44
45 Stores the table type. Only type 0 and type 2 tables are
46 specified for TrueType so far.
47
48 coverage
49
50 A bit field of coverage information regarding the kerning
51 value. See the TrueType specification for details.
52
53 Version
54
55 Contains the version number of the table.
56
57 Num
58
59 Number of kerning pairs in this type 0 table.
60
61 left
62
63 An array indexed by glyph - left_first which returns a class
64 number for the glyph in type 2 tables.
65
66 right
67
68 An array indexed by glyph - right_first which returns a class
69 number for the glyph in type 2 tables.
70
71 left_first
72
73 the glyph number of the first element in the left array for
74 type 2 tables.
75
76 right_first
77
78 the glyph number of the first element in the right array for
79 type 2 tables.
80
81 num_left
82
83 Number of left classes
84
85 num_right
86
87 Number of right classes
88
90 $t->read
91 Reads the whole kerning table into structures
92
93 $t->out($fh)
94 Outputs the kerning tables to the given file
95
96 $t->XML_element($context, $depth, $key, $value)
97 Handles outputting the kern hash into XML a little more tidily
98
100 · Only supports kerning table types 0 & 2.
101
102 · No real support functions to do anything with the kerning tables
103 yet.
104
106 Martin Hosken Martin_Hosken@sil.org. See Font::TTF::Font for copyright
107 and licensing.
108
110 Hey! The above document had some coding errors, which are explained
111 below:
112
113 Around line 38:
114 You can't have =items (as at line 42) unless the first thing after
115 the =over is an =item
116
117
118
119perl v5.12.0 2008-06-11 Font::TTF::Kern(3)