Font/TTF/Name.pm

filter: Statementstmt 52.7% 126 / 239 Branchbran 34.0% 32 / 94 Conditioncond 21.9% 23 / 105 MC/DCmcdc 7.4% 4 / 54 Subroutinesub 45.0% 9 / 20 Podpod 100% 13 / 13 totaltotal 39.4% 207 / 525 CC 96 SCAR 48.6
CC
96
Cov
41%
set_name
506.0
XML_element
72.0
is_utf8
72.0
CRAP 129.2
« Font/TTF/GSUB.pm ↑ Summary Font/TTF/GPOS.pm »
1 package Font::TTF::Name;
2  
3 =head1 NAME
4  
5 Font::TTF::Name - String table for a TTF font
6  
7 =head1 DESCRIPTION
8  
9 Strings are held by number, platform, encoding and language. Strings are
10 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 sparse
15 nature on some platforms such as Microsoft ($pid = 3). Notice also that the
16 array order is different from the stored array order (platform, encoding,
17 language, number) to allow for easy manipulation of strings by number (which is
18 what I guess most people will want to do).
19  
20 By default, C<$Font::TTF::Name::utf8> is set to 1, and strings will be stored as UTF8 wherever
21 possible. The method C<is_utf8> can be used to find out if a string in a particular
22 platform and encoding will be returned as UTF8. Unicode strings are always
23 converted if utf8 is requested. Otherwise, strings are stored according to platform:
24  
25 You now have to set <$Font::TTF::Name::utf8> to 0 to get the old behaviour.
26  
27 =over 4
28  
29 =item Apple Unicode (platform id = 0)
30  
31 Data is stored as network ordered UCS2. There is no encoding id for this platform
32 but there are language ids as per Mac language ids.
33  
34 =item Mac (platform id = 1)
35  
36 Data is stored as 8-bit binary data, leaving the interpretation to the user
37 according to encoding id.
38  
39 =item Unicode (platform id = 2)
40  
41 Currently stored as 16-bit network ordered UCS2. Upon release of Perl 5.005 this
42 will change to utf8 assuming current UCS2 semantics for all encoding ids.
43  
44 =item Windows (platform id = 3)
45  
46 As per Unicode, the data is currently stored as 16-bit network ordered UCS2. Upon
47 release of Perl 5.005 this will change to utf8 assuming current UCS2 semantics for
48 all encoding ids.
49  
50 =back
51  
52 =head1 INSTANCE VARIABLES
53  
54 =over 4
55  
56 =item strings
57  
58 An array of arrays, etc.
59  
60 =back
61  
62 =head1 METHODS
63  
64 =cut
65  
66 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
67 1 ▶use vars qw(@ISA $VERSION @apple_encs @apple_encodings $utf8 $cp_1252 @cp_1252 %win_langs %langs_win %langs_mac @ms_langids @mac_langs);
Subroutine BEGIN: called CC=1 SCAR=0.0
68 1 ▶use Font::TTF::Table;
Subroutine BEGIN: called CC=1 SCAR=0.0
69 1 ▶use Font::TTF::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
70 1 @ISA = qw(Font::TTF::Table);
71  
72 1 $utf8 = 1;
73  
74 {
75 1 my ($count, $i);
76 1 eval {require Compress::Zlib;};
77 1 ▶ unless ($@)
Branch: 1 branch
BranchTrueFalseTotal
unless ($@) 1 0 1
78 {
79 1 ▶ for ($i = 0; $i <= $#apple_encs; $i++)
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#Font::TTF::Name::apple_encs) 31 1 32
80 {
81 31 ▶ $apple_encodings[0][$i] = [unpack("n*", Compress::Zlib::uncompress(unpack("u", $apple_encs[$i])))]
Branch: 1 branch
BranchTrueFalseTotal
if defined $Font::TTF::Name::apple_encs[$i] 9 22 31
82 if (defined $apple_encs[$i]);
83 31 foreach (0 .. 127)
84 3968 { $apple_encodings[0][$i][$_] = $_; }
85 31 $count = 0;
86 31 $apple_encodings[1][$i] = {map {$_ => $count++} @{$apple_encodings[0][$i]}};
87 }
88 1 $cp_1252[0] = [unpack("n*", Compress::Zlib::uncompress(unpack("u", $cp_1252)))];
89 1 $count = 0;
90 1 $cp_1252[1] = {map({$_ => $count++} @{$cp_1252[0]})};
91 }
92 1 ▶ for ($i = 0; $i < $#ms_langids; $i++)
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $#Font::TTF::Name::ms_langids) 147 1 148
93 {
94 147 ▶ if (defined $ms_langids[$i][1])
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Font::TTF::Name::ms_langids[$i][1]) { } 33 114 147
95 {
96 33 my ($j);
97 33 ▶ for ($j = 0; $j < $#{$ms_langids[$i][1]}; $j++)
Branch: 1 branch
BranchTrueFalseTotal
if ($j < $#{$Font::TTF::Name::ms_langids[$i][1];}) 567 33 600
98 {
99 567 my ($v) = $ms_langids[$i][1][$j];
100 567 ▶ if ($v =~ m/^-/o)
Branch: 1 branch
BranchTrueFalseTotal
if ($v =~ /^-/o) { } 126 441 567
101 126 { $win_langs{(($j + 1) << 10) + $i} = $ms_langids[$i][0] . $v; }
102 else
103 441 { $win_langs{(($j + 1) << 10) + $i} = $v; }
104 }
105 }
106 else
107 114 { $win_langs{$i + 0x400} = $ms_langids[$i][0]; }
108 }
109 1 ▶ %langs_win = map {my ($t) = $win_langs{$_}; my (@res) = ($t => $_); push (@res, $t => $_) if ($t =~ s/-.*$//o && ($_ & 0xFC00) == 0x400); @res} keys %win_langs;
Branch: 1 branch
BranchTrueFalseTotal
if $t =~ s/-.*$//o and ($_ & 64512) == 1024 118 563 681
Condition100%3/3
$t =~ s/-.*$//o and ($_ & 64512) == 1024
!ll&&!rl&&r
458105118
MC/DC100%2/2
$t =~ s/-.*$//o and ($_ & 64512) == 1024
$t =~ s/-.*$//o ($_ & 64512) == 1024
Truth table100%3/3
A and B
A= $t =~ s/-.*$//oB= ($_ & 64512) == 1024
ABresult
0X0
100
111
110 1 $i = 0;
111 1 %langs_mac = map {$_ => $i++} @mac_langs;
112 }
113
114  
115 1 $VERSION = 1.1; # MJPH 17-JUN-2000 Add utf8 support
116 # $VERSION = 1.001; # MJPH 10-AUG-1998 Put $number first in list
117  
118 =head2 $t->read
119  
120 Reads all the names into memory
121  
122 =cut
123  
124 sub read
125 2 ▶{
Subroutine read: called CC=13 SCAR=29.4
Pod documented
126 2 my ($self) = @_;
127 2 ▶ $self->SUPER::read or return $self;
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::read or return $self 2 0 2
128  
129 2 my ($fh) = $self->{' INFILE'};
130 2 my ($dat, $num, $stroff, $i, $pid, $eid, $lid, $nid, $len, $off, $here);
131  
132 2 $fh->read($dat, 6);
133 2 ($num, $stroff) = unpack("x2nn", $dat);
134 2 ▶ for ($i = 0; $i < $num; $i++)
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $num) 122 2 124
135 {
136 1 ▶ use bytes; # hack to fix bugs in 5.8.7
Subroutine BEGIN: called CC=1 SCAR=0.0
137 122 read($fh, $dat, 12);
138 122 ($pid, $eid, $lid, $nid, $len, $off) = unpack("n6", $dat);
139 122 $here = $fh->tell();
140 122 $fh->seek($self->{' OFFSET'} + $stroff + $off, 0);
141 122 $fh->read($dat, $len);
142 122 ▶ if ($utf8)
Branch: 1 branch
BranchTrueFalseTotal
if ($Font::TTF::Name::utf8) 122 0 122
143 {
144 122 ▶ if ($pid == 1 && defined $apple_encodings[0][$eid])
Branch: 3 branches
BranchTrueFalseTotal
if ($pid == 1 and defined $Font::TTF::Name::apple_encodings[0][$eid]) { } 32 90 122
elsif ($pid == 2 and $eid == 2 and @Font::TTF::Name::cp_1252) { } 0 90 90
elsif ($pid == 0 or $pid == 3 or $pid == 2 and $eid == 1) { } 90 0 90
Condition66%2/3
$pid == 1 and defined $Font::TTF::Name::apple_encodings[0][$eid]
!ll&&!rl&&r
90032
MC/DC50%1/2
$pid == 1 and defined $Font::TTF::Name::apple_encodings[0][$eid]
$pid == 1 defined $Font::TTF::Name::apple_encodings[0][$eid]
Truth table66%2/3
A and B
A= $pid == 1B= defined $Font::TTF::Name::apple_encodings[0][$eid]
ABresult
0X0
100
111
145 32 { $dat = TTF_word_utf8(pack("n*", map({$apple_encodings[0][$eid][$_]} unpack("C*", $dat)))); }
146 ▶ elsif ($pid == 2 && $eid == 2 && @cp_1252)
Condition33%2/6
$pid == 2 and $eid == 2 and @Font::TTF::Name::cp_1252
!ll&&!rl&&r
9000
$pid == 2 and $eid == 2
!ll&&!rl&&r
9000
MC/DC0%0/3
$pid == 2 and $eid == 2 and @Font::TTF::Name::cp_1252
$pid == 2 $eid == 2 @Font::TTF::Name::cp_1252
Truth table25%1/4
A and B and C
A= $pid == 2B= $eid == 2C= @Font::TTF::Name::cp_1252
ABCresult
0XX0
10X0
1100
1111
147 0 { $dat = TTF_word_utf8(pack("n*", map({$cp_1252[0][$_]} unpack("C*", $dat)))); }
148 ▶ elsif ($pid == 0 || $pid == 3 || ($pid == 2 && $eid == 1))
Condition22%2/9
$pid == 0 or $pid == 3 or $pid == 2 and $eid == 1
l!l&&r!l&&!r
9000
$pid == 0 or $pid == 3
l!l&&r!l&&!r
0900
$pid == 2 and $eid == 1
!ll&&!rl&&r
000
MC/DC0%0/4
$pid == 0 or $pid == 3 or $pid == 2 and $eid == 1
$pid == 0 $pid == 3 $pid == 2 $eid == 1
Truth table20%1/5
A or B or C and D
A= $pid == 0B= $pid == 3C= $pid == 2D= $eid == 1
ABCDresult
1XXX1
01XX1
00111
000X0
00100
149 90 { $dat = TTF_word_utf8($dat); }
150 }
151 122 $self->{'strings'}[$nid][$pid][$eid]{$lid} = $dat;
152 122 $fh->seek($here, 0);
153 }
154 2 $self;
155 }
156  
157  
158 =head2 $t->out($fh)
159  
160 Writes out all the strings
161  
162 =cut
163  
164 sub out
165 2 ▶{
Subroutine out: called CC=26 SCAR=37.3
Pod documented
166 2 my ($self, $fh) = @_;
167 2 my ($pid, $eid, $lid, $nid, $todo, @todo);
168 2 my ($len, $loc, $stroff, $endloc, $str_trans);
169 2 my (%dedup, @strings, @offsets, $strcount);
170  
171 2 ▶ return $self->SUPER::out($fh) unless $self->{' read'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{" read"} 0 2 2
172  
173 2 $strcount = 0;
174 2 $offsets[0] = 0;
175 2 $loc = $fh->tell();
176 2 $fh->print(pack("n3", 0, 0, 0));
177 2 foreach $nid (0 .. $#{$self->{'strings'}})
178 {
179 4156 foreach $pid (0 .. $#{$self->{'strings'}[$nid]})
180 {
181 364 foreach $eid (0 .. $#{$self->{'strings'}[$nid][$pid]})
182 {
183 212 foreach $lid (sort keys %{$self->{'strings'}[$nid][$pid][$eid]})
184 {
185 122 $str_trans = $self->{'strings'}[$nid][$pid][$eid]{$lid};
186 122 ▶ if ($utf8)
Branch: 1 branch
BranchTrueFalseTotal
if ($Font::TTF::Name::utf8) 122 0 122
187 {
188 122 ▶ if ($pid == 1 && defined $apple_encodings[1][$eid])
Branch: 4 branches
BranchTrueFalseTotal
if ($pid == 1 and defined $Font::TTF::Name::apple_encodings[1][$eid]) { } 32 90 122
elsif ($pid == 2 and $eid == 2 and @Font::TTF::Name::cp_1252) { } 0 90 90
elsif ($pid == 2 and $eid == 0) { } 0 90 90
elsif ($pid == 0 or $pid == 3 or $pid == 2 and $eid == 1) { } 90 0 90
Condition66%2/3
$pid == 1 and defined $Font::TTF::Name::apple_encodings[1][$eid]
!ll&&!rl&&r
90032
MC/DC50%1/2
$pid == 1 and defined $Font::TTF::Name::apple_encodings[1][$eid]
$pid == 1 defined $Font::TTF::Name::apple_encodings[1][$eid]
Truth table66%2/3
A and B
A= $pid == 1B= defined $Font::TTF::Name::apple_encodings[1][$eid]
ABresult
0X0
100
111
189 { $str_trans = pack("C*",
190 32 ▶ map({$apple_encodings[1][$eid]{$_} || 0x3F} unpack("n*",
Condition50%1/2
$Font::TTF::Name::apple_encodings[1][$eid]{$_} || 63
l!l
97860
MC/DC0%0/1
$Font::TTF::Name::apple_encodings[1][$eid]{$_} || 63
$Font::TTF::Name::apple_encodings[1][$eid]{$_}
Truth table50%1/2
A
A= $Font::TTF::Name::apple_encodings[1][$eid]{$_}
Aresult
11
00
191 TTF_utf8_word($str_trans)))); }
192 ▶ elsif ($pid == 2 && $eid == 2 && @cp_1252)
Condition33%2/6
$pid == 2 and $eid == 2 and @Font::TTF::Name::cp_1252
!ll&&!rl&&r
9000
$pid == 2 and $eid == 2
!ll&&!rl&&r
9000
MC/DC0%0/3
$pid == 2 and $eid == 2 and @Font::TTF::Name::cp_1252
$pid == 2 $eid == 2 @Font::TTF::Name::cp_1252
Truth table25%1/4
A and B and C
A= $pid == 2B= $eid == 2C= @Font::TTF::Name::cp_1252
ABCresult
0XX0
10X0
1100
1111
193 { $str_trans = pack("C*",
194 0 ▶ map({$cp_1252[1][$eid]{$_} || 0x3F} unpack("n*",
Condition0%0/2
$Font::TTF::Name::cp_1252[1][$eid]{$_} || 63
l!l
00
MC/DC0%0/1
$Font::TTF::Name::cp_1252[1][$eid]{$_} || 63
$Font::TTF::Name::cp_1252[1][$eid]{$_}
Truth table0%0/2
A
A= $Font::TTF::Name::cp_1252[1][$eid]{$_}
Aresult
11
00
195 TTF_utf8_word($str_trans)))); }
196 ▶ elsif ($pid == 2 && $eid == 0)
Condition33%1/3
$pid == 2 and $eid == 0
!ll&&!rl&&r
9000
MC/DC0%0/2
$pid == 2 and $eid == 0
$pid == 2 $eid == 0
Truth table33%1/3
A and B
A= $pid == 2B= $eid == 0
ABresult
0X0
100
111
197 0 { $str_trans =~ s/[\xc0-\xff][\x80-\xbf]+/?/og; }
198 ▶ elsif ($pid == 0 || $pid == 3 || ($pid == 2 && $eid == 1))
Condition22%2/9
$pid == 0 or $pid == 3 or $pid == 2 and $eid == 1
l!l&&r!l&&!r
9000
$pid == 0 or $pid == 3
l!l&&r!l&&!r
0900
$pid == 2 and $eid == 1
!ll&&!rl&&r
000
MC/DC0%0/4
$pid == 0 or $pid == 3 or $pid == 2 and $eid == 1
$pid == 0 $pid == 3 $pid == 2 $eid == 1
Truth table20%1/5
A or B or C and D
A= $pid == 0B= $pid == 3C= $pid == 2D= $eid == 1
ABCDresult
1XXX1
01XX1
00111
000X0
00100
199 90 { $str_trans = TTF_utf8_word($str_trans); }
200 }
201 122 my ($str_ind);
202 122 ▶ unless (defined $dedup{$str_trans})
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $dedup{$str_trans}) 112 10 122
203 {
204 1 ▶ use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
205 112 $dedup{$str_trans} = $strcount;
206 112 $strings[$strcount] = $str_trans;
207 112 $strcount++;
208 112 $offsets[$strcount] = $offsets[$strcount-1] + bytes::length($str_trans);
209 }
210 122 $str_ind = $dedup{$str_trans};
211 122 push (@todo, [$pid, $eid, $lid, $nid, $str_ind]);
212 }
213 }
214 }
215 }
216  
217 2 ▶ @todo = (sort {$a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] || $a->[2] <=> $b->[2]
Condition66%6/9
$Font::TTF::Name::a->[0] <=> $Font::TTF::Name::b->[0] || $Font::TTF::Name::a->[1] <=> $Font::TTF::Name::b->[1] || $Font::TTF::Name::a->[2] <=> $Font::TTF::Name::b->[2] || $Font::TTF::Name::a->[3] <=> $Font::TTF::Name::b->[3]
l!l&&r!l&&!r
1001880
$Font::TTF::Name::a->[0] <=> $Font::TTF::Name::b->[0] or $Font::TTF::Name::a->[1] <=> $Font::TTF::Name::b->[1] or $Font::TTF::Name::a->[2] <=> $Font::TTF::Name::b->[2]
l!l&&r!l&&!r
1000188
$Font::TTF::Name::a->[0] <=> $Font::TTF::Name::b->[0] or $Font::TTF::Name::a->[1] <=> $Font::TTF::Name::b->[1]
l!l&&r!l&&!r
1000188
MC/DC0%0/4
$Font::TTF::Name::a->[0] <=> $Font::TTF::Name::b->[0] || $Font::TTF::Name::a->[1] <=> $Font::TTF::Name::b->[1] || $Font::TTF::Name::a->[2] <=> $Font::TTF::Name::b->[2] || $Font::TTF::Name::a->[3] <=> $Font::TTF::Name::b->[3]
$Font::TTF::Name::a->[0] <=> $Font::TTF::Name::b->[0] $Font::TTF::Name::a->[1] <=> $Font::TTF::Name::b->[1] $Font::TTF::Name::a->[2] <=> $Font::TTF::Name::b->[2] $Font::TTF::Name::a->[3] <=> $Font::TTF::Name::b->[3]
Truth table40%2/5
A or B or C || D
A= $Font::TTF::Name::a->[0] <=> $Font::TTF::Name::b->[0]B= $Font::TTF::Name::a->[1] <=> $Font::TTF::Name::b->[1]C= $Font::TTF::Name::a->[2] <=> $Font::TTF::Name::b->[2]D= $Font::TTF::Name::a->[3] <=> $Font::TTF::Name::b->[3]
ABCDresult
1XXX1
01XX1
001X1
00011
00000
218 || $a->[3] <=> $b->[3]} @todo);
219 2 foreach $todo (@todo)
220 122 { $fh->print(pack("n6", @{$todo}[0..3], $offsets[$todo->[4]+1] - $offsets[$todo->[4]], $offsets[$todo->[4]])); }
221
222 2 $stroff = $fh->tell() - $loc;
223 2 foreach my $str (@strings)
224 112 { $fh->print($str); }
225  
226 2 $endloc = $fh->tell();
227 2 $fh->seek($loc, 0);
228 2 $fh->print(pack("n3", 0, $#todo + 1, $stroff));
229 2 $fh->seek($endloc, 0);
230 2 $self;
231 }
232  
233  
234 =head2 $t->XML_element($context, $depth, $key, $value)
235  
236 Outputs the string element in nice XML (which is all the table really!)
237  
238 =cut
239  
240 sub XML_element
241 0 ▶{
Subroutine XML_element: not called CC=8 SCAR=42.8
Pod documented
242 0 my ($self) = shift;
243 0 my ($context, $depth, $key, $value) = @_;
244 0 my ($fh) = $context->{'fh'};
245 0 my ($nid, $pid, $eid, $lid);
246  
247 0 ▶ return $self->SUPER::XML_element(@_) unless ($key eq 'strings');
Branch: 1 branch
BranchTrueFalseTotal
unless $key eq "strings" 0 0 0
248  
249 0 foreach $nid (0 .. $#{$self->{'strings'}})
250 {
251 0 ▶ next unless ref($self->{'strings'}[$nid]);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self->{"strings"}[$nid] 0 0 0
252 # $fh->print("$depth<strings id='$nid'>\n");
253 0 foreach $pid (0 .. $#{$self->{'strings'}[$nid]})
254 {
255 0 foreach $eid (0 .. $#{$self->{'strings'}[$nid][$pid]})
256 {
257 0 foreach $lid (sort {$a <=> $b} keys %{$self->{'strings'}[$nid][$pid][$eid]})
258 {
259 0 ▶ my ($lang) = $self->get_lang($pid, $lid) || $lid;
Condition0%0/3
$self->get_lang($pid, $lid) || $lid
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->get_lang($pid, $lid) || $lid
$self->get_lang($pid, $lid) $lid
Truth table0%0/3
A || B
A= $self->get_lang($pid, $lid)B= $lid
ABresult
1X1
011
000
260 $fh->printf("%s<string id='%s' platform='%s' encoding='%s' language='%s'>\n%s%s%s\n%s</string>\n",
261 $depth, $nid, $pid, $eid, $lang, $depth,
262 0 $context->{'indent'}, $self->{'strings'}[$nid][$pid][$eid]{$lid}, $depth);
263 }
264 }
265 }
266 # $fh->print("$depth</strings>\n");
267 }
268 0 $self;
269 }
270  
271  
272 =head2 $t->XML_end($context, $tag, %attrs)
273  
274 Store strings in the right place
275  
276 =cut
277  
278 sub XML_end
279 0 ▶{
Subroutine XML_end: not called CC=3 SCAR=24.8
Pod documented
280 0 my ($self) = shift;
281 0 my ($context, $tag, %attrs) = @_;
282  
283 0 ▶ if ($tag eq 'string')
Branch: 1 branch
BranchTrueFalseTotal
if ($tag eq 'string') { } 0 0 0
284 {
285 0 ▶ my ($lid) = $self->find_name($attrs{'platform'}, $attrs{'language'}) || $attrs{'language'};
Condition0%0/3
$self->find_name($attrs{'platform'}, $attrs{'language'}) || $attrs{'language'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->find_name($attrs{'platform'}, $attrs{'language'}) || $attrs{'language'}
$self->find_name($attrs{'platform'}, $attrs{'language'}) $attrs{'language'}
Truth table0%0/3
A || B
A= $self->find_name($attrs{'platform'}, $attrs{'language'})B= $attrs{'language'}
ABresult
1X1
011
000
286 $self->{'strings'}[$attrs{'id'}][$attrs{'platform'}][$attrs{'encoding'}]{$lid}
287 0 = $context->{'text'};
288 0 return $context;
289 }
290 else
291 0 { return $self->SUPER::XML_end(@_); }
292 }
293  
294 =head2 $t->minsize()
295  
296 Returns the minimum size this table can be. If it is smaller than this, then the table
297 must be bad and should be deleted or whatever.
298  
299 =cut
300  
301 sub minsize
302 0 ▶{
Subroutine minsize: not called CC=1 SCAR=6.9
Pod documented
303 0 return 6;
304 }
305  
306 =head2 is_utf8($pid, $eid)
307  
308 Returns whether a string of a given platform and encoding is going to be in UTF8
309  
310 =cut
311  
312 sub is_utf8
313 0 ▶{
Subroutine is_utf8: not called CC=8 SCAR=42.8
Pod documented
314 0 my ($self, $pid, $eid) = @_;
315  
316 0 ▶ return ($utf8 && ($pid == 0 || $pid == 3 || ($pid == 2 && ($eid != 2 || @cp_1252))
Condition0%0/21
$Font::TTF::Name::utf8 && ($pid == 0 || $pid == 3 || $pid == 2 && ($eid != 2 || @Font::TTF::Name::cp_1252) || $pid == 1 && defined $Font::TTF::Name::apple_encodings[$eid])
!ll&&!rl&&r
000
$pid == 0 or $pid == 3 or $pid == 2 and $eid != 2 || @Font::TTF::Name::cp_1252 or $pid == 1 and defined $Font::TTF::Name::apple_encodings[$eid]
l!l&&r!l&&!r
000
$pid == 0 or $pid == 3 or $pid == 2 and $eid != 2 || @Font::TTF::Name::cp_1252
l!l&&r!l&&!r
000
$pid == 0 or $pid == 3
l!l&&r!l&&!r
000
$pid == 2 and $eid != 2 || @Font::TTF::Name::cp_1252
!ll&&!rl&&r
000
$eid != 2 or @Font::TTF::Name::cp_1252
l!l&&r!l&&!r
000
$pid == 1 and defined $Font::TTF::Name::apple_encodings[$eid]
!ll&&!rl&&r
000
MC/DC0%0/8
$Font::TTF::Name::utf8 && ($pid == 0 || $pid == 3 || $pid == 2 && ($eid != 2 || @Font::TTF::Name::cp_1252) || $pid == 1 && defined $Font::TTF::Name::apple_encodings[$eid])
$Font::TTF::Name::utf8 $pid == 0 $pid == 3 $pid == 2 $eid != 2 @Font::TTF::Name::cp_1252 $pid == 1 defined $Font::TTF::Name::apple_encodings[$eid]
Truth table0%0/11
A && B or C or D and E or F or G and H
A= $Font::TTF::Name::utf8B= $pid == 0C= $pid == 3D= $pid == 2E= $eid != 2F= @Font::TTF::Name::cp_1252G= $pid == 1H= defined $Font::TTF::Name::apple_encodings[$eid]
ABCDEFGHresult
0XXXXXXX0
1000XX0X0
1000XX100
1001000X0
100100100
11XXXXXX1
101XXXXX1
10011XXX1
100101XX1
1000XX111
100100111
317 || ($pid == 1 && defined $apple_encodings[$eid])));
318 }
319  
320  
321 =head2 find_name($nid)
322  
323 Hunts down a name in all the standard places and returns the string and for an
324 array context the pid, eid & lid as well
325  
326 =cut
327  
328 sub find_name
329 0 ▶{
Subroutine find_name: not called CC=7 SCAR=40.3
Pod documented
330 0 my ($self, $nid) = @_;
331 0 my ($res, $pid, $eid, $lid, $look, $k);
332  
333 0 my (@lookup) = ([3, 1, 1033], [3, 1, -1], [3, 0, 1033], [3, 0, -1], [2, 1, -1], [2, 2, -1], [2, 0, -1],
334 [0, 0, 0], [1, 0, 0]);
335 0 foreach $look (@lookup)
336 {
337 0 ($pid, $eid, $lid) = @$look;
338 0 ▶ if ($lid == -1)
Branch: 1 branch
BranchTrueFalseTotal
if ($lid == -1) { } 0 0 0
339 {
340 0 foreach $k (keys %{$self->{'strings'}[$nid][$pid][$eid]})
341 {
342 0 ▶ if (($res = $self->{strings}[$nid][$pid][$eid]{$k}) ne '')
Branch: 1 branch
BranchTrueFalseTotal
if (($res = $self->{"strings"}[$nid][$pid][$eid]{$k}) ne "") 0 0 0
343 {
344 0 $lid = $k;
345 0 last;
346 }
347 }
348 } else
349 0 { $res = $self->{strings}[$nid][$pid][$eid]{$lid} }
350 0 ▶ if ($res ne '')
Branch: 1 branch
BranchTrueFalseTotal
if ($res ne "") 0 0 0
351 0 ▶ { return wantarray ? ($res, $pid, $eid, $lid) : $res; }
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
352 }
353 0 return '';
354 }
355  
356  
357 =head2 remove_name($nid)
358  
359 Removes all strings with the given name id from the table.
360  
361 =cut
362  
363 sub remove_name
364 0 ▶{
Subroutine remove_name: not called CC=1 SCAR=6.9
Pod documented
365 0 my ($self, $nid) = @_;
366  
367 0 delete $self->{'strings'}[$nid];
368 }
369  
370 =head2 set_name($nid, $str[, $lang[, @cover]])
371  
372 Sets the given name id string to $str for all platforms and encodings that
373 this module can handle. If $lang is set, it is interpretted as a language
374 tag and if the particular language of a string is found to match, then
375 that string is changed, otherwise no change occurs.
376  
377 If supplied, @cover should be a list of references to two-element arrays
378 containing pid,eid pairs that should be added to the name table if not already present.
379  
380 This function does not add any names to the table unless @cover is supplied.
381  
382 =cut
383  
384 sub set_name
385 0 ▶{
Subroutine set_name: not called CC=22 SCAR=62.3
Pod documented
386 0 my ($self, $nid, $str, $lang, @cover) = @_;
387 0 my ($pid, $eid, $lid, $c);
388  
389 0 foreach $pid (0 .. $#{$self->{'strings'}[$nid]})
390 {
391 0 my $strNL = $str;
392 0 ▶ $strNL =~ s/(?:\r?)\n/\r\n/og if $pid == 3;
Branch: 1 branch
BranchTrueFalseTotal
if $pid == 3 0 0 0
393 0 ▶ $strNL =~ s/(?:\r?)\n/\r/og if $pid == 1;
Branch: 1 branch
BranchTrueFalseTotal
if $pid == 1 0 0 0
394 0 foreach $eid (0 .. $#{$self->{'strings'}[$nid][$pid]})
395 {
396 0 ▶ if (defined $self->{'strings'}[$nid][$pid][$eid])
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"strings"}[$nid][$pid][$eid]) 0 0 0
397 {
398 0 my ($isincover) = 0;
399 0 foreach $c (@cover)
400 {
401 0 ▶ if ($c->[0] == $pid && $c->[1] == $eid)
Branch: 1 branch
BranchTrueFalseTotal
if ($c->[0] == $pid and $c->[1] == $eid) 0 0 0
Condition0%0/3
$c->[0] == $pid and $c->[1] == $eid
!ll&&!rl&&r
000
MC/DC0%0/2
$c->[0] == $pid and $c->[1] == $eid
$c->[0] == $pid $c->[1] == $eid
Truth table0%0/3
A and B
A= $c->[0] == $pidB= $c->[1] == $eid
ABresult
0X0
100
111
402 {
403 0 $isincover = 1;
404 0 last;
405 }
406 }
407 0 ▶ push(@cover, [$pid, $eid]) if (!$isincover);
Branch: 1 branch
BranchTrueFalseTotal
unless $isincover 0 0 0
408 }
409 0 foreach $lid (keys %{$self->{'strings'}[$nid][$pid][$eid]})
410 {
411 0 ▶ next unless (!defined $lang || $self->match_lang($pid, $lid, $lang));
Branch: 1 branch
BranchTrueFalseTotal
unless not defined $lang or $self->match_lang($pid, $lid, $lang) 0 0 0
Condition0%0/3
not defined $lang or $self->match_lang($pid, $lid, $lang)
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $lang or $self->match_lang($pid, $lid, $lang)
not defined $lang $self->match_lang($pid, $lid, $lang)
Truth table0%0/3
not(A) or B
A= not defined $langB= $self->match_lang($pid, $lid, $lang)
ABresult
1X1
011
000
412 0 $self->{'strings'}[$nid][$pid][$eid]{$lid} = $strNL;
413 0 foreach $c (0 .. $#cover)
414 {
415 0 ▶ next unless (defined $cover[$c] && $cover[$c][0] == $pid && $cover[$c][1] == $eid);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cover[$c] and $cover[$c][0] == $pid and $cover[$c][1] == $eid 0 0 0
Condition0%0/6
defined $cover[$c] and $cover[$c][0] == $pid and $cover[$c][1] == $eid
!ll&&!rl&&r
000
defined $cover[$c] and $cover[$c][0] == $pid
!ll&&!rl&&r
000
MC/DC0%0/3
defined $cover[$c] and $cover[$c][0] == $pid and $cover[$c][1] == $eid
defined $cover[$c] $cover[$c][0] == $pid $cover[$c][1] == $eid
Truth table0%0/4
A and B and C
A= defined $cover[$c]B= $cover[$c][0] == $pidC= $cover[$c][1] == $eid
ABCresult
0XX0
10X0
1100
1111
416 0 delete $cover[$c];
417 0 last;
418 }
419 }
420 }
421 }
422 0 foreach $c (@cover)
423 {
424 0 ▶ next unless (defined $c && scalar @$c);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c and scalar @$c 0 0 0
Condition0%0/2
defined $c and scalar @$c
!ll
00
MC/DC0%0/1
defined $c and scalar @$c
defined $c
Truth table0%0/2
A
A= defined $c
Aresult
00
11
425 0 my ($pid, $eid) = @{$c};
426 0 my ($lid) = $self->find_lang($pid, $lang);
427 0 my $strNL = $str;
428 0 ▶ $strNL =~ s/\n/\r\n/og if $pid == 3;
Branch: 1 branch
BranchTrueFalseTotal
if $pid == 3 0 0 0
429 0 ▶ $strNL =~ s/\n/\r/og if $pid == 1;
Branch: 1 branch
BranchTrueFalseTotal
if $pid == 1 0 0 0
430 0 $self->{'strings'}[$nid][$pid][$eid]{$lid} = $strNL;
431 }
432 0 return $self;
433 }
434  
435 =head2 Font::TTF::Name->match_lang($pid, $lid, $lang)
436  
437 Compares the language associated to the string of given platform and language
438 with the given language tag. If the language matches the tag (i.e. is equal
439 or more defined than the given language tag) returns true. This is calculated
440 by finding whether the associated language tag starts with the given language
441 tag.
442  
443 =cut
444  
445 sub match_lang
446 0 ▶{
Subroutine match_lang: not called CC=5 SCAR=34.0
Pod documented
447 0 my ($self, $pid, $lid, $lang) = @_;
448 0 my ($langid) = $self->get_lang($pid, $lid);
449  
450 0 ▶ return 1 if ($pid == 0); # all languages are equal in unicode since nothing defined
Branch: 1 branch
BranchTrueFalseTotal
if $pid == 0 0 0 0
451 0 ▶ return ($lid == $lang) if ($lang != 0 || $lang eq '0');
Branch: 1 branch
BranchTrueFalseTotal
if $lang != 0 or $lang eq 0 0 0 0
Condition0%0/3
$lang != 0 or $lang eq 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$lang != 0 or $lang eq 0
$lang != 0 $lang eq 0
Truth table0%0/3
A or B
A= $lang != 0B= $lang eq 0
ABresult
1X1
011
000
452 0 ▶ return !index(lc($langid), lc($lang)) || !index(lc($lang), lc($langid));
Condition0%0/3
index(lc $langid, lc $lang) && index(lc $lang, lc $langid)
!ll&&!rl&&r
000
MC/DC0%0/2
index(lc $langid, lc $lang) && index(lc $lang, lc $langid)
index(lc $langid, lc $lang) index(lc $lang, lc $langid)
Truth table0%0/3
A && B
A= index(lc $langid, lc $lang)B= index(lc $lang, lc $langid)
ABresult
0X0
100
111
453 }
454  
455 =head2 Font::TTF::Name->get_lang($pid, $lid)
456  
457 Returns the language tag associated with a particular platform and language id
458  
459 =cut
460  
461 sub get_lang
462 0 ▶{
Subroutine get_lang: not called CC=3 SCAR=24.8
Pod documented
463 0 my ($self, $pid, $lid) = @_;
464  
465 0 ▶ if ($pid == 3)
Branch: 2 branches
BranchTrueFalseTotal
if ($pid == 3) { } 0 0 0
elsif ($pid == 1) { } 0 0 0
466 0 { return $win_langs{$lid}; }
467 elsif ($pid == 1)
468 0 { return $mac_langs[$lid]; }
469 0 return '';
470 }
471  
472  
473 =head2 Font::TTF::Name->find_lang($pid, $lang)
474  
475 Looks up the language name and returns a lang id if one exists
476  
477 =cut
478  
479 sub find_lang
480 0 ▶{
Subroutine find_lang: not called CC=3 SCAR=24.8
Pod documented
481 0 my ($self, $pid, $lang) = @_;
482  
483 0 ▶ if ($pid == 3)
Branch: 2 branches
BranchTrueFalseTotal
if ($pid == 3) { } 0 0 0
elsif ($pid == 1) { } 0 0 0
484 0 { return $langs_win{$lang}; }
485 elsif ($pid == 1)
486 0 { return $langs_mac{$lang}; }
487 0 return undef;
488 }
489  
490 =head2 Font::TTF::Name->pe_list()
491  
492 Returns an array of references to two-element arrays
493 containing pid,eid pairs that already exist in this name table.
494 Useful for creating @cover parameter to set_name().
495  
496 =cut
497  
498 sub pe_list
499 0 ▶{
Subroutine pe_list: not called CC=8 SCAR=42.8
Pod documented
500 0 my ($self) = @_;
501 0 my (@cover, %ids);
502  
503 0 foreach my $nid (0 .. $#{$self->{'strings'}})
504 {
505 0 ▶ if (defined $self->{'strings'}[$nid])
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"strings"}[$nid]) 0 0 0
506 {
507 0 foreach my $pid (0 .. $#{$self->{'strings'}[$nid]})
508 {
509 0 ▶ if (defined $self->{'strings'}[$nid][$pid])
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"strings"}[$nid][$pid]) 0 0 0
510 {
511 0 foreach my $eid (0 .. $#{$self->{'strings'}[$nid][$pid]})
512 {
513 0 ▶ if (defined $self->{'strings'}[$nid][$pid][$eid] && !$ids{$pid}{$eid})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"strings"}[$nid][$pid][$eid] and not $ids{$pid}{$eid}) 0 0 0
Condition0%0/3
defined $self->{"strings"}[$nid][$pid][$eid] and not $ids{$pid}{$eid}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"strings"}[$nid][$pid][$eid] and not $ids{$pid}{$eid}
defined $self->{"strings"}[$nid][$pid][$eid] not $ids{$pid}{$eid}
Truth table0%0/3
A and not(B)
A= defined $self->{"strings"}[$nid][$pid][$eid]B= not $ids{$pid}{$eid}
ABresult
0X0
100
111
514 {
515 0 $ids{$pid}{$eid} = 1;
516 0 push @cover, [$pid, $eid];
517 }
518 }
519 }
520 }
521 }
522 }
523 0 return @cover;
524 }
525  
526  
527 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
528 1 @apple_encs = (
529 <<'EOT',
530 M>)RES==NCW$`@.'G_S5Q*L(!#?+K1VO4:.W6IJA-:\^BM?>L>1&NP(A0Q$BL
531 M<*!62ZV8Z1)[K]BE$MR#O,=/7OW]7T&*6"NMI4K31EOMM)>N@XXZZ2Q#IBZZ
532 MZJ:['GKJ)4NVWOKHJ]\_/\!`@PR68XBAALDUW`@CC3+:&&.-,UZ>?!-,-,ED
533 M4TPUS70SS#3+;`7FF&N>0D7F6V"A119;8JEEEEMAI5566V.M==;;H-A&FVRV
534 MQ5;;_OTONJ3<%;?<5^NQ1YYXYJGG7GKME3?>>N^=#S[ZY(O/OOKNFU]^JO<[
535 M!$?LLMO>$#OAH4-*4F+'[(L+E*F,6SH:%\9%]C@>1W&CN&%2:9QNO]-))5ZH
536 M<]9.!^/DQ/8X-V[@@#,AS0ZE+KB7R$ODA\:A26@>6H2FH9D?J17^)(I#3C@8
537 MLD)V?:(^"BE.AN30,F0XK\(Y5UUVW0TW77/'W;H_;JM6HRJ1&95%M0Y'E5%5
538 .5.U4]""JB<K_`B>`?E$`
539 EOT
540  
541 undef,
542 undef,
543 undef,
544 <<'EOT',
545 M>)RES[=/%```1O$WO8G_@$'J';W70Z2WHS>5WJN%8D6%D;BZ,3*P,;#C2D(8
546 M,9&)08V)+4*(1((X2'(#[.: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U:QA+>M8SP8**&0CF]C,%K:RC2*V
615 M4TP).]C)+G:SA[WLHY3]'.`@ASC,$<K"_,^QWE&?J&_4+^H?)44Q[M,<'_MS
616 M7USAOS[@48]YW')/>-(*3WG:,R%ZSDK/!K[@1<][R2HO6^T5:ZSUJM>\[@UO
617 M6F>]M[SM'>]ZSX90_\"'-MIDLX^">ASPQ*?!M_C,Y[ZP->KE*U_[QK>^\WW(
618 CM/O!ML"=?K3#3[Z,*_AKOR]V^=5O=OO='_ZTQU^_`2-%:*``
619 EOT
620  
621 undef,
622 undef,
623 undef,
624 undef,
625 undef,
626 undef,
627 undef,
628 undef,
629 undef,
630 <<'EOT',
631 M>)REC]=.E&$`1(\%&W@4004%_7:!I?>.Z-+[TJL*=K"`BH`*J,_"+2'A!7PW
632 MX;\2[LG<3#*9G!F2G$V!&'$***2(!,644$H9Y5102175U%!+'?4TT$@3S;30
633 M2AN/:.<Q3Z)^!YUTT4T/O?31SP"###',""E&&6.<"2:98IH99IECG@6>\HSG
634 M+++$"U[RBM>\X2WO6&:%]WS@(Y]898W/?.$KZWQC@TVV^,X/?K+-#KO\XC=_
635 M(OX!?T/"`0<=<MB1$Q?R0KXIDB%NK?TVV&B3S:?RG)`;]?<\YWDO>-$T+WG9
636 M*U[UFNEF>%V]X4TSO666V=[VCG?-,==[WC?/?!_XT&#,N`466F3"8DLLM<QR
637 M*ZRTRFIK(GJ=]?_Y+;;:]N\HI(>LD&W2#COMLML>>^V+=IX\2<7BCCGNA)-.
638 0.>V,L\XY[P*'[!\#D^='L@``
639 EOT
640  
641 undef,
642 undef,
643 undef,
644 undef,
645 undef,
646 undef,
647 undef,
648 undef,
649 undef,
650 );
651  
652 1 $cp_1252 = (
653 <<'EOT',
654 M>)P-SD-B'5```,#YJ6VE>DEM&[\VD]JVF?H./4'-U+93V[9M:SV;$141(Y74
655 MTD@KG?0RR"B3S++(*IOL<L@IE]SRR"N?_`J(55`AA1515!`G7C'%E5!2*:65
656 M458YY550426555%5-=754%,MM=515SWU-=!05".--=%4,\VUT%(KK;715COM
657 M==!1)YTE2-1%5]UTUT-/O?361U_]]#?`0(,,-L10PPPWPDBCC#;&6..,-\%$
658 MDTPVQ5333)=DAIEFF6V.N>:%9-$0&YD?BH22(82XF)10.3(@U(DDB$;F_/]%
659 M0_Y0(!0*A4-\R!5RQ]R*BX\,#'4CB?]];B3)`@LMLM@22RVSW`HKK;):LC76
660 M6F>]#3;:9+,MMMIFNQUVVF6W/?;:9[\##CKDL"-2''7,<2><=,II9YQUSGD7
661 M7'3)95=<=<UU-]QTRVUWW'7/?0\\],AC3SSUS',OO/3*:V^\]<Y['WSTR6=?
662 1?/7-=S_\],MO?_S]!Y==>0@`
663 EOT
664 );
665  
666  
667 1 @ms_langids = ( [""],
668 ['ar', ["-SA", "-IQ", "-EG", "-LY", "-DZ", "-MA", "-TN",
669 "-OM", "-YE", "-SY", "-JO", "-LB", "-KW", "-AE",
670 "-BH", "-QA", "-Ploc-SA", "-145"]],
671 ['bg-BG'],
672 ['ca-ES'],
673 ['zh', ['-TW', '-CN', '-HK', '-SG', '-MO', "", "", "", "", "", "",
674 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
675 "", "", "", "zh", "-Hant"]],
676 ["cs-CZ"],
677 ["da-DK"],
678 ["de", ["-DE", "-CH", "-AT", "-LU", "-LI"]],
679 ["el-GR"],
680 ["en", ["-US", "-UK", "-AU", "-CA", "-NZ", "-IE", "-ZA",
681 "-JM", "029", "-BZ", "-TT", "-ZW", "-PH", "-ID",
682 "-HK", "-IN", "-MY", "-SG", "-AE", "-BH", "-EG",
683 "-JO", "-KW", "-TR", "-YE"]],
684 ["es", ["-ES", "-MX", "-ES", "-GT", "-CR", "-PA", "-DO",
685 "-VE", "-CO", "-PE", "-AR", "-EC", "-CL", "-UY",
686 "-PY", "-BO", "-SV", "-HN", "-NI", "-PR", "-US"]],
687 ["fi-FI"],
688 ["fr", ["-FR", "-BE", "-CA", "-CH", "-LU", "-MC", "",
689 "-RE", "-CG", "-SN", "-CM", "-CI", "-ML", "-MA",
690 "-HT"]],
691 ["he-IL"],
692 ["hu-HU"],
693 ["is-IS"],
694 # 0010
695 ["it", ["-IT", "-CH"]],
696 ["ja-JP"],
697 ["ko-KR"],
698 ["nl", ["-NL", "-BE"]],
699 ["no", ["-bok-NO", "-nyn-NO", "", "", "", "", "", "", "", "", "",
700 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
701 "", "", "", "nn", "nb"]],
702 ["pl-PL"],
703 ["pt", ["-BR", "-PT"]],
704 ["rm-CH"],
705 ["ro", ["-RO", "_MD"]],
706 ["ru-RU"],
707 ["hr", ["-HR", "-Latn-CS", "Cyrl-CS", "-BA", "", "-Latn-BA", "-Cyrl-BA",
708 "", "". "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
709 "bs-Cyrl", "bs-Latn", "sr-Cyrl", "sr-Latn", "", "bs", "sr"]],
710 ["sk-SK"],
711 ["sq-AL"],
712 ["sv", ["-SE", "-FI"]],
713 ["th-TH"],
714 ["tr-TR"],
715 # 0020
716 ["ur", ["-PK", "tr-IN"]],
717 ["id-ID"],
718 ["uk-UA"],
719 ["be-BY"],
720 ["sl-SL"],
721 ["et-EE"],
722 ["lv-LV"],
723 ["lt-LT"],
724 ["tg", ["-Cyrl-TJ", "", "", "", "", "", "", "", "", "", "", "", "",
725 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
726 "", "", "-Cyrl"]],
727 ["fa-IR"],
728 ["vi-VN"],
729 ["hy-AM"],
730 ["az", ["-Latn-AZ", "-Cyrl-AZ", "", "", "", "", "", "", "", "", "",
731 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
732 "", "", "-Cyrl", "-Latn"]],
733 ["eu-ES"],
734 ["wen". ["wen-DE", "dsb-DE", "", "", "", "", "", "", "", "", "", "",
735 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
736 "", "", "", "dsb"]],
737 ["mk-MK"],
738 # 0030
739 ["st"],
740 ["ts"],
741 ["tn-ZA"],
742 ["ven"],
743 ["xh-ZA"],
744 ["zu-ZA"],
745 ["af-ZA"],
746 ["ka-GE"],
747 ["fo-FO"],
748 ["hi-IN"],
749 ["mt"],
750 ["se", ["-NO", "-SE", "-FI", "smj-NO", "smj-SE", "sma-NO", "sma-SE",
751 "", "smn-FI", "", "", "", "", "", "", "", "", "", "", "", "", "",
752 "", "", "", "", "smn", "sms", "smj"]],
753 ["ga-IE"],
754 ["yi"],
755 ["ms", ["-MY", "-BN"]],
756 ["kk-KZ"],
757 # 0040
758 ["ky-KG"],
759 ["sw-KE"],
760 ["tk-TM"],
761 ["uz", ["-Latn-UZ", "-Cyrl-UZ", "", "", "", "", "", "", "", "", "", "",
762 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
763 "", "-Cyrl", "-Latn"]],
764 ["tt-RU"],
765 ["bn", ["-IN", "-BD"]],
766 ["pa", ["-IN", "-Arab-PK", "", "", "", "", "", "", "", "", "", "",
767 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
768 "", "", "", "-Arab"]],
769 ["gu-IN"],
770 ["or-IN"],
771 ["ta-IN"],
772 ["te-IN"],
773 ["kn-IN"],
774 ["ml-IN"],
775 ["as-IN"],
776 ["mr-IN"],
777 ["sa-IN"],
778 # 0050
779 ["mn", ["-Cyrl-MN", "-Mong-CN", "", "", "", "", "", "", "", "", "", "", "",
780 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
781 "-Cyrl", "-Mong"]],
782 ["bo", ["-CN", "-BT"]],
783 ["cy-GB"],
784 ["km-KH"],
785 ["lo-LA"],
786 ["my"],
787 ["gl-ES"],
788 ["kok-IN"],
789 ["mni"],
790 ["sd", ["-IN", "-PK", "", "", "", "", "", "", "", "", "", "", "", "", "",
791 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "-Arab"]],
792 ["syr-SY"],
793 ["si-LK"],
794 ["chr", ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
795 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "-Cher"]],
796 ["iu", ["-Cans-CA", "-Latn-CA", "", "", "", "", "", "", "", "", "", "", "",
797 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
798 "-Cans", "-Latn"]],
799 ["am-ET"],
800 ["tmz", ["-Arab", "-Latn-DZ", "", "", "", "", "", "", "", "", "", "", "",
801 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
802 "", "-Latn"]],
803 # 0060
804 ["ks"],
805 ["ne", ["-NP", "-IN"]],
806 ["fy-NL"],
807 ["ps-AF"],
808 ["fil-PH"],
809 ["dv-MV"],
810 ["bin-NG"],
811 ["fuv", ["-NG", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
812 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "ff-Latn"]],
813 ["ha", ["-Latn-NG", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
814 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "-Latn"]],
815 ["ibb-NG"],
816 ["yo-NG"],
817 ["quz", ["-BO", "-EC", "-PE"]],
818 ["ns-ZA"],
819 ["ba-RU"],
820 ["lb-LU"],
821 ["kl-GL"],
822 # 0070
823 ["ig-NG"],
824 ["kau"],
825 ["om"],
826 ["ti", ["-ET". "-ER"]],
827 ["gn"],
828 ["haw"],
829 ["la"],
830 ["so"],
831 ["ii-CN"],
832 ["pap"],
833 ["arn-CL"],
834 [""], # (unassigned)
835 ["moh-CA"],
836 [""], # (unassigned)
837 ["br-FR"],
838 [""], # (unassigned)
839 # 0080
840 ["ug-CN"],
841 ["mi-NZ"],
842 ["oc-FR"],
843 ["co-FR"],
844 ["gsw-FR"],
845 ["sah-RU"],
846 ["qut-GT"],
847 ["rw-RW"],
848 ["wo-SN"],
849 [""], # (unassigned)
850 [""], # (unassigned)
851 [""], # (unassigned)
852 ["gbz-AF"],
853 [""], # (unassigned)
854 [""], # (unassigned)
855 [""], # (unassigned)
856 # 0090
857 [""], # (unassigned)
858 ["gd-GB"],
859 ["ku", ["-Arab-IQ", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
860 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "-Arab"]],
861 ["quc-CO"],
862 );
863 # 0501 = qps-ploc
864 # 05fe = qps-ploca
865 # 09ff = qps-plocm
866  
867 1 @mac_langs = (
868 'en', 'fr', 'de', 'it', 'nl', 'sv', 'es', 'da', 'pt', 'no',
869 'he', 'ja', 'ar', 'fi', 'el', 'is', 'mt', 'tr', 'hr', 'zh-Hant',
870 'ur', 'hi', 'th', 'ko', 'lt', 'pl', 'hu', 'et', 'lv', 'se',
871 'fo', 'ru' ,'zh-Hans', 'nl', 'ga', 'sq', 'ro', 'cs', 'sk',
872 'sl', 'yi', 'sr', 'mk', 'bg', 'uk', 'be', 'uz', 'kk', 'az-Cyrl',
873 'az-Latn', 'hy', 'ka', 'mo', 'ky', 'abh', 'tuk', 'mn-Mong', 'mn-Cyrl', 'pst',
874 'ku', 'ks', 'sd', 'bo', 'ne', 'sa', 'mr', 'bn', 'as', 'gu',
875 'pa', 'or', 'ml', 'kn', 'ta', 'te', 'si', 'my', 'km', 'lo',
876 'vi', 'id', 'tl', 'ms-Latn', 'ms-Arab', 'am', 'ti', 'tga', 'so', 'sw',
877 'rw', 'rn', 'ny', 'mg', 'eo', '', '', '', '', '',
878 '', '', '', '', '', '', '', '', '', '',
879 '', '', '', '', '', '', '', '', '', '',
880 '', '', '', '', '', '', '', '', 'cy', 'eu',
881 'la', 'qu', 'gn', 'ay', 'tt', 'ug', 'dz', 'jv-Latn', 'su-Latn',
882 'gl', 'af', 'br', 'iu', 'gd', 'gv', 'gd-IR-x-dotabove', 'to', 'el-polyton', 'kl',
883 'az-Latn'
884 );
885  
886 }
887  
888 1 1;
889  
890 =head1 BUGS
891  
892 =over 4
893  
894 =item *
895  
896 Unicode type strings will be stored in utf8 for all known platforms,
897 once Perl 5.6 has been released and I can find all the mapping tables, etc.
898  
899 =back
900  
901 =head1 AUTHOR
902  
903 Martin Hosken L<http://scripts.sil.org/FontUtils>.
904  
905  
906 =head1 LICENSING
907  
908 Copyright (c) 1998-2016, SIL International (http://www.sil.org)
909  
910 This module is released under the terms of the Artistic License 2.0.
911 For details, see the full text of the license in the file LICENSE.
912  
913  
914  
915 =cut
916  
« Font/TTF/GSUB.pm ↑ Summary Font/TTF/GPOS.pm »