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 preceded 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 subtable also has its own instance variables which are, again,
27 not preceded 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
43 The following cmap options are controlled by instance variables that
44 start with a space:
45
46 allowholes
47 By default, when generating format 4 cmap subtables character codes
48 that point to glyph zero (normally called .notdef) are not included
49 in the subtable. In some cases including some of these character
50 codes can result in a smaller format 4 subtable. To enable this
51 behavior, set allowholes to non-zero.
52
54 $t->read
55 Reads the cmap into memory. Format 4 subtables read the whole subtable
56 and fill in the segmented array accordingly.
57
58 $t->ms_lookup($uni)
59 Finds a Unicode table, giving preference to the MS one, and looks up
60 the given Unicode codepoint in it to find the glyph id.
61
62 $t->find_ms
63 Finds the a Unicode table, giving preference to the Microsoft one, and
64 sets the "mstable" instance variable to it if found. Returns the table
65 it finds.
66
67 $t->ms_enc
68 Returns the encoding of the microsoft table (0 => symbol, etc.).
69 Returns undef if there is no Microsoft cmap.
70
71 $t->out($fh)
72 Writes out a cmap table to a filehandle. If it has not been read, then
73 just copies from input file to output
74
75 $t->XML_element($context, $depth, $name, $val)
76 Outputs the elements of the cmap in XML. We only need to process val
77 here
78
79 $t->minsize()
80 Returns the minimum size this table can be in bytes. If it is smaller
81 than this, then the table must be bad and should be deleted or
82 whatever.
83
84 $t->update
85 Tidies the cmap table.
86
87 Removes MS Fmt12 cmap if it is no longer needed.
88
89 Removes from all cmaps any codepoint that map to GID=0. Note that such
90 entries will be re-introduced as necessary depending on the cmap
91 format.
92
93 @map = $t->reverse(%opt)
94 Returns a reverse map of the Unicode cmap. I.e. given a glyph gives the
95 Unicode value for it. Options are:
96
97 tnum
98 Table number to use rather than the default Unicode table
99
100 array
101 Returns each element of reverse as an array since a glyph may be
102 mapped by more than one Unicode value. The arrays are unsorted.
103 Otherwise store any one unicode value for a glyph.
104
105 is_unicode($index)
106 Returns whether the table of a given index is known to be a unicode
107 table (as specified in the specifications)
108
110 ยท Format 14 (Unicode Variation Sequences) cmaps are not supported.
111
113 Martin Hosken <http://scripts.sil.org/FontUtils>.
114
116 Copyright (c) 1998-2016, SIL International (http://www.sil.org)
117
118 This module is released under the terms of the Artistic License 2.0.
119 For details, see the full text of the license in the file LICENSE.
120
121
122
123perl v5.30.1 2020-01-30 Font::TTF::Cmap(3)