1Font::TTF::Name(3)    User Contributed Perl Documentation   Font::TTF::Name(3)
2
3
4

NAME

6       Font::TTF::Name - String table for a TTF font
7

DESCRIPTION

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

INSTANCE VARIABLES

49       strings
50           An array of arrays, etc.
51

METHODS

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   $t->minsize()
66       Returns the minimum size this table can be. If it is smaller than this,
67       then the table must be bad and should be deleted or whatever.
68
69   is_utf8($pid, $eid)
70       Returns whether a string of a given platform and encoding is going to
71       be in UTF8
72
73   find_name($nid)
74       Hunts down a name in all the standard places and returns the string and
75       for an array context the pid, eid & lid as well
76
77   remove_name($nid)
78       Removes all strings with the given name id from the table.
79
80   set_name($nid, $str[, $lang[, @cover]])
81       Sets the given name id string to $str for all platforms and encodings
82       that this module can handle. If $lang is set, it is interpretted as a
83       language tag and if the particular language of a string is found to
84       match, then that string is changed, otherwise no change occurs.
85
86       If supplied, @cover should be a list of references to two-element
87       arrays containing pid,eid pairs that should be added to the name table
88       if not already present.
89
90       This function does not add any names to the table unless @cover is
91       supplied.
92
93   Font::TTF::Name->match_lang($pid, $lid, $lang)
94       Compares the language associated to the string of given platform and
95       language with the given language tag. If the language matches the tag
96       (i.e. is equal or more defined than the given language tag) returns
97       true. This is calculated by finding whether the associated language tag
98       starts with the given language tag.
99
100   Font::TTF::Name->get_lang($pid, $lid)
101       Returns the language tag associated with a particular platform and
102       language id
103
104   Font::TTF::Name->find_lang($pid, $lang)
105       Looks up the language name and returns a lang id if one exists
106
107   Font::TTF::Name->pe_list()
108       Returns an array of references to two-element arrays containing pid,eid
109       pairs that already exist in this name table.  Useful for creating
110       @cover parameter to set_name().
111

BUGS

113       ยท   Unicode type strings will be stored in utf8 for all known
114           platforms, once Perl 5.6 has been released and I can find all the
115           mapping tables, etc.
116

AUTHOR

118       Martin Hosken <http://scripts.sil.org/FontUtils>.
119

LICENSING

121       Copyright (c) 1998-2016, SIL International (http://www.sil.org)
122
123       This module is released under the terms of the Artistic License 2.0.
124       For details, see the full text of the license in the file LICENSE.
125
126
127
128perl v5.28.0                      2016-08-03                Font::TTF::Name(3)
Impressum