1Font::TTF::Cmap(3) User Contributed Perl Documentation Font::TTF::Cmap(3)
2
3
4
6 Font::TTF::Cmap - Character map table
7
9 Looks after the character map. For ease of use, the actual cmap is held
10 in a hash against codepoint. Thus for a given table:
11
12 $gid = $font->{'cmap'}{'Tables'}[0]{'val'}{$code};
13
14 Note that $code should be a true value (0x1234) rather than a string
15 representation.
16
18 The instance variables listed here are not preceeded by a space due to
19 their emulating structural information in the font.
20
21 Num Number of subtables in this table
22
23 Tables
24 An array of subtables ([0..Num-1])
25
26 Each subtables also has its own instance variables which are, again,
27 not preceeded by a space.
28
29 Platform
30 The platform number for this subtable
31
32 Encoding
33 The encoding number for this subtable
34
35 Format
36 Gives the stored format of this subtable
37
38 Ver Gives the version (or language) information for this subtable
39
40 val A hash keyed by the codepoint value (not a string) storing the
41 glyph id
42
44 $t->read
45
46 Reads the cmap into memory. Format 4 subtables read the whole subtable
47 and fill in the segmented array accordingly.
48
49 Format 2 subtables are not read at all.
50
51 $t->ms_lookup($uni)
52
53 Finds a Unicode table, giving preference to the MS one, and looks up
54 the given Unicode codepoint in it to find the glyph id.
55
56 $t->find_ms
57
58 Finds the a Unicode table, giving preference to the Microsoft one, and
59 sets the "mstable" instance variable to it if found. Returns the table
60 it finds.
61
62 $t->ms_enc
63
64 Returns the encoding of the microsoft table (0 => symbol, etc.).
65 Returns undef if there is no Microsoft cmap.
66
67 $t->out($fh)
68
69 Writes out a cmap table to a filehandle. If it has not been read, then
70 just copies from input file to output
71
72 $t->XML_element($context, $depth, $name, $val)
73
74 Outputs the elements of the cmap in XML. We only need to process val
75 here
76
77 @map = $t->reverse(%opt)
78
79 Returns a reverse map of the Unicode cmap. I.e. given a glyph gives the
80 Unicode value for it. Options are:
81
82 tnum
83 Table number to use rather than the default Unicode table
84
85 array
86 Returns each element of reverse as an array since a glyph may be
87 mapped by more than one Unicode value. The arrays are unsorted.
88
89 is_unicode($index)
90
91 Returns whether the table of a given index is known to be a unicode ta‐
92 ble (as specified in the specifications)
93
95 · No support for format 2 tables (MBCS)
96
98 Martin Hosken Martin_Hosken@sil.org. See Font::TTF::Font for copyright
99 and licensing.
100
101
102
103perl v5.8.8 2005-06-14 Font::TTF::Cmap(3)