API3/Compat/API2/Resource/CIDFont.pm

filter: Statementstmt 15.5% 27 / 174 Branchbran 0.0% 0 / 64 Conditioncond 0.0% 0 / 66 MC/DCmcdc 0.0% 0 / 38 Subroutinesub 25.7% 9 / 35 Podpod 40.0% 10 / 25 totaltotal 11.4% 46 / 402 CC 61 SCAR 45.2
CC
61
Cov
9%
text_cid_kern
272.0
cidsByStr
182.0
encodeByName
110.0
CRAP 91.6
« API3/Compat/API2/Basic/TTF/Utils.pm ↑ Summary API3/Compat/API2/NamedDestination.pm »
1 #=======================================================================
2 # ____ ____ _____ _ ____ ___ ____
3 # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \
4 # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) |
5 # | __/| |_| | _| _ _ / ___ \| __/| | / __/
6 # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____|
7 #
8 # A Perl Module Chain to faciliate the Creation and Modification
9 # of High-Quality "Portable Document Format (PDF)" Files.
10 #
11 # Copyright 1999-2005 Alfred Reibenschuh <areibens@cpan.org>.
12 #
13 #=======================================================================
14 #
15 # This library is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU Lesser General Public
17 # License as published by the Free Software Foundation; either
18 # version 2 of the License, or (at your option) any later version.
19 #
20 # This library is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # Lesser General Public License for more details.
24 #
25 # You should have received a copy of the GNU Lesser General Public
26 # License along with this library; if not, write to the
27 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 # Boston, MA 02111-1307, USA.
29 #
30 # $Id: CIDFont.pm,v 2.3 2007/03/17 20:38:50 areibens Exp $
31 #
32 #=======================================================================
33 package PDF::API3::Compat::API2::Resource::CIDFont;
34
35 BEGIN
36 1 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
37
38 1 ▶ use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶ use Encode qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
40
41 1 ▶ use PDF::API3::Compat::API2::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 1 ▶ use PDF::API3::Compat::API2::Basic::PDF::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 1 ▶ use PDF::API3::Compat::API2::Resource::BaseFont;
Subroutine BEGIN: called CC=1 SCAR=0.0
44
45 1 ▶ use POSIX;
Subroutine BEGIN: called CC=1 SCAR=0.0
46
47 1 ▶ use vars qw(@ISA $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
48
49 1 @ISA = qw( PDF::API3::Compat::API2::Resource::BaseFont );
50
51 1 ( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.3 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2007/03/17 20:38:50 $
52 }
53
54 1 ▶no warnings qw[ deprecated recursion uninitialized ];
Subroutine BEGIN: called CC=1 SCAR=0.0
55
56 =item $font = PDF::API3::Compat::API2::Resource::CIDFont->new $pdf, $name
57
58 Returns a cid-font object. base class form all CID based fonts.
59
60 =cut
61
62 sub new
63 0 ▶{
Subroutine new: not called CC=5 SCAR=34.0
Pod documented
64 0 my ($class,$pdf,$name,@opts) = @_;
65 0 my %opts=();
66 0 ▶ %opts=@opts if((scalar @opts)%2 == 0);
Branch: 1 branch
BranchTrueFalseTotal
if scalar(@opts) % 2 == 0 0 0 0
67
68 0 ▶ $class = ref $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
69 0 my $self=$class->SUPER::new($pdf,$name);
70 0 ▶ $pdf->new_obj($self) if(defined($pdf) && !$self->is_obj($pdf));
Branch: 1 branch
BranchTrueFalseTotal
if defined $pdf and not $self->is_obj($pdf) 0 0 0
Condition0%0/3
defined $pdf and not $self->is_obj($pdf)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $pdf and not $self->is_obj($pdf)
defined $pdf not $self->is_obj($pdf)
Truth table0%0/3
A and not(B)
A= defined $pdfB= not $self->is_obj($pdf)
ABresult
0X0
100
111
71
72 0 $self->{Type} = PDFName('Font');
73 0 $self->{'Subtype'} = PDFName('Type0');
74 0 $self->{'Encoding'} = PDFName('Identity-H');
75
76 0 my $de=PDFDict();
77 0 $pdf->new_obj($de);
78 0 $self->{'DescendantFonts'} = PDFArray($de);
79
80 0 $de->{'Type'} = PDFName('Font');
81 0 $de->{'CIDSystemInfo'} = PDFDict();
82 0 $de->{'CIDSystemInfo'}->{Registry} = PDFStr('Adobe');
83 0 $de->{'CIDSystemInfo'}->{Ordering} = PDFStr('Identity');
84 0 $de->{'CIDSystemInfo'}->{Supplement} = PDFNum(0);
85 0 $de->{'CIDToGIDMap'} = PDFName('Identity');
86
87 0 $self->{' de'} = $de;
88
89 0 return($self);
90 }
91
92 =item $font = PDF::API3::Compat::API2::Resource::CIDFont->new_api $api, $name, %options
93
94 Returns a cid-font object. This method is different from 'new' that
95 it needs an PDF::API3::Compat::API2-object rather than a Text::PDF::File-object.
96
97 =cut
98
99 sub new_api
100 0 ▶{
Subroutine new_api: not called CC=1 SCAR=6.9
Pod documented
101 0 my ($class,$api,@opts)=@_;
102
103 0 my $obj=$class->new($api->{pdf},@opts);
104 0 $self->{' api'}=$api;
105
106 0 $api->{pdf}->out_obj($api->{pages});
107 0 return($obj);
108 }
109
110 0 ▶sub glyphByCId { return( $_[0]->data->{g2n}->[$_[1]] ); }
Subroutine glyphByCId: not called CC=1 SCAR=6.9
Pod undocumented
111
112 0 ▶sub uniByCId { return( $_[0]->data->{g2u}->[$_[1]] ); }
Subroutine uniByCId: not called CC=1 SCAR=6.9
Pod undocumented
113
114 0 ▶sub cidByUni { return( $_[0]->data->{u2g}->{$_[1]} ); }
Subroutine cidByUni: not called CC=1 SCAR=6.9
Pod undocumented
115
116 0 ▶sub cidByEnc { return( $_[0]->data->{e2g}->[$_[1]] ); }
Subroutine cidByEnc: not called CC=1 SCAR=6.9
Pod undocumented
117
118 sub wxByCId
119 0 ▶{
Subroutine wxByCId: not called CC=5 SCAR=34.0
Pod undocumented
120 0 my $self=shift @_;
121 0 my $g=shift @_;
122 0 my $w;
123
124 0 ▶ if(ref($self->data->{wx}) eq 'ARRAY' && defined $self->data->{wx}->[$g])
Branch: 2 branches
BranchTrueFalseTotal
if (ref $self->data->{'wx'} eq 'ARRAY' and defined $self->data->{'wx'}[$g]) { } 0 0 0
elsif (ref $self->data->{'wx'} eq 'HASH' and defined $self->data->{'wx'}{$g}) { } 0 0 0
Condition0%0/3
ref $self->data->{"wx"} eq "ARRAY" and defined $self->data->{"wx"}[$g]
!ll&&!rl&&r
000
MC/DC0%0/2
ref $self->data->{"wx"} eq "ARRAY" and defined $self->data->{"wx"}[$g]
ref $self->data->{"wx"} eq "ARRAY" defined $self->data->{"wx"}[$g]
Truth table0%0/3
A and B
A= ref $self->data->{"wx"} eq "ARRAY"B= defined $self->data->{"wx"}[$g]
ABresult
0X0
100
111
125 {
126 0 $w = int($self->data->{wx}->[$g]);
127 }
128 ▶ elsif(ref($self->data->{wx}) eq 'HASH' && defined $self->data->{wx}->{$g})
Condition0%0/3
ref $self->data->{"wx"} eq "HASH" and defined $self->data->{"wx"}{$g}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $self->data->{"wx"} eq "HASH" and defined $self->data->{"wx"}{$g}
ref $self->data->{"wx"} eq "HASH" defined $self->data->{"wx"}{$g}
Truth table0%0/3
A and B
A= ref $self->data->{"wx"} eq "HASH"B= defined $self->data->{"wx"}{$g}
ABresult
0X0
100
111
129 {
130 0 $w = int($self->data->{wx}->{$g});
131 }
132 else
133 {
134 0 $w = $self->missingwidth;
135 }
136
137 0 return($w);
138 }
139
140 0 ▶sub wxByUni { return( $_[0]->wxByCId($_[0]->data->{u2g}->{$_[1]}) ); }
Subroutine wxByUni: not called CC=1 SCAR=6.9
Pod documented
141 0 ▶sub wxByEnc { return( $_[0]->wxByCId($_[0]->data->{e2g}->[$_[1]]) ); }
Subroutine wxByEnc: not called CC=1 SCAR=6.9
Pod documented
142
143 sub width
144 0 ▶{
Subroutine width: not called CC=1 SCAR=6.9
Pod documented
145 0 my ($self,$text)=@_;
146 0 return($self->width_cid($self->cidsByStr($text)));
147 }
148
149 sub width_cid
150 0 ▶{
Subroutine width_cid: not called CC=5 SCAR=34.0
Pod undocumented
151 0 my ($self,$text)=@_;
152 0 my $width=0;
153 0 my $lastglyph=0;
154 0 foreach my $n (unpack('n*',$text))
155 {
156 0 $width+=$self->wxByCId($n);
157 0 ▶ if($self->{-dokern} && $self->haveKernPairs())
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"-dokern"} and $self->haveKernPairs) 0 0 0
Condition0%0/3
$self->{"-dokern"} and $self->haveKernPairs
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"-dokern"} and $self->haveKernPairs
$self->{"-dokern"} $self->haveKernPairs
Truth table0%0/3
A and B
A= $self->{"-dokern"}B= $self->haveKernPairs
ABresult
0X0
100
111
158 {
159 0 ▶ if($self->kernPairCid($lastglyph, $n))
Branch: 1 branch
BranchTrueFalseTotal
if ($self->kernPairCid($lastglyph, $n)) 0 0 0
160 {
161 0 $width-=$self->kernPairCid($lastglyph, $n);
162 }
163 }
164 0 $lastglyph=$n;
165 }
166 0 $width/=1000;
167 0 return($width);
168 }
169
170 =item $cidstring = $font->cidsByStr $string
171
172 Returns the cid-string from string based on the fonts encoding map.
173
174 =cut
175
176 sub _cidsByStr
177 0 ▶{
Subroutine _cidsByStr: not called CC=1 SCAR=6.9
178 0 my ($self,$s)=@_;
179 0 $s=pack('n*',map { $self->cidByEnc($_) } unpack('C*',$s));
180 0 return($s);
181 }
182
183 sub cidsByStr
184 0 ▶{
Subroutine cidsByStr: not called CC=13 SCAR=52.0
Pod documented
185 0 my ($self,$text)=@_;
186 0 ▶ if(is_utf8($text) && defined $self->data->{decode} && $self->data->{decode} ne 'ident')
Branch: 4 branches
BranchTrueFalseTotal
if (&is_utf8($text) and defined $self->data->{'decode'} and $self->data->{'decode'} ne 'ident') { } 0 0 0
elsif (&is_utf8($text) and $self->data->{'decode'} eq 'ident') { } 0 0 0
elsif (not &is_utf8($text) and defined $self->data->{'encode'} and $self->data->{'decode'} eq 'ident') { } 0 0 0
elsif (not &is_utf8($text) and UNIVERSAL::can($self, 'issymbol') and $self->issymbol and $self->data->{'decode'} eq 'ident') { } 0 0 0
Condition0%0/6
&is_utf8($text) and defined $self->data->{"decode"} and $self->data->{"decode"} ne "ident"
!ll&&!rl&&r
000
&is_utf8($text) and defined $self->data->{"decode"}
!ll&&!rl&&r
000
MC/DC0%0/3
&is_utf8($text) and defined $self->data->{"decode"} and $self->data->{"decode"} ne "ident"
&is_utf8($text) defined $self->data->{"decode"} $self->data->{"decode"} ne "ident"
Truth table0%0/4
A and B and C
A= &is_utf8($text)B= defined $self->data->{"decode"}C= $self->data->{"decode"} ne "ident"
ABCresult
0XX0
10X0
1100
1111
187 {
188 0 $text=encode($self->data->{decode},$text);
189 }
190 ▶ elsif(is_utf8($text) && $self->data->{decode} eq 'ident')
Condition0%0/3
&is_utf8($text) and $self->data->{"decode"} eq "ident"
!ll&&!rl&&r
000
MC/DC0%0/2
&is_utf8($text) and $self->data->{"decode"} eq "ident"
&is_utf8($text) $self->data->{"decode"} eq "ident"
Truth table0%0/3
A and B
A= &is_utf8($text)B= $self->data->{"decode"} eq "ident"
ABresult
0X0
100
111
191 {
192 0 $text=$self->cidsByUtf($text);
193 }
194 ▶ elsif(!is_utf8($text) && defined $self->data->{encode} && $self->data->{decode} eq 'ident')
Condition0%0/6
not &is_utf8($text) and defined $self->data->{"encode"} and $self->data->{"decode"} eq "ident"
!ll&&!rl&&r
000
not &is_utf8($text) and defined $self->data->{"encode"}
!ll&&!rl&&r
000
MC/DC0%0/3
not &is_utf8($text) and defined $self->data->{"encode"} and $self->data->{"decode"} eq "ident"
not &is_utf8($text) defined $self->data->{"encode"} $self->data->{"decode"} eq "ident"
Truth table0%0/4
not(A) and B and C
A= not &is_utf8($text)B= defined $self->data->{"encode"}C= $self->data->{"decode"} eq "ident"
ABCresult
0XX0
10X0
1100
1111
195 {
196 0 $text=$self->cidsByUtf(decode($self->data->{encode},$text));
197 }
198 ▶ elsif(!is_utf8($text) && UNIVERSAL::can($self,'issymbol') && $self->issymbol && $self->data->{decode} eq 'ident')
Condition0%0/9
not &is_utf8($text) and UNIVERSAL::can($self, "issymbol") and $self->issymbol and $self->data->{"decode"} eq "ident"
!ll&&!rl&&r
000
not &is_utf8($text) and UNIVERSAL::can($self, "issymbol") and $self->issymbol
!ll&&!rl&&r
000
not &is_utf8($text) and UNIVERSAL::can($self, "issymbol")
!ll&&!rl&&r
000
MC/DC0%0/4
not &is_utf8($text) and UNIVERSAL::can($self, "issymbol") and $self->issymbol and $self->data->{"decode"} eq "ident"
not &is_utf8($text) UNIVERSAL::can($self, "issymbol") $self->issymbol $self->data->{"decode"} eq "ident"
Truth table0%0/5
not(A) and B and C and D
A= not &is_utf8($text)B= UNIVERSAL::can($self, "issymbol")C= $self->issymbolD= $self->data->{"decode"} eq "ident"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
199 {
200 0 $text=pack('U*',(map { $_+0xf000 } unpack('C*',$text)));
201 0 $text=$self->cidsByUtf($text);
202 }
203 else
204 {
205 0 $text=$self->_cidsByStr($text);
206 }
207 0 return($text);
208 }
209
210 =item $cidstring = $font->cidsByUtf $utf8string
211
212 Returns the cid-encoded string from utf8-string.
213
214 =cut
215
216 0 ▶sub cidsByUtf {
Subroutine cidsByUtf: not called CC=3 SCAR=24.8
Pod documented
217 0 my ($self,$s)=@_;
218 0 ▶ $s=pack('n*',map { $self->cidByUni($_) } (map { $_>0x7f && $_<0xA0 ? uniByName(nameByUni($_)): $_ } unpack('U*',$s)));
Branch: 1 branch
BranchTrueFalseTotal
$_ > 127 && $_ < 160 ? : 0 0 0
Condition0%0/3
$_ > 127 and $_ < 160
!ll&&!rl&&r
000
MC/DC0%0/2
$_ > 127 and $_ < 160
$_ > 127 $_ < 160
Truth table0%0/3
A and B
A= $_ > 127B= $_ < 160
ABresult
0X0
100
111
219 0 utf8::downgrade($s);
220 0 return($s);
221 }
222
223 sub textByStr
224 0 ▶{
Subroutine textByStr: not called CC=1 SCAR=6.9
Pod documented
225 0 my ($self,$text)=@_;
226 0 return($self->text_cid($self->cidsByStr($text)));
227 }
228
229 sub textByStrKern
230 0 ▶{
Subroutine textByStrKern: not called CC=1 SCAR=6.9
Pod undocumented
231 0 my ($self,$text,$size,$ident)=@_;
232 0 return($self->text_cid_kern($self->cidsByStr($text),$size,$ident));
233 }
234
235 sub text
236 0 ▶{
Subroutine text: not called CC=6 SCAR=37.4
Pod undocumented
237 0 my ($self,$text,$size,$ident)=@_;
238 0 my $newtext=$self->textByStr($text);
239 0 ▶ if(defined $size && $self->{-dokern})
Branch: 2 branches
BranchTrueFalseTotal
if (defined $size and $self->{'-dokern'}) { } 0 0 0
elsif (defined $size) { } 0 0 0
Condition0%0/3
defined $size and $self->{"-dokern"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $size and $self->{"-dokern"}
defined $size $self->{"-dokern"}
Truth table0%0/3
A and B
A= defined $sizeB= $self->{"-dokern"}
ABresult
0X0
100
111
240 {
241 0 $newtext=$self->textByStrKern($text,$size,$ident);
242 0 return($newtext);
243 }
244 elsif(defined $size)
245 {
246 0 ▶ if(defined($ident) && $ident!=0)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ident and $ident != 0) { } 0 0 0
Condition0%0/3
defined $ident and $ident != 0
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ident and $ident != 0
defined $ident $ident != 0
Truth table0%0/3
A and B
A= defined $identB= $ident != 0
ABresult
0X0
100
111
247 {
248 0 return("[ $ident $newtext ] TJ");
249 }
250 else
251 {
252 0 return("$newtext Tj");
253 }
254 }
255 else
256 {
257 0 return($newtext);
258 }
259 }
260
261 sub text_cid
262 0 ▶{
Subroutine text_cid: not called CC=4 SCAR=30.0
Pod undocumented
263 0 my ($self,$text,$size)=@_;
264 0 ▶ if(UNIVERSAL::can($self,'fontfile'))
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($self, "fontfile")) 0 0 0
265 {
266 0 foreach my $g (unpack('n*',$text))
267 {
268 0 $self->fontfile->subsetByCId($g);
269 }
270 }
271 0 my $newtext=unpack('H*',$text);
272 0 ▶ if(defined $size)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $size) { } 0 0 0
273 {
274 0 return("<$newtext> Tj");
275 }
276 else
277 {
278 0 return("<$newtext>");
279 }
280 }
281
282 sub text_cid_kern
283 0 ▶{
Subroutine text_cid_kern: not called CC=16 SCAR=56.1
Pod undocumented
284 0 my ($self,$text,$size,$ident)=@_;
285 0 ▶ if(UNIVERSAL::can($self,'fontfile'))
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($self, "fontfile")) 0 0 0
286 {
287 0 foreach my $g (unpack('n*',$text))
288 {
289 0 $self->fontfile->subsetByCId($g);
290 }
291 }
292 0 ▶ if(defined $size && $self->{-dokern} && $self->haveKernPairs())
Branch: 2 branches
BranchTrueFalseTotal
if (defined $size and $self->{'-dokern'} and $self->haveKernPairs) { } 0 0 0
elsif (defined $size) { } 0 0 0
Condition0%0/6
defined $size and $self->{"-dokern"} and $self->haveKernPairs
!ll&&!rl&&r
000
defined $size and $self->{"-dokern"}
!ll&&!rl&&r
000
MC/DC0%0/3
defined $size and $self->{"-dokern"} and $self->haveKernPairs
defined $size $self->{"-dokern"} $self->haveKernPairs
Truth table0%0/4
A and B and C
A= defined $sizeB= $self->{"-dokern"}C= $self->haveKernPairs
ABCresult
0XX0
10X0
1100
1111
293 {
294 0 my $newtext=' ';
295 0 my $lastglyph=0;
296 0 my $tBefore=0;
297 0 foreach my $n (unpack('n*',$text))
298 {
299 0 ▶ if($self->kernPairCid($lastglyph, $n))
Branch: 1 branch
BranchTrueFalseTotal
if ($self->kernPairCid($lastglyph, $n)) 0 0 0
300 {
301 0 ▶ $newtext.='> ' if($tBefore);
Branch: 1 branch
BranchTrueFalseTotal
if $tBefore 0 0 0
302 0 $newtext.=sprintf('%i ',$self->kernPairCid($lastglyph, $n));
303 0 $tBefore=0;
304 }
305 0 $lastglyph=$n;
306 0 my $t=sprintf('%04X',$n);
307 0 ▶ $newtext.='<' if(!$tBefore);
Branch: 1 branch
BranchTrueFalseTotal
unless $tBefore 0 0 0
308 0 $newtext.=$t;
309 0 $tBefore=1;
310 }
311 0 ▶ $newtext.='> ' if($tBefore);
Branch: 1 branch
BranchTrueFalseTotal
if $tBefore 0 0 0
312 0 ▶ if(defined($ident) && $ident!=0)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ident and $ident != 0) { } 0 0 0
Condition0%0/3
defined $ident and $ident != 0
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ident and $ident != 0
defined $ident $ident != 0
Truth table0%0/3
A and B
A= defined $identB= $ident != 0
ABresult
0X0
100
111
313 {
314 0 return("[ $ident $newtext ] TJ");
315 }
316 else
317 {
318 0 return("[ $newtext ] TJ");
319 }
320 }
321 elsif(defined $size)
322 {
323 0 my $newtext=unpack('H*',$text);
324 0 ▶ if(defined($ident) && $ident!=0)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ident and $ident != 0) { } 0 0 0
Condition0%0/3
defined $ident and $ident != 0
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ident and $ident != 0
defined $ident $ident != 0
Truth table0%0/3
A and B
A= defined $identB= $ident != 0
ABresult
0X0
100
111
325 {
326 0 return("[ $ident <$newtext> ] TJ");
327 }
328 else
329 {
330 0 return("<$newtext> Tj");
331 }
332 }
333 else
334 {
335 0 my $newtext=unpack('H*',$text);
336 0 return("<$newtext>");
337 }
338 }
339
340 sub kernPairCid
341 0 ▶{
Subroutine kernPairCid: not called CC=1 SCAR=6.9
Pod undocumented
342 0 return(0);
343 }
344
345 sub haveKernPairs
346 0 ▶{
Subroutine haveKernPairs: not called CC=1 SCAR=6.9
Pod undocumented
347 0 return(0);
348 }
349
350 sub encodeByName
351 0 ▶{
Subroutine encodeByName: not called CC=10 SCAR=47.0
Pod undocumented
352 0 my ($self,$enc) = @_;
353 0 ▶ return if($self->issymbol);
Branch: 1 branch
BranchTrueFalseTotal
if $self->issymbol 0 0 0
354
355 0 ▶ $self->data->{e2u}=[ map { $_>0x7f && $_<0xA0 ? uniByName(nameByUni($_)): $_ } unpack('U*',decode($enc, pack('C*',0..255))) ] if(defined $enc);
Branch: 2 branches
BranchTrueFalseTotal
if defined $enc 0 0 0
$_ > 127 && $_ < 160 ? : 0 0 0
Condition0%0/3
$_ > 127 and $_ < 160
!ll&&!rl&&r
000
MC/DC0%0/2
$_ > 127 and $_ < 160
$_ > 127 $_ < 160
Truth table0%0/3
A and B
A= $_ > 127B= $_ < 160
ABresult
0X0
100
111
356 0 ▶ $self->data->{e2n}=[ map { $self->data->{g2n}->[$self->data->{u2g}->{$_} || 0] || '.notdef' } @{$self->data->{e2u}} ];
Condition0%0/4
$self->data->{'g2n'}[$self->data->{'u2g'}{$_} or 0] || '.notdef'
l!l
00
$self->data->{'u2g'}{$_} || 0
l!l
00
MC/DC0%0/1
$self->data->{'g2n'}[$self->data->{'u2g'}{$_} or 0] || '.notdef'
$self->data->{'g2n'}[$self->data->{'u2g'}{$_} or 0]
MC/DC0%0/1
$self->data->{'u2g'}{$_} || 0
$self->data->{'u2g'}{$_}
Truth table0%0/2
A
A= $self->data->{'g2n'}[$self->data->{'u2g'}{$_} or 0]
Aresult
11
00
Truth table0%0/2
A
A= $self->data->{'u2g'}{$_}
Aresult
11
00
357 0 ▶ $self->data->{e2g}=[ map { $self->data->{u2g}->{$_} || 0 } @{$self->data->{e2u}} ];
Condition0%0/2
$self->data->{'u2g'}{$_} || 0
l!l
00
MC/DC0%0/1
$self->data->{'u2g'}{$_} || 0
$self->data->{'u2g'}{$_}
Truth table0%0/2
A
A= $self->data->{'u2g'}{$_}
Aresult
11
00
358
359 0 $self->data->{u2e}={};
360 0 foreach my $n (reverse 0..255)
361 {
362 0 ▶ $self->data->{u2e}->{$self->data->{e2u}->[$n]}=$n unless(defined $self->data->{u2e}->{$self->data->{e2u}->[$n]});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->data->{"u2e"}{$self->data->{"e2u"}[$n]} 0 0 0
363 }
364
365 0 return($self);
366 }
367
368 sub subsetByCId
369 0 ▶{
Subroutine subsetByCId: not called CC=1 SCAR=6.9
Pod undocumented
370 0 return(1);
371 }
372
373 sub subvec
374 0 ▶{
Subroutine subvec: not called CC=1 SCAR=6.9
Pod undocumented
375 0 return(1);
376 }
377
378 sub glyphNum
379 0 ▶{
Subroutine glyphNum: not called CC=2 SCAR=17.9
Pod documented
380 0 my $self=shift @_;
381 0 ▶ if(defined $self->data->{glyphs})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->data->{"glyphs"}) 0 0 0
382 {
383 0 return ( $self->data->{glyphs} );
384 }
385 0 return ( scalar @{$self->data->{wx}} );
386 }
387
388 sub outobjdeep
389 0 ▶{
Subroutine outobjdeep: not called CC=2 SCAR=17.9
Pod documented
390 0 my ($self, $fh, $pdf, %opts) = @_;
391
392 0 ▶ return $self->SUPER::outobjdeep($fh, $pdf) if defined $opts{'passthru'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $opts{"passthru"} 0 0 0
393
394 0 $self->SUPER::outobjdeep($fh, $pdf, %opts);
395 }
396
397
398 1 1;
399
400 __END__
« API3/Compat/API2/Basic/TTF/Utils.pm ↑ Summary API3/Compat/API2/NamedDestination.pm »