lib/ChordPro/lib/SVGPDF/FontManager.pm

filter: Statementstmt 25.3% 40 / 158 Branchbran 0.0% 0 / 98 Conditioncond 0.0% 0 / 60 MC/DCmcdc 0.0% 0 / 31 Subroutinesub 61.1% 11 / 18 Podpod 0.0% 0 / 6 totaltotal 13.7% 51 / 371 CC 79 SCAR 83.5
CC
79
Cov
13%
find_font
5209.9
td
4.0
set_font
2.0
CRAP 4233.4
« lib/ChordPro/lib/SVGPDF/Contrib/PathExtract.pm ↑ Summary lib/ChordPro/Output/PDF/Song.pm »
1 #! perl
2  
3 12 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use Object::Pad;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 12 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 class SVGPDF::FontManager;
8  
9 12 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 12 ▶use List::Util qw( any none uniq );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 12 ▶use Text::ParseWords qw( quotewords );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 0 ▶field $svg :mutator :param;
Subroutine svg: not called CC=1 SCAR=2.6
Pod undocumented
14 0 ▶field $fc :mutator;
Subroutine fc: not called CC=1 SCAR=2.6
Pod undocumented
15 0 ▶field $td :accessor;
Subroutine td: not called CC=2 SCAR=14.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
@_ and $td = shift() 0 0 0
16  
17 # The 14 corefonts.
18 12 my @corefonts =
19 qw( Courier Courier-Bold Courier-BoldOblique Courier-Oblique
20 Helvetica Helvetica-Bold Helvetica-BoldOblique Helvetica-Oblique
21 Symbol
22 Times-Bold Times-BoldItalic Times-Italic Times-Roman
23 ZapfDingbats );
24  
25 # Set a font according to the style.
26 #
27 # Strategy: First see if there was a @font-face defined. If so, use it.
28 # Then dispatch to user callback, if specified.
29 # Otherwise, try builtin fonts.
30  
31 0 ▶method set_font ( $xo, $style ) {
Subroutine set_font: not called CC=1 SCAR=6.9
Pod undocumented
32 0 my ( $font, $size, $src ) = $self->find_font($style);
33 0 $xo->font( $font, $size );
34 12 }
35  
36 0 ▶method find_font ( $style ) {
Subroutine find_font: not called CC=78 SCAR=85.6
Pod undocumented
37  
38 0 ▶ my $stl = lc( $style->{'font-style'} // "normal" );
Condition0%0/2
$style->{"font-style"} // "normal"
l!l
00
MC/DC0%0/1
$style->{"font-style"} // "normal"
$style->{"font-style"}
Truth table0%0/2
A
A= $style->{"font-style"}
Aresult
11
00
39 0 ▶ my $weight = lc( $style->{'font-weight'} // "normal" );
Condition0%0/2
$style->{"font-weight"} // "normal"
l!l
00
MC/DC0%0/1
$style->{"font-weight"} // "normal"
$style->{"font-weight"}
Truth table0%0/2
A
A= $style->{"font-weight"}
Aresult
11
00
40 ####TODO: normalize styles and weights.
41  
42 # Process the font-families, if any.
43 0 ▶ for ( ffsplit( $style->{'font-family'} // [] ) ) {
Condition0%0/2
$style->{"font-family"} // []
l!l
00
MC/DC0%0/1
$style->{"font-family"} // []
$style->{"font-family"}
Truth table0%0/2
A
A= $style->{"font-family"}
Aresult
11
00
44 0 my $family = lc($_);
45  
46 # Check against @font-faces, if any.
47 0 ▶ for ( @{ $style->{'@font-face'}//[] } ) {
Condition0%0/2
$style->{"\@font-face"} // []
l!l
00
MC/DC0%0/1
$style->{"\@font-face"} // []
$style->{"\@font-face"}
Truth table0%0/2
A
A= $style->{"\@font-face"}
Aresult
11
00
48 0 my $fam = $_->{'font-family'};
49 0 ▶ next unless $fam && lc($fam) eq $family;
Branch: 1 branch
BranchTrueFalseTotal
unless $fam and lc $fam eq $family 0 0 0
Condition0%0/3
$fam and lc $fam eq $family
!ll&&!rl&&r
000
MC/DC0%0/2
$fam and lc $fam eq $family
$fam lc $fam eq $family
Truth table0%0/3
A and B
A= $famB= lc $fam eq $family
ABresult
0X0
100
111
50 0 ▶ next unless $_->{src};
Branch: 1 branch
BranchTrueFalseTotal
unless $_->{"src"} 0 0 0
51 next if $_->{'font-style'} && $style->{'font-style'}
52 0 ▶ && $_->{'font-style'} ne $style->{'font-style'};
Branch: 1 branch
BranchTrueFalseTotal
if $_->{"font-style"} and $style->{"font-style"} and $_->{"font-style"} ne $style->{"font-style"} 0 0 0
Condition0%0/6
$_->{"font-style"} and $style->{"font-style"} and $_->{"font-style"} ne $style->{"font-style"}
!ll&&!rl&&r
000
$_->{"font-style"} and $style->{"font-style"}
!ll&&!rl&&r
000
MC/DC0%0/3
$_->{"font-style"} and $style->{"font-style"} and $_->{"font-style"} ne $style->{"font-style"}
$_->{"font-style"} $style->{"font-style"} $_->{"font-style"} ne $style->{"font-style"}
Truth table0%0/4
A and B and C
A= $_->{"font-style"}B= $style->{"font-style"}C= $_->{"font-style"} ne $style->{"font-style"}
ABCresult
0XX0
10X0
1100
1111
53 next if $_->{'font-weight'} && $style->{'font-weight'}
54 0 ▶ && $_->{'font-weight'} ne $style->{'font-weight'};
Branch: 1 branch
BranchTrueFalseTotal
if $_->{"font-weight"} and $style->{"font-weight"} and $_->{"font-weight"} ne $style->{"font-weight"} 0 0 0
Condition0%0/6
$_->{"font-weight"} and $style->{"font-weight"} and $_->{"font-weight"} ne $style->{"font-weight"}
!ll&&!rl&&r
000
$_->{"font-weight"} and $style->{"font-weight"}
!ll&&!rl&&r
000
MC/DC0%0/3
$_->{"font-weight"} and $style->{"font-weight"} and $_->{"font-weight"} ne $style->{"font-weight"}
$_->{"font-weight"} $style->{"font-weight"} $_->{"font-weight"} ne $style->{"font-weight"}
Truth table0%0/4
A and B and C
A= $_->{"font-weight"}B= $style->{"font-weight"}C= $_->{"font-weight"} ne $style->{"font-weight"}
ABCresult
0XX0
10X0
1100
1111
55  
56 0 $fam = lc($fam);
57 0 my $key = join( "|", $fam, $stl, $weight );
58 # Font in cache?
59 0 ▶ if ( my $f = $fc->{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $f = $fc->{$key}) 0 0 0
60 return ( $f->{font},
61 $style->{'font-size'} || 12,
62 0 ▶ $f->{src} );
Condition0%0/2
$style->{'font-size'} || 12
l!l
00
MC/DC0%0/1
$style->{'font-size'} || 12
$style->{'font-size'}
Truth table0%0/2
A
A= $style->{'font-size'}
Aresult
11
00
63 }
64  
65 # Fetch font from source.
66 0 my $src = $_->{src};
67 ####TODO: Multiple sources
68 0 ▶ if ( $src =~ /^\s*url\s*\((["'])((?:data|https?|file):.*?)\1\s*\)/is ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($src =~ /^\s*url\s*\((["'])((?:data|https?|file):.*?)\1\s*\)/isu) { } 0 0 0
elsif ($src =~ m[^\s*url\s*\((["'])data:application/octet-stream;base64,(.*?)\1\s*\)]isu) { } 0 0 0
elsif ($src =~ /^\s*url\s*\((["'])(.*?\.[ot]tf)\1\s*\)/isu) { } 0 0 0
69 12 ▶ use File::LoadLines 1.044;
Subroutine BEGIN: called CC=1 SCAR=0.0
70 0 my $opts = {};
71 0 my $data = File::LoadLines::loadblob( $2, $opts );
72  
73 # To load font data from net and data urls.
74 12 ▶ use File::Temp qw( tempfile tempdir );
Subroutine BEGIN: called CC=1 SCAR=0.0
75 12 ▶ use MIME::Base64 qw( decode_base64 );
Subroutine BEGIN: called CC=1 SCAR=0.0
76 0 ▶ $td //= tempdir( CLEANUP => 1 );
Condition0%0/3
$td //= tempdir("CLEANUP", 1)
l!l&&r!l&&!r
000
MC/DC0%0/2
$td //= tempdir("CLEANUP", 1)
$td tempdir("CLEANUP", 1)
Truth table0%0/3
A //= B
A= $tdB= tempdir("CLEANUP", 1)
ABresult
1X1
011
000
77  
78 0 my $sfx; # suffix for font file name
79 0 ▶ if ( $src =~ /\bformat\((["'])(.*?)\1\)/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($src =~ /\bformat\((["'])(.*?)\1\)/u) { } 0 0 0
elsif ($opts->{'_filesource'} =~ /\.(\w+)$/u) { } 0 0 0
80 0 ▶ $sfx =
Branch: 2 branches
BranchTrueFalseTotal
lc $2 eq 'truetype' ? : 0 0 0
lc $2 eq 'opentype' ? : 0 0 0
81 lc($2) eq "truetype" ? ".ttf" :
82 lc($2) eq "opentype" ? ".otf" :
83 '';
84 }
85 elsif ( $opts->{_filesource} =~ /\.(\w+)$/ ) {
86 0 $sfx = $2;
87 }
88 # No (or unknown) format, skip.
89 0 ▶ next unless $sfx;
Branch: 1 branch
BranchTrueFalseTotal
unless $sfx 0 0 0
90  
91 0 my ($fh,$fn) = tempfile( "${td}SVGXXXX", SUFFIX => $sfx );
92 0 binmode( $fh => ':raw' );
93 0 print $fh $data;
94 0 close($fh);
95 0 my $font = eval { $svg->pdf->font($fn) };
96 0 ▶ croak($@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
97 my $f = $fc->{$key} =
98 { font => $font,
99 0 src => $opts->{_filesource} };
100 #warn("SRC: ", $opts->{_filesource}, "\n");
101 return ( $f->{font},
102 $style->{'font-size'} || 12,
103 0 ▶ $f->{src} );
Condition0%0/2
$style->{'font-size'} || 12
l!l
00
MC/DC0%0/1
$style->{'font-size'} || 12
$style->{'font-size'}
Truth table0%0/2
A
A= $style->{'font-size'}
Aresult
11
00
104 }
105 # Temp.
106 elsif ( $src =~ /^\s*url\s*\((["'])data:application\/octet-stream;base64,(.*?)\1\s*\)/is ) {
107  
108 0 my $data = $2;
109  
110 # To load font data from net and data urls.
111 12 ▶ use File::Temp qw( tempfile tempdir );
Subroutine BEGIN: called CC=1 SCAR=0.0
112 12 ▶ use MIME::Base64 qw( decode_base64 );
Subroutine BEGIN: called CC=1 SCAR=0.0
113 0 ▶ $td //= tempdir( CLEANUP => 1 );
Condition0%0/3
$td //= tempdir("CLEANUP", 1)
l!l&&r!l&&!r
000
MC/DC0%0/2
$td //= tempdir("CLEANUP", 1)
$td tempdir("CLEANUP", 1)
Truth table0%0/3
A //= B
A= $tdB= tempdir("CLEANUP", 1)
ABresult
1X1
011
000
114  
115 0 my $sfx; # suffix for font file name
116 0 ▶ if ( $src =~ /\bformat\((["'])(.*?)\1\)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($src =~ /\bformat\((["'])(.*?)\1\)/u) 0 0 0
117 0 ▶ $sfx =
Branch: 2 branches
BranchTrueFalseTotal
lc $2 eq 'truetype' ? : 0 0 0
lc $2 eq 'opentype' ? : 0 0 0
118 lc($2) eq "truetype" ? ".ttf" :
119 lc($2) eq "opentype" ? ".otf" :
120 '';
121 }
122 # No (or unknown) format, skip.
123 0 ▶ next unless $sfx;
Branch: 1 branch
BranchTrueFalseTotal
unless $sfx 0 0 0
124  
125 0 my ($fh,$fn) = tempfile( "${td}SVGXXXX", SUFFIX => $sfx );
126 0 binmode( $fh => ':raw' );
127 0 print $fh decode_base64($data);
128 0 close($fh);
129 0 my $font = eval { $svg->pdf->font($fn) };
130 0 ▶ croak($@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
131 0 my $f = $fc->{$key} =
132 { font => $font,
133 src => 'data' };
134 return ( $f->{font},
135 $style->{'font-size'} || 12,
136 0 ▶ $f->{src} );
Condition0%0/2
$style->{'font-size'} || 12
l!l
00
MC/DC0%0/1
$style->{'font-size'} || 12
$style->{'font-size'}
Truth table0%0/2
A
A= $style->{'font-size'}
Aresult
11
00
137 }
138 elsif ( $src =~ /^\s*url\s*\((["'])(.*?\.[ot]tf)\1\s*\)/is ) {
139 0 my $fn = $2;
140 0 my $font = eval { $svg->pdf->font($fn) };
141 0 ▶ croak($@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
142 0 my $f = $fc->{$key} =
143 { font => $font,
144 src => $fn };
145 return ( $f->{font},
146 $style->{'font-size'} || 12,
147 0 ▶ $f->{src} );
Condition0%0/2
$style->{'font-size'} || 12
l!l
00
MC/DC0%0/1
$style->{'font-size'} || 12
$style->{'font-size'}
Truth table0%0/2
A
A= $style->{'font-size'}
Aresult
11
00
148 }
149 else {
150 0 croak("\@font-face: Unhandled src \"", substr($src,0,50), "...\"");
151 }
152 }
153 }
154  
155 0 my $key = join( "|", $style->{'font-family'}, $stl, $weight );
156 # Font in cache?
157 0 ▶ if ( my $f = $fc->{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $f = $fc->{$key}) 0 0 0
158 return ( $f->{font},
159 $style->{'font-size'} || 12,
160 0 ▶ $f->{src} );
Condition0%0/2
$style->{'font-size'} || 12
l!l
00
MC/DC0%0/1
$style->{'font-size'} || 12
$style->{'font-size'}
Truth table0%0/2
A
A= $style->{'font-size'}
Aresult
11
00
161 }
162  
163 0 ▶ if ( my $cb = $svg->fc ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $cb = $svg->fc) 0 0 0
164 0 my $font;
165 0 ▶ unless ( ref($cb) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $cb eq "ARRAY") 0 0 0
166 0 $cb = [ $cb ];
167 }
168 # Run callbacks.
169 0 my %args = ( pdf => $svg->pdf, style => $style );
170 0 for ( @$cb ) {
171 0 eval { $font = $_->( $svg, %args ) };
172 0 ▶ croak($@) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
173 0 ▶ last if $font;
Branch: 1 branch
BranchTrueFalseTotal
if $font 0 0 0
174 }
175  
176 0 ▶ if ( $font ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($font) 0 0 0
177 0 my $src = "Callback($key)";
178 0 $fc->{$key} = { font => $font, src => $src };
179 return ( $font,
180 0 ▶ $style->{'font-size'} || 12,
Condition0%0/2
$style->{'font-size'} || 12
l!l
00
MC/DC0%0/1
$style->{'font-size'} || 12
$style->{'font-size'}
Truth table0%0/2
A
A= $style->{'font-size'}
Aresult
11
00
181 $src );
182 }
183 }
184  
185 # No @font-face, no (or failed) callbacks, we're on our own.
186  
187 0 ▶ my $fn = $style->{'font-family'} // "Times-Roman";
Condition0%0/2
$style->{"font-family"} // "Times-Roman"
l!l
00
MC/DC0%0/1
$style->{"font-family"} // "Times-Roman"
$style->{"font-family"}
Truth table0%0/2
A
A= $style->{"font-family"}
Aresult
11
00
188 0 ▶ my $sz = $style->{'font-size'} || 12;
Condition0%0/2
$style->{'font-size'} || 12
l!l
00
MC/DC0%0/1
$style->{'font-size'} || 12
$style->{'font-size'}
Truth table0%0/2
A
A= $style->{'font-size'}
Aresult
11
00
189 my $em = $style->{'font-style'}
190 0 ▶ && $style->{'font-style'} =~ /^(italic|oblique)$/ || '';
Condition0%0/5
$style->{'font-style'} && $style->{'font-style'} =~ /^(italic|oblique)$/u || ''
l!l
00
$style->{"font-style"} and $style->{"font-style"} =~ /^(italic|oblique)$/u
!ll&&!rl&&r
000
MC/DC0%0/2
$style->{'font-style'} && $style->{'font-style'} =~ /^(italic|oblique)$/u || ''
$style->{"font-style"} $style->{"font-style"} =~ /^(italic|oblique)$/u
Truth table0%0/3
A and B
A= $style->{"font-style"}B= $style->{"font-style"} =~ /^(italic|oblique)$/u
ABresult
111
0X0
100
191 my $bd = $style->{'font-weight'}
192 0 ▶ && $style->{'font-weight'} =~ /^(bold|black)$/ || '';
Condition0%0/5
$style->{'font-weight'} && $style->{'font-weight'} =~ /^(bold|black)$/u || ''
l!l
00
$style->{"font-weight"} and $style->{"font-weight"} =~ /^(bold|black)$/u
!ll&&!rl&&r
000
MC/DC0%0/2
$style->{'font-weight'} && $style->{'font-weight'} =~ /^(bold|black)$/u || ''
$style->{"font-weight"} $style->{"font-weight"} =~ /^(bold|black)$/u
Truth table0%0/3
A and B
A= $style->{"font-weight"}B= $style->{"font-weight"} =~ /^(bold|black)$/u
ABresult
111
0X0
100
193  
194 0 for ( ffsplit($fn) ) {
195 0 $fn = lc($_);
196  
197 # helvetica sans sans-serif text,sans-serif
198 0 ▶ if ( $fn =~ /^(sans|helvetica|(?:text,)?sans-serif)$/ ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($fn =~ /^(sans|helvetica|(?:text,)?sans-serif)$/u) { } 0 0 0
elsif ($fn =~ /^(text|courier|mono(?:-?space)?)$/u) { } 0 0 0
elsif ($fn =~ /^(serif|times|(?:text,)?serif)$/u) { } 0 0 0
elsif (&none(sub { $fn eq lc $_; } , @corefonts)) { } 0 0 0
199 0 ▶ $fn = $bd
Branch: 3 branches
BranchTrueFalseTotal
$bd ? : 0 0 0
$em ? : 0 0 0
$em ? : 0 0 0
200 ? $em ? "Helvetica-BoldOblique" : "Helvetica-Bold"
201 : $em ? "Helvetica-Oblique" : "Helvetica";
202 }
203 # courier mono monospace mono-space text
204 elsif ( $fn =~ /^(text|courier|mono(?:-?space)?)$/ ) {
205 0 ▶ $fn = $bd
Branch: 3 branches
BranchTrueFalseTotal
$bd ? : 0 0 0
$em ? : 0 0 0
$em ? : 0 0 0
206 ? $em ? "Courier-BoldOblique" : "Courier-Bold"
207 : $em ? "Courier-Oblique" : "Courier";
208 }
209 # times serif text,serif
210 elsif ( $fn =~ /^(serif|times|(?:text,)?serif)$/ ) {
211 0 ▶ $fn = $bd
Branch: 3 branches
BranchTrueFalseTotal
$bd ? : 0 0 0
$em ? : 0 0 0
$em ? : 0 0 0
212 ? $em ? "Times-BoldItalic" : "Times-Bold"
213 : $em ? "Times-Italic" : "Times-Roman";
214 }
215 # Any of the corefonts, case insensitive.
216 0 ▶ elsif ( none { $fn eq lc($_) } @corefonts ) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
217 0 undef $fn;
218 }
219 0 ▶ last if $fn;
Branch: 1 branch
BranchTrueFalseTotal
if $fn 0 0 0
220 # Retry other families, if any.
221 }
222  
223 0 ▶ unless ( $fn ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($fn) 0 0 0
224 # Nothing found...
225 0 ▶ $fn = $bd
Branch: 3 branches
BranchTrueFalseTotal
$bd ? : 0 0 0
$em ? : 0 0 0
$em ? : 0 0 0
226 ? $em ? "Times-BoldItalic" : "Times-Bold"
227 : $em ? "Times-Italic" : "Times-Roman";
228 }
229  
230 0 ▶ my $font = $fc->{$fn} //= do {
Condition0%0/3
$fc->{$fn} //= do { unless ($fn =~ /\.\w+$/u) { my $t = ""; $t .= 'italic, ' if $em; $t .= 'bold, ' if $bd; $t = ' (' . substr($t, 0, (length($t) - 2)) . ')' if $t; warn("SVG: Font ", $style->{"font-family"} // "<none>", "$t - falling back to built-in font $fn with limited glyphs!\n"); } ; +{"font", $svg->pdf->font($fn), "src", $fn} }
l!l&&r!l&&!r
000
MC/DC0%0/2
$fc->{$fn} //= do { unless ($fn =~ /\.\w+$/u) { my $t = ""; $t .= 'italic, ' if $em; $t .= 'bold, ' if $bd; $t = ' (' . substr($t, 0, (length($t) - 2)) . ')' if $t; warn("SVG: Font ", $style->{"font-family"} // "<none>", "$t - falling back to built-in font $fn with limited glyphs!\n"); } ; +{"font", $svg->pdf->font($fn), "src", $fn} }
$fc->{$fn} do { unless ($fn =~ /\.\w+$/u) { my $t = ""; $t .= 'italic, ' if $em; $t .= 'bold, ' if $bd; $t = ' (' . substr($t, 0, (length($t) - 2)) . ')' if $t; warn("SVG: Font ", $style->{"font-family"} // "<none>", "$t - falling back to built-in font $fn with limited glyphs!\n"); } ; +{"font", $svg->pdf->font($fn), "src", $fn} }
Truth table0%0/3
A //= B
A= $fc->{$fn}B= do { unless ($fn =~ /\.\w+$/u) { my $t = ""; $t .= 'italic, ' if $em; $t .= 'bold, ' if $bd; $t = ' (' . substr($t, 0, (length($t) - 2)) . ')' if $t; warn("SVG: Font ", $style->{"font-family"} // "<none>", "$t - falling back to built-in font $fn with limited glyphs!\n"); } ; +{"font", $svg->pdf->font($fn), "src", $fn} }
ABresult
1X1
011
000
231 0 ▶ unless ( $fn =~ /\.\w+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($fn =~ /\.\w+$/u) 0 0 0
232 0 my $t = "";
233 0 ▶ $t .= "italic, " if $em;
Branch: 1 branch
BranchTrueFalseTotal
if $em 0 0 0
234 0 ▶ $t .= "bold, " if $bd;
Branch: 1 branch
BranchTrueFalseTotal
if $bd 0 0 0
235 0 ▶ $t = " (" . substr($t, 0, length($t)-2) . ")" if $t;
Branch: 1 branch
BranchTrueFalseTotal
if $t 0 0 0
236 0 ▶ warn("SVG: Font ", $style->{'font-family'}//"<none>",
Condition0%0/2
$style->{"font-family"} // "<none>"
l!l
00
MC/DC0%0/1
$style->{"font-family"} // "<none>"
$style->{"font-family"}
Truth table0%0/2
A
A= $style->{"font-family"}
Aresult
11
00
237 "$t - falling back to built-in font $fn with limited glyphs!\n")
238 }
239 0 { font => $svg->pdf->font($fn), src => $fn };
240 };
241 0 return ( $font->{font}, $sz, $font->{src} );
242 12 }
243  
244 0 ▶sub ffsplit ( $family ) {
Subroutine ffsplit: not called CC=1 SCAR=6.9
Pod undocumented
245 # I hope this traps most (ab)uses of quotes and commas.
246 0 $family =~ s/^\s+//;
247 0 $family =~ s/\s+$//;
248 0 map { s/,+$//r } uniq quotewords( qr/(\s+|\s*,\s*)/, 0, $family);
249 }
250  
251  
252 12 1;
« lib/ChordPro/lib/SVGPDF/Contrib/PathExtract.pm ↑ Summary lib/ChordPro/Output/PDF/Song.pm »