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 Reads the cmap into memory. Format 4 subtables read the whole subtable
46 and fill in the segmented array accordingly.
47
48 $t->ms_lookup($uni)
49 Finds a Unicode table, giving preference to the MS one, and looks up
50 the given Unicode codepoint in it to find the glyph id.
51
52 $t->find_ms
53 Finds the a Unicode table, giving preference to the Microsoft one, and
54 sets the "mstable" instance variable to it if found. Returns the table
55 it finds.
56
57 $t->ms_enc
58 Returns the encoding of the microsoft table (0 => symbol, etc.).
59 Returns undef if there is no Microsoft cmap.
60
61 $t->out($fh)
62 Writes out a cmap table to a filehandle. If it has not been read, then
63 just copies from input file to output
64
65 $t->XML_element($context, $depth, $name, $val)
66 Outputs the elements of the cmap in XML. We only need to process val
67 here
68
69 @map = $t->reverse(%opt)
70 Returns a reverse map of the Unicode cmap. I.e. given a glyph gives the
71 Unicode value for it. Options are:
72
73 tnum
74 Table number to use rather than the default Unicode table
75
76 array
77 Returns each element of reverse as an array since a glyph may be
78 mapped by more than one Unicode value. The arrays are unsorted.
79 Otherwise store any one unicode value for a glyph.
80
81 is_unicode($index)
82 Returns whether the table of a given index is known to be a unicode
83 table (as specified in the specifications)
84
86 ยท No support for format 2 tables (MBCS)
87
89 Martin Hosken Martin_Hosken@sil.org. See Font::TTF::Font for copyright
90 and licensing.
91
92
93
94perl v5.12.0 2008-06-11 Font::TTF::Cmap(3)