Builder/Resource/Font/CoreFont.pm

filter: Statementstmt 74.8% 101 / 135 Branchbran 57.3% 39 / 68 Conditioncond 48.0% 12 / 25 MC/DCmcdc 6.6% 1 / 15 Subroutinesub 93.7% 15 / 16 Podpod 75.0% 3 / 4 totaltotal 65.0% 171 / 263 CC 48 SCAR 40.3
CC
48
Cov
67%
new
113.5
loadallfonts
30.0
_deep_copy
5.6
CRAP 56.3
« Builder/Basic/PDF/Literal.pm ↑ Summary Builder/Resource/Font.pm »
1 package PDF::Builder::Resource::Font::CoreFont;
2  
3 8 ▶use base 'PDF::Builder::Resource::Font';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 8 our $VERSION = '3.028'; # VERSION
9 8 our $LAST_UPDATE = '3.028'; # manually update whenever code is changed
10  
11 8 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 8 ▶use List::Util qw(any);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 8 ▶use PDF::Builder::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 8 ▶use PDF::Builder::Basic::PDF::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 8 our $fonts;
17 8 our $alias;
18 8 our $subs;
19  
20 =head1 NAME
21  
22 PDF::Builder::Resource::Font::CoreFont - Module for using the 14 standard PDF built-in Fonts (plus 15 Windows Fonts)
23  
24 Inherits from L<PDF::Builder::Resource::Font>
25  
26 =head1 SYNOPSIS
27  
28 #
29 use PDF::Builder;
30 #
31 my $pdf = PDF::Builder->new();
32 my $cft = $pdf->font('Times-Roman');
33 #my $cft = $pdf->corefont('Times-Roman');
34 #
35 my $page = $pdf->page();
36 my $text = $page->text();
37 $text->font($cft, 20);
38 $text->translate(200, 700);
39 $text->text("Hello, World!");
40  
41 =head1 METHODS
42  
43 =head2 new
44  
45 $font = PDF::Builder::Resource::Font::CoreFont->new($pdf, $fontname, %options)
46  
47 =over
48  
49 Returns a corefont object.
50  
51 =back
52  
53 =head2 Supported typefaces
54  
55 =head3 Standard PDF types
56  
57 See examples/020_corefonts for a list of each font's glyphs.
58  
59 =over
60  
61 =item * Helvetica, Helvetica-Oblique, Helvetica-Bold, Helvetia-BoldOblique
62  
63 Sans-serif, may have Arial substituted on some systems (e.g., Windows).
64  
65 =item * Courier, Courier-Oblique, Courier-Bold, Courier-BoldOblique
66  
67 Fixed pitch, may have Courier New substituted on some systems (e.g., Windows).
68  
69 =item * Times-Roman, Times-Italic, Times-Bold, Times-BoldItalic
70  
71 Serif, may have Times New Roman substituted on some systems (e.g., Windows).
72  
73 =item * Symbol, ZapfDingbats
74  
75 Various symbols, including the Greek alphabet (in Symbol).
76  
77 =back
78  
79 =head3 Primarily Windows typefaces
80  
81 See examples/022_truefonts /Windows/Fonts/<name>.ttf
82 for a list of each font's glyphs. examples/020_corefonts can also be used.
83  
84 =over
85  
86 =item * Georgia, Georgia-Italic, Georgia-Bold, Georgia-BoldItalic
87  
88 Serif proportional.
89  
90 =item * Trebuchet, Trebuchet-Italic, Trebuchet-Bold, Trebuchet-BoldItalic
91  
92 Sans-serif proportional with simple strokes.
93  
94 =item * Verdana, Verdana-Italic, Verdana-Bold, Verdana-BoldItalic
95  
96 Sans-serif proportional with simple strokes.
97  
98 =item * BankGothic, BankGothic-Italic, BankGothic-Bold, BankGothic-BoldItalic
99  
100 Sans-serif proportional with simple strokes.
101 Free versions of Bank Gothic are often only medium weight Roman (BankGothic),
102 and this is all that usually comes with Windows.
103  
104 =item * Webdings, Wingdings
105  
106 Various symbols, in the vein of Zapf Dingbats.
107  
108 =back
109  
110 Keep in mind that only font metrics (widths) are provided with PDF::Builder;
111 the fonts themselves are provided by the reader's machine (often packaged
112 with the operating system, or obtained separately by the user). To use a
113 specific font may require you to obtain one or more files from some source.
114  
115 If a font (typeface and variant) is not available on a given reader's
116 machine, a substitution I<may> be automatically made. For example, Helvetica is
117 usually not shipped with Windows machines, and Arial might be substituted.
118 For most characters, the glyph widths will be the same, but this can not be
119 guaranteed!
120  
121 PDF::Builder currently uses the [typeface].pm files to map glyph names to
122 code points (single byte encodings only) and to look up the glyph widths for
123 character positioning. There is no guarantee that a given font file includes
124 all the desired glyphs, nor that the widths will be absolutely the same, even
125 in different releases of the same font.
126  
127 =head2 Options
128  
129 =over
130  
131 =item encode
132  
133 Changes the encoding of the font from its default. Notice that the encoding
134 (I<not> the entire font's glyph list) is shown in a PDF object (record), listing
135 256 glyphs associated with this encoding (I<and> that are available in this
136 font).
137  
138 See I<Perl's Encode> for the supported values. B<Warning:> only single byte
139 encodings are permitted. Multibyte encodings such as 'utf8' are forbidden.
140  
141 =item dokern
142  
143 Enables kerning if data is available.
144  
145 C<kerning> is an older name for this option, and is still available as
146 an B<alternative> to C<dokern>.
147  
148 =item pdfname
149  
150 Changes the reference-name of the font from its default.
151 The reference-name is normally generated automatically and can be
152 retrieved via $pdfname=$font->name().
153  
154 =item metrics
155  
156 If given, it is expected to be an anonymous hash of font file data. This is
157 to be used instead of looking up the I<$fontname>.pm file for width and other
158 data. You may need to use this option if your installed font happens to be
159 out of sync with the PDF::Builder built-in core font metrics file (e.g.,
160 I<helveticabold.pm>).
161  
162 =back
163  
164 =cut
165  
166 # PDF standard 14 core fonts
167 8 my @standard_fonts = qw(
168 Courier Courier-Oblique Courier-Bold Courier-BoldOblique
169 Helvetica Helvetica-Oblique Helvetica-Bold Helvetica-BoldOblique
170 Times-Roman Times-Italic Times-Bold Times-BoldItalic
171 Symbol ZapfDingbats
172 );
173  
174 # Windows extension of 15 core fonts
175 8 my @windows_fonts = qw(
176 BankGothic
177 Georgia Georgia-Italic Georgia-Bold Georgia-BoldItalic
178 Trebuchet Trebuchet-Italic Trebuchet-Bold Trebuchet-BoldItalic
179 Verdana Verdana-Italic Verdana-Bold Verdana-BoldItalic
180 Webdings Wingdings
181 );
182  
183 # Windows Fonts with Type1 equivalence
184 8 $alias = {
185 'arial' => 'helvetica',
186 'arialitalic' => 'helveticaoblique',
187 'arialbold' => 'helveticabold',
188 'arialbolditalic' => 'helveticaboldoblique',
189  
190 'times' => 'timesroman',
191 'timesnewromanbolditalic' => 'timesbolditalic',
192 'timesnewromanbold' => 'timesbold',
193 'timesnewromanitalic' => 'timesitalic',
194 'timesnewroman' => 'timesroman',
195  
196 'couriernewbolditalic' => 'courierboldoblique',
197 'couriernewbold' => 'courierbold',
198 'couriernewitalic' => 'courieroblique',
199 'couriernew' => 'courier',
200 };
201  
202 37 ▶sub _look_for_font {
Subroutine _look_for_font: called CC=5 SCAR=16.7
203 37 my $name = shift;
204  
205 ## return %{$fonts->{$name}} if defined $fonts->{$name};
206 37 eval "require PDF::Builder::Resource::Font::CoreFont::$name; "; ## no critic
207 37 ▶ unless($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 37 37
208 37 my $class = "PDF::Builder::Resource::Font::CoreFont::$name";
209 37 my $font = _deep_copy($class->data());
210 37 ▶ $font->{'uni'} ||= [];
Condition50%1/2
$font->{"uni"} ||= []
l!l
037
MC/DC0%0/1
$font->{"uni"} ||= []
$font->{"uni"}
Truth table50%1/2
A
A= $font->{"uni"}
Aresult
11
00
211 37 foreach my $n (0..255) {
212 9472 ▶ unless (defined $fonts->{'uni'}->[$n]) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $PDF::Builder::Resource::Font::CoreFont::fonts->{"uni"}[$n]) 9472 0 9472
213 9472 $font->{'uni'}->[$n] = uniByName($font->{'char'}->[$n]);
214 }
215 }
216 37 return %$font;
217 } else {
218 0 die "requested core font '$name' not installed ";
219 }
220 }
221  
222 #
223 # Deep copy something, thanks to Randal L. Schwartz
224 # Changed to deal w/ CODE refs, in which case it doesn't try to deep copy
225 #
226 128340 ▶sub _deep_copy {
Subroutine _deep_copy: called CC=5 SCAR=17.3
227 128340 my $this = shift;
228  
229 128340 ▶ if (not ref $this) {
Branch: 4 branches
BranchTrueFalseTotal
if (not ref $this) { } 127973 367 128340
elsif (ref $this eq 'ARRAY') { } 258 109 367
elsif (ref $this eq 'HASH') { } 109 0 109
elsif (ref $this eq 'CODE') { } 0 0 0
230 127973 return $this;
231 } elsif (ref($this) eq "ARRAY") {
232 258 return [ map { _deep_copy($_) } @$this]; ## no critic
233 } elsif (ref($this) eq "HASH") {
234 109 return +{ map { $_ => _deep_copy($this->{$_}) } keys %$this };
235 } elsif (ref($this) eq "CODE") {
236 # Can't deep copy code refs
237 0 return $this;
238 } else {
239 0 die "what type is $_? Unable to copy a ".ref($this);
240 }
241 }
242  
243 37 ▶sub new {
Subroutine new: called CC=29 SCAR=47.3
Pod documented
244 37 my ($class, $pdf, $name, @opts) = @_;
245  
246 37 my ($self, $data);
247 37 my %opts = ();
248 37 my $is_standard = is_standard($name);
249  
250 37 ▶ if (-f $name) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $name) 0 37 37
251 0 eval "require '$name'; "; ## no critic
252 0 $name = basename($name,'.pm');
253 }
254 37 my $lookname = lc($name);
255 37 $lookname =~ s/[^a-z0-9]+//gi; # e.g., Times-Roman to timesroman
256 37 ▶ %opts = @opts if (scalar @opts)%2 == 0;
Branch: 1 branch
BranchTrueFalseTotal
if scalar(@opts) % 2 == 0 37 0 37
257 # copy dashed name options to preferred undashed names
258 0 ▶ if (defined $opts{'-encode'} && !defined $opts{'encode'}) { $opts{'encode'} = delete($opts{'-encode'}); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{"-encode"} and not defined $opts{"encode"}) 0 37 37
Condition33%1/3
defined $opts{"-encode"} and not defined $opts{"encode"}
!ll&&!rl&&r
3700
MC/DC0%0/2
defined $opts{"-encode"} and not defined $opts{"encode"}
defined $opts{"-encode"} not defined $opts{"encode"}
Truth table33%1/3
A and not(B)
A= defined $opts{"-encode"}B= not defined $opts{"encode"}
ABresult
0X0
100
111
259 0 ▶ if (defined $opts{'-metrics'} && !defined $opts{'metrics'}) { $opts{'metrics'} = delete($opts{'-metrics'}); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{"-metrics"} and not defined $opts{"metrics"}) 0 37 37
Condition33%1/3
defined $opts{"-metrics"} and not defined $opts{"metrics"}
!ll&&!rl&&r
3700
MC/DC0%0/2
defined $opts{"-metrics"} and not defined $opts{"metrics"}
defined $opts{"-metrics"} not defined $opts{"metrics"}
Truth table33%1/3
A and not(B)
A= defined $opts{"-metrics"}B= not defined $opts{"metrics"}
ABresult
0X0
100
111
260 0 ▶ if (defined $opts{'-dokern'} && !defined $opts{'dokern'}) { $opts{'dokern'} = delete($opts{'-dokern'}); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{"-dokern"} and not defined $opts{"dokern"}) 0 37 37
Condition33%1/3
defined $opts{"-dokern"} and not defined $opts{"dokern"}
!ll&&!rl&&r
3700
MC/DC0%0/2
defined $opts{"-dokern"} and not defined $opts{"dokern"}
defined $opts{"-dokern"} not defined $opts{"dokern"}
Truth table33%1/3
A and not(B)
A= defined $opts{"-dokern"}B= not defined $opts{"dokern"}
ABresult
0X0
100
111
261 0 ▶ if (defined $opts{'-kerning'} && !defined $opts{'kerning'}) { $opts{'kerning'} = delete($opts{'-dokern'}); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{"-kerning"} and not defined $opts{"kerning"}) 0 37 37
Condition33%1/3
defined $opts{"-kerning"} and not defined $opts{"kerning"}
!ll&&!rl&&r
3700
MC/DC0%0/2
defined $opts{"-kerning"} and not defined $opts{"kerning"}
defined $opts{"-kerning"} not defined $opts{"kerning"}
Truth table33%1/3
A and not(B)
A= defined $opts{"-kerning"}B= not defined $opts{"kerning"}
ABresult
0X0
100
111
262 0 ▶ if (defined $opts{'-pdfname'} && !defined $opts{'pdfname'}) { $opts{'pdfname'} = delete($opts{'-pdfname'}); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{"-pdfname"} and not defined $opts{"pdfname"}) 0 37 37
Condition33%1/3
defined $opts{"-pdfname"} and not defined $opts{"pdfname"}
!ll&&!rl&&r
3700
MC/DC0%0/2
defined $opts{"-pdfname"} and not defined $opts{"pdfname"}
defined $opts{"-pdfname"} not defined $opts{"pdfname"}
Truth table33%1/3
A and not(B)
A= defined $opts{"-pdfname"}B= not defined $opts{"pdfname"}
ABresult
0X0
100
111
263  
264 37 ▶ $opts{'encode'} //= 'latin1';
Condition100%2/2
$opts{"encode"} //= "latin1"
l!l
235
MC/DC100%1/1
$opts{"encode"} //= "latin1"
$opts{"encode"}
Truth table100%2/2
A
A= $opts{"encode"}
Aresult
11
00
265 37 ▶ $lookname = $alias->{$lookname} if $alias->{$lookname};
Branch: 1 branch
BranchTrueFalseTotal
if $PDF::Builder::Resource::Font::CoreFont::alias->{$lookname} 0 37 37
266  
267 37 ▶ if (defined $subs->{$lookname}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $PDF::Builder::Resource::Font::CoreFont::subs->{$lookname}) { } 0 37 37
268 0 $data = {_look_for_font($subs->{$lookname}->{'-alias'})};
269 0 foreach my $k (keys %{$subs->{$lookname}}) {
270 0 ▶ next if $k =~ /^\-/;
Branch: 1 branch
BranchTrueFalseTotal
if $k =~ /^\-/ 0 0 0
271 0 $data->{$k} = $subs->{$lookname}->{$k};
272 }
273 } else {
274 37 ▶ unless (defined $opts{'metrics'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opts{'metrics'}) { } 0 37 37
275 37 $data = {_look_for_font($lookname)};
276 } else {
277 0 $data = {%{$opts{'metrics'}}};
278 }
279 }
280  
281 37 ▶ die "Undefined Core Font '$name($lookname)'" unless $data->{'fontname'};
Branch: 1 branch
BranchTrueFalseTotal
unless $data->{"fontname"} 0 37 37
282  
283 # we have data now here so we need to check if
284 # there is a -ttfile or -afmfile/-pfmfile/-pfbfile
285 # and proxy the call to the relevant modules
286 #
287 #if (defined $data->{'-ttfile'} && $data->{'-ttfile'} = _look_for_fontfile($data->{'-ttfile'})) {
288 # return PDF::Builder::Resource::CIDFont::TrueType->new($pdf, $data->{'-ttfile'}, @opts);
289 #} elsif (defined $data->{'-pfbfile'} && $data->{'-pfbfile'} = _look_for_fontfile($data->{'-pfbfile'})) {
290 # $data->{'-afmfile'} = _look_for_fontfile($data->{'-afmfile'});
291 # return PDF::Builder::Resource::Font::Postscript->new($pdf, $data->{'-pfbfile'}, $data->{'-afmfile'}, @opts));
292 #} elsif (defined $data->{'-gfx'}) { # to be written and tested in 'Maki' first!
293 # return PDF::Builder::Resource::Font::gFont->new($pdf, $data, @opts);
294 #}
295  
296 37 ▶ $class = ref($class) if ref($class);
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 37 37
297 # $self = $class->SUPER::new($pdf, $data->{'apiname'}.pdfkey().'~'.time());
298 37 $self = $class->SUPER::new($pdf, $data->{'apiname'}.pdfkey());
299 37 ▶ $pdf->new_obj($self) unless $self->is_obj($pdf);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_obj($pdf) 0 37 37
300 37 $self->{' data'} = $data;
301 37 ▶ $self->{'-dokern'} = 1 if $opts{'dokern'};
Branch: 1 branch
BranchTrueFalseTotal
if $opts{"dokern"} 0 37 37
302  
303 37 $self->{'Subtype'} = PDFName($self->data()->{'type'});
304 37 $self->{'BaseFont'} = PDFName($self->fontname());
305 37 ▶ if ($opts{'pdfname'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"pdfname"}) 0 37 37
306 0 $self->name($opts{'pdfname'});
307 }
308  
309 37 ▶ unless ($self->data()->{'iscore'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->data->{"iscore"}) 0 37 37
310 0 $self->{'FontDescriptor'} = $self->descrByData();
311 }
312  
313 37 ▶ if ($opts{'encode'} =~ m/^utf/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"encode"} =~ /^utf/i) 0 37 37
314 0 die "Invalid multibyte encoding for corefont: $opts{'encode'}\n";
315 # probably more encodings to check
316 }
317 37 $self->encodeByData($opts{'encode'});
318  
319 # The standard non-symbolic fonts use unmodified WinAnsiEncoding.
320 37 ▶ if ($is_standard and not $self->issymbol() and not $opts{'encode'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_standard and not $self->issymbol and not $opts{"encode"}) 0 37 37
Condition66%4/6
$is_standard and not $self->issymbol and not $opts{"encode"}
!ll&&!rl&&r
3340
$is_standard and not $self->issymbol
!ll&&!rl&&r
0334
MC/DC0%0/3
$is_standard and not $self->issymbol and not $opts{"encode"}
$is_standard not $self->issymbol not $opts{"encode"}
Truth table50%2/4
A and not(B) and not(C)
A= $is_standardB= not $self->issymbolC= not $opts{"encode"}
ABCresult
0XX0
10X0
1100
1111
321 0 $self->{'Encoding'} = PDFName('WinAnsiEncoding');
322 0 delete $self->{'FirstChar'};
323 0 delete $self->{'LastChar'};
324 0 delete $self->{'Widths'};
325 }
326  
327 37 return $self;
328 }
329  
330 =head2 is_standard
331  
332 $bool = $class->is_standard($name)
333  
334 $bool = $class->is_standard($name, $win_flag)
335  
336 =over
337  
338 Returns true if C<$name> is an exact, case-sensitive match for one of the
339 standard font names shown above.
340 If C<$win_flag> is given, and is true (1), check against not only the basic
341 14 fonts, but also against the additional 15 Windows core font extensions.
342  
343 =back
344  
345 =cut
346  
347 119 ▶sub is_standard {
Subroutine is_standard: called CC=4 SCAR=13.9
Pod documented
348 # depending on whether it's called as a method or as a local
349 # subroutine, it will or will not have a blessed object as
350 # first argument
351 119 my $self = shift;
352 119 my $name;
353 119 ▶ if ($self =~ /^PDF::Builder/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self =~ /^PDF::Builder/) { } 82 37 119
354 82 $name = shift;
355 } else {
356 37 $name = $self;
357 }
358 119 my $win_flag = 0;
359 119 ▶ if (@_) { $win_flag = $_[0]; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 31 88 119
360  
361 119 ▶ if ($win_flag) {
Branch: 1 branch
BranchTrueFalseTotal
if ($win_flag) { } 29 90 119
362 29 ▶ return any { $_ eq $name } (@standard_fonts, @windows_fonts);
Subroutine __ANON__: called CC=1 SCAR=0.0
363 } else {
364 90 ▶ return any { $_ eq $name } @standard_fonts;
Subroutine __ANON__: called CC=1 SCAR=0.0
365 }
366 }
367  
368 =head2 names
369  
370 my @font_names = PDF::Builder::Resource::Font::CoreFont->names($flag);
371  
372 my $array_ref = PDF::Builder::Resource::Font::CoreFont->names($flag);
373  
374 Returns an array or a reference to an array containing the names of the built-in
375 core (standard) fonts.
376  
377 If called with an optional C<$flag> of "true" value (1),
378 the additional 15 Windows core fonts are included.
379  
380 =cut
381  
382 6 ▶sub names {
Subroutine names: called CC=5 SCAR=16.1
Pod documented
383 6 my $self = shift;
384 # need to revise if ever called as direct subroutine in CoreFont.pm
385 6 my $Win_ext = 0;
386 6 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 4 2 6
387 4 $Win_ext = $_[0];
388 }
389
390 6 ▶ if ($Win_ext) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Win_ext) { } 3 3 6
391 3 ▶ return wantarray() ? (@standard_fonts,@windows_fonts) :
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 1 3
392 [(@standard_fonts,@windows_fonts)];
393 } else {
394 3 ▶ return wantarray() ? @standard_fonts : [@standard_fonts];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 1 3
395 }
396 }
397  
398 # removed from PDF::API2
399 =head2 loadallfonts
400  
401 PDF::Builder::Resource::Font::CoreFont->loadallfonts($flag)
402  
403 =over
404  
405 "Requires in" all fonts available as corefonts, including Windows extensions
406 if the optional C<$flag> is given and is "true" (1).
407  
408 B<Warning:> "dies" if any requested font is not found!
409  
410 =back
411  
412 =cut
413  
414 0 ▶sub loadallfonts {
Subroutine loadallfonts: not called CC=5 SCAR=34.0
Pod undocumented
415 0 my $self = shift;
416 # need to revise if ever called as local sub in CoreFont.pm
417 0 my $Win_ext = 0;
418 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
419 0 $Win_ext = $_[0];
420 }
421  
422 0 foreach my $f (@standard_fonts) {
423 0 _look_for_font($f);
424 }
425 0 ▶ if ($Win_ext) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Win_ext) 0 0 0
426 0 foreach my $f (@windows_fonts) {
427 0 _look_for_font($f);
428 }
429 }
430 0 return;
431 }
432  
433 # not yet supported
434 # andalemono
435 # arialrounded
436 # impact
437 # ozhandicraft
438  
439 BEGIN
440 8 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
441  
442 # substitutes via synfont() for missing BankGothic variants
443 8 $subs = {
444 'bankgothicbold' => {
445 'apiname' => 'Bg2',
446 '-alias' => 'bankgothic',
447 'fontname' => 'BankGothicMediumBT,Bold',
448 'flags' => 32+262144,
449 },
450 'bankgothicbolditalic' => {
451 'apiname' => 'Bg3',
452 '-alias' => 'bankgothic',
453 'fontname' => 'BankGothicMediumBT,BoldItalic',
454 'italicangle' => -15,
455 'flags' => 96+262144,
456 },
457 'bankgothicitalic' => {
458 'apiname' => 'Bg4',
459 '-alias' => 'bankgothic',
460 'fontname' => 'BankGothicMediumBT,Italic',
461 'italicangle' => -15,
462 'flags' => 96,
463 },
464 # 'impactitalic' => {
465 # 'apiname' => 'Imp2',
466 # '-alias' => 'impact',
467 # 'fontname' => 'Impact,Italic',
468 # 'italicangle' => -12,
469 # },
470 # 'ozhandicraftbold' => {
471 # 'apiname' => 'Oz2',
472 # '-alias' => 'ozhandicraft',
473 # 'fontname' => 'OzHandicraftBT,Bold',
474 # 'italicangle' => 0,
475 # 'flags' => 32+262144,
476 # },
477 # 'ozhandicraftitalic' => {
478 # 'apiname' => 'Oz3',
479 # '-alias' => 'ozhandicraft',
480 # 'fontname' => 'OzHandicraftBT,Italic',
481 # 'italicangle' => -15,
482 # 'flags' => 96,
483 # },
484 # 'ozhandicraftbolditalic' => {
485 # 'apiname' => 'Oz4',
486 # '-alias' => 'ozhandicraft',
487 # 'fontname' => 'OzHandicraftBT,BoldItalic',
488 # 'italicangle' => -15,
489 # 'flags' => 96+262144,
490 # },
491 # 'arialroundeditalic' => {
492 # 'apiname' => 'ArRo2',
493 # '-alias' => 'arialrounded',
494 # 'fontname' => 'ArialRoundedMTBold,Italic',
495 # 'italicangle' => -15,
496 # 'flags' => 96+262144,
497 # },
498 # 'arialitalic' => {
499 # 'apiname' => 'Ar2',
500 # '-alias' => 'arial',
501 # 'fontname' => 'Arial,Italic',
502 # 'italicangle' => -15,
503 # 'flags' => 96,
504 # },
505 # 'arialbolditalic' => {
506 # 'apiname' => 'Ar3',
507 # '-alias' => 'arial',
508 # 'fontname' => 'Arial,BoldItalic',
509 # 'italicangle' => -15,
510 # 'flags' => 96+262144,
511 # },
512 # 'arialbold' => {
513 # 'apiname' => 'Ar4',
514 # '-alias' => 'arial',
515 # 'fontname' => 'Arial,Bold',
516 # 'flags' => 32+262144,
517 # },
518 };
519  
520 8 $fonts = { };
521  
522 }
523  
524 8 1;
525  
526 __END__
« Builder/Basic/PDF/Literal.pm ↑ Summary Builder/Resource/Font.pm »