1Font::TTF::Name(3) User Contributed Perl Documentation Font::TTF::Name(3)
2
3
4
6 Font::TTF::Name - String table for a TTF font
7
9 Strings are held by number, platform, encoding and language. Strings
10 are accessed as:
11
12 $f->{'name'}{'strings'}[$number][$platform_id][$encoding_id]{$language_id}
13
14 Notice that the language is held in an associative array due to its
15 sparse nature on some platforms such as Microsoft ($pid = 3). Notice
16 also that the array order is different from the stored array order
17 (platform, encoding, language, number) to allow for easy manipulation
18 of strings by number (which is what I guess most people will want to
19 do).
20
21 By default, $Font::TTF::Name::utf8 is set to 1, and strings will be
22 stored as UTF8 wherever possible. The method "is_utf8" can be used to
23 find out if a string in a particular platform and encoding will be
24 returned as UTF8. Unicode strings are always converted if utf8 is
25 requested. Otherwise, strings are stored according to platform:
26
27 You now have to set <$Font::TTF::Name::utf8> to 0 to get the old
28 behaviour.
29
30 Apple Unicode (platform id = 0)
31 Data is stored as network ordered UCS2. There is no encoding id for
32 this platform but there are language ids as per Mac language ids.
33
34 Mac (platform id = 1)
35 Data is stored as 8-bit binary data, leaving the interpretation to
36 the user according to encoding id.
37
38 Unicode (platform id = 2)
39 Currently stored as 16-bit network ordered UCS2. Upon release of
40 Perl 5.005 this will change to utf8 assuming current UCS2 semantics
41 for all encoding ids.
42
43 Windows (platform id = 3)
44 As per Unicode, the data is currently stored as 16-bit network
45 ordered UCS2. Upon release of Perl 5.005 this will change to utf8
46 assuming current UCS2 semantics for all encoding ids.
47
49 strings
50 An array of arrays, etc.
51
53 $t->read
54 Reads all the names into memory
55
56 $t->out($fh)
57 Writes out all the strings
58
59 $t->XML_element($context, $depth, $key, $value)
60 Outputs the string element in nice XML (which is all the table really!)
61
62 $t->XML_end($context, $tag, %attrs)
63 Store strings in the right place
64
65 is_utf8($pid, $eid)
66 Returns whether a string of a given platform and encoding is going to
67 be in UTF8
68
69 find_name($nid)
70 Hunts down a name in all the standard places and returns the string and
71 for an array context the pid, eid & lid as well
72
73 set_name($nid, $str[, $lang[, @cover]])
74 Sets the given name id string to $str for all platforms and encodings
75 that this module can handle. If $lang is set, it is interpretted as a
76 language tag and if the particular language of a string is found to
77 match, then that string is changed, otherwise no change occurs.
78
79 If supplied, @cover should be a list of references to two-element
80 arrays containing pid,eid pairs that should added to the name table if
81 not already present.
82
83 This function does not add any names to the table unless @cover is
84 supplied.
85
86 Font::TTF::Name->match_lang($pid, $lid, $lang)
87 Compares the language associated to the string of given platform and
88 language with the given language tag. If the language matches the tag
89 (i.e. is equal or more defined than the given language tag) returns
90 true. This is calculated by finding whether the associated language tag
91 starts with the given language tag.
92
93 Font::TTF::Name->get_lang($pid, $lid)
94 Returns the language tag associated with a particular platform and
95 language id
96
97 Font::TTF::Name->find_lang($pid, $lang)
98 Looks up the language name and returns a lang id if one exists
99
101 ยท Unicode type strings will be stored in utf8 for all known
102 platforms, once Perl 5.6 has been released and I can find all the
103 mapping tables, etc.
104
106 Martin Hosken Martin_Hosken@sil.org. See Font::TTF::Font for copyright
107 and licensing.
108
109
110
111perl v5.12.0 2008-06-11 Font::TTF::Name(3)