| 1 | #! perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 12 | ▶ | use v5.26; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | package main; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 12 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 12 | our $config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 12 | our $options; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | package ChordPro::Output::PDF::Song; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 12 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 12 | ▶ | use Ref::Util qw(is_hashref is_arrayref is_coderef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 12 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 12 | ▶ | use feature 'state'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 12 | ▶ | use ChordPro::Output::Common qw( roman fmt_subst ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 12 | ▶ | use feature 'signatures'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 12 | ▶ | no warnings qw( experimental::signatures ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 12 | ▶ | use ChordPro::Files; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 12 | ▶ | use ChordPro::Paths; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 12 | ▶ | use ChordPro::Utils; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 12 | ▶ | use ChordPro::Assets; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | #my $ps; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 12 | ▶ | use Text::Layout; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 12 | my $source; # song source | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 12 | my $structured = 0; # structured data | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 12 | my $suppress_empty_chordsline = 0; # suppress chords line when empty | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 12 | my $suppress_empty_lyricsline = 0; # suppress lyrics line when blank | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 12 | my $lyrics_only = 0; # suppress all chord lines | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 12 | my $inlinechords = 0; # chords inline | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 12 | my $inlineannots; # format for inline annots | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 12 | my $chordsunder = 0; # chords under the lyrics | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 12 | my $chordscol = 0; # chords in a separate column | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 12 | my $chordscapo = 0; # capo in a separate column | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 12 | my $propitems_re = propitems_re(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # Page classes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 12 | my @classes = qw( first title default filler ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 12 | my $i_tag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 222 | ▶ | sub pr_label_maybe { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pr_label_maybe: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 222 | my ( $ps, $x, $y ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 222 | ▶ | my $tag = $i_tag // ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$i_tag // ""
MC/DC0%0/1
$i_tag // ""
$i_tag
Truth table50%1/2
A
A= $i_tag
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 222 | $i_tag = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 222 | ▶ | prlabel( $ps, $tag, $x, $y ) if $tag ne ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | my $assets; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | sub assets { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
assets: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | my ( $id ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $assets->{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # Images that go on all pages. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 12 | my @allpages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 12 | ▶ | use constant SIZE_ITEMS => [ qw( chord text chorus tab grid diagram | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 12 | toc title footer label ) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 80 | ▶ | sub generate_song { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_song: called CC=188 SCAR=90.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 80 | my ( $s, $opts ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | warn("Generate song \"", $s->{title}, "\", ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | "page ", $opts->{page_num}, " (", $opts->{page_idx}, ")\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 80 | ▶ | if $config->{debug}->{pages} & 0x01; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 80 | my $pr = $opts->{pr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 80 | my $pagectrl = $opts->{pagectrl}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 80 | ▶ | if ( $pr->{layout}->can("register_element") ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | $pr->{layout}->register_element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 80 | ( TextLayoutImageElement->new( pdf => $pr->{pdf} ), "img" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | $pr->{layout}->register_element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 80 | ( TextLayoutSymbolElement->new( pdf => $pr->{pdf} ), "sym" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 80 | ▶ | unless ( $s->{body} ) { # empty song, or embedded | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | return unless $s->{source}->{embedding}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | return unless $s->{source}->{embedding} eq "pdf"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my $p = $pr->importfile($s->{source}->{file}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $s->{meta}->{pages} = $p->{pages}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # Copy the title of the embedded document, provided there | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # was no override. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | if ( $s->{meta}->{title}->[0] eq $s->{source}->{file} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$s->{"meta"}{"title"}[0] eq $s->{"source"}{"file"} and $p->{"Title"}
MC/DC0%0/2
$s->{"meta"}{"title"}[0] eq $s->{"source"}{"file"} and $p->{"Title"}
$s->{"meta"}{"title"}[0] eq $s->{"source"}{"file"}
$p->{"Title"}
Truth table0%0/3
A and B
A= $s->{"meta"}{"title"}[0] eq $s->{"source"}{"file"}B= $p->{"Title"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | and $p->{Title} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $s->{meta}->{title} = [ $s->{title} = $p->{Title} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | return $s->{meta}->{pages}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 80 | ▶ | local $config = dclone( $s->{config} // $config ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$s->{"config"} // $main::config
MC/DC0%0/2
$s->{"config"} // $main::config
$s->{"config"}
$main::config
Truth table33%1/3
A // B
A= $s->{"config"}B= $main::config
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 80 | ▶ | while ( my($k,$v) = each( %{$config->{markup}->{shortcodes}}) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | unless ( $pr->{layout}->can("register_shortcode") ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | warn("Cannot register shortcodes, upgrade Text::Layout module\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $pr->{layout}->register_shortcode( $k, $v ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 80 | $source = $s->{source}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 80 | $suppress_empty_chordsline = $::config->{settings}->{'suppress-empty-chords'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 80 | $suppress_empty_lyricsline = $::config->{settings}->{'suppress-empty-lyrics'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 80 | $inlinechords = $::config->{settings}->{'inline-chords'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 80 | $inlineannots = $::config->{settings}->{'inline-annotations'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 80 | $chordsunder = $::config->{settings}->{'chords-under'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 80 | my $ps = $::config->clone->{pdf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 80 | $ps->{pr} = $pr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 80 | $pr->{ps} = $ps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 80 | $ps->{_s} = $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 80 | $pr->{_df} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # warn("X1: ", $ps->{fonts}->{$_}->{size}, "\n") for "text"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 80 | $pr->init_fonts(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 80 | my $fonts = $ps->{fonts}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 80 | $pr->{_df}->{$_} = { %{$fonts->{$_}} } for qw( text chorus chord grid toc tab ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | # warn("X2: ", $pr->{_df}->{$_}->{size}, "\n") for "text"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 80 | ▶ | $structured = ( $options->{'backend-option'}->{structure} // '' ) eq 'structured'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$main::options->{"backend-option"}{"structure"} // ""
MC/DC0%0/1
$main::options->{"backend-option"}{"structure"} // ""
$main::options->{"backend-option"}{"structure"}
Truth table50%1/2
A
A= $main::options->{"backend-option"}{"structure"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 80 | ▶ | $s->structurize if $structured; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 80 | @allpages = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # Diagrams drawer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 80 | my $dd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | my $dctl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 80 | ▶ | if ( $::config->{instrument}->{type} eq "keyboard" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | require ChordPro::Output::PDF::KeyboardDiagram; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $dd = ChordPro::Output::PDF::KeyboardDiagram->new( ps => $ps, pr => $pr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $dctl = $ps->{kbdiagrams}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 80 | require ChordPro::Output::PDF::StringDiagram; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 80 | $dd = ChordPro::Output::PDF::StringDiagram->new( ps => $ps, pr => $pr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 80 | $dctl = $ps->{diagrams}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | $dctl->{show} = $s->{settings}->{diagrampos} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 80 | ▶ | if defined $s->{settings}->{diagrampos}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 80 | $ps->{dd} = $dd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 80 | my $sb = $s->{body}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # set_columns needs these, set provisional values. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 80 | $ps->{_leftmargin} = $ps->{marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 80 | $ps->{_rightmargin} = $ps->{marginright}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | set_columns( $ps, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 80 | ▶ | $s->{settings}->{columns} || $::config->{settings}->{columns} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$s->{'settings'}{'columns'} || $main::config->{'settings'}{'columns'}
MC/DC0%0/2
$s->{'settings'}{'columns'} || $main::config->{'settings'}{'columns'}
$s->{'settings'}{'columns'}
$main::config->{'settings'}{'columns'}
Truth table33%1/3
A || B
A= $s->{'settings'}{'columns'}B= $main::config->{'settings'}{'columns'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 80 | $chordscol = $ps->{chordscolumn}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 80 | $lyrics_only = $::config->{settings}->{'lyrics-only'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 80 | $chordscapo = $s->{meta}->{capo}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 80 | my $fail; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 80 | for my $item ( @{ SIZE_ITEMS() } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 800 | for ( $options->{"$item-font"} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 800 | ▶ | next unless $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | delete( $fonts->{$item}->{file} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | delete( $fonts->{$item}->{name} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | delete( $fonts->{$item}->{description} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | if ( m;/; ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $fonts->{$item}->{file} = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | elsif ( is_corefont($_) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | $fonts->{$item}->{name} = is_corefont($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $fonts->{$item}->{description} = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | $pr->init_font($item) or $fail++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 800 | for ( $options->{"$item-size"} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 800 | ▶ | next unless $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $fonts->{$item}->{size} = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 80 | ▶ | die("Unhandled fonts detected -- aborted\n") if $fail; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 80 | ▶ | if ( $ps->{labels}->{comment} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $ps->{_indent} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | elsif ( $ps->{labels}->{width} eq "auto" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | if ( $s->{labels} && @{ $s->{labels} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$s->{"labels"} and @{$s->{"labels"};}
MC/DC0%0/2
$s->{"labels"} and @{$s->{"labels"};}
$s->{"labels"}
@{$s->{"labels"};}
Truth table33%1/3
A and B
A= $s->{"labels"}B= @{$s->{"labels"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $longest = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | my $ftext = $fonts->{label} || $fonts->{text}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$fonts->{'label'} || $fonts->{'text'}
MC/DC0%0/2
$fonts->{'label'} || $fonts->{'text'}
$fonts->{'label'}
$fonts->{'text'}
Truth table0%0/3
A || B
A= $fonts->{'label'}B= $fonts->{'text'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my $size = $ftext->{size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my $w = $pr->strwidth(" ", $ftext, $size); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | for ( @{ $s->{labels} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # Split on real newlines and \n. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | for ( split( /\\n|\n/, $_ ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $t = $pr->strwidth( $_, $ftext, $size ) + $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | $longest = $t if $t > $longest; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $ps->{_indent} = $longest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 80 | $ps->{_indent} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $ps->{_indent} = $ps->{labels}->{width}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 80 | ▶ | my $set_sizes = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 80 | $ps->{lineheight} = $fonts->{text}->{size} - 1; # chordii | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 80 | $ps->{chordheight} = $fonts->{chord}->{size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 80 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 80 | $set_sizes->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 80 | $ps->{'vertical-space'} = $options->{'vertical-space'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 80 | for ( @{ SIZE_ITEMS() } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 800 | $fonts->{$_}->{_size} = $fonts->{$_}->{size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 80 | my $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 80 | my $y = $ps->{papersize}->[1] - $ps->{margintop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 80 | ▶ | my $st = $s->{settings}->{titles} || $::config->{settings}->{titles}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$s->{'settings'}{'titles'} || $main::config->{'settings'}{'titles'}
MC/DC0%0/2
$s->{'settings'}{'titles'} || $main::config->{'settings'}{'titles'}
$s->{'settings'}{'titles'}
$main::config->{'settings'}{'titles'}
Truth table33%1/3
A || B
A= $s->{'settings'}{'titles'}B= $main::config->{'settings'}{'titles'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 80 | ▶ | if ( defined($st) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $st and not $ps->{"titles-directive-ignore"}
MC/DC0%0/2
defined $st and not $ps->{"titles-directive-ignore"}
defined $st
not $ps->{"titles-directive-ignore"}
Truth table33%1/3
A and not(B)
A= defined $stB= not $ps->{"titles-directive-ignore"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | && ! $ps->{'titles-directive-ignore'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | my $swap = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my ( $from, $to ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | for my $class ( @classes ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | for ( qw( title subtitle footer ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | next unless defined $ps->{formats}->{$class}->{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | unless ( is_arrayref($ps->{formats}->{$class}->{$_}) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | warn("Oops -- pdf.formats.$class.$_ is not an array\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | unless ( is_arrayref($ps->{formats}->{$class}->{$_}->[0]) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | $ps->{formats}->{$class}->{$_} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | [ $ps->{formats}->{$class}->{$_} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | for my $l ( @{$ps->{formats}->{$class}->{$_}} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ( $l->[$from], $l->[$to] ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | ( $l->[$to], $l->[$from] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 80 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 80 | ▶ | if ( $st eq "left" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $swap->(0,1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 80 | ▶ | if ( $st eq "right" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $swap->(2,1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | my $do_size = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | my ( $tag, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if ( $value =~ /^(.+)\%$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | $fonts->{$tag}->{_size} //= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | $::config->{pdf}->{fonts}->{$tag}->{size}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$fonts->{$tag}{"_size"} //= $main::config->{"pdf"}{"fonts"}{$tag}{"size"}
MC/DC0%0/2
$fonts->{$tag}{"_size"} //= $main::config->{"pdf"}{"fonts"}{$tag}{"size"}
$fonts->{$tag}{"_size"}
$main::config->{"pdf"}{"fonts"}{$tag}{"size"}
Truth table0%0/3
A //= B
A= $fonts->{$tag}{"_size"}B= $main::config->{"pdf"}{"fonts"}{$tag}{"size"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | $fonts->{$tag}->{size} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ( $1 / 100 ) * $fonts->{$tag}->{_size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | $fonts->{$tag}->{size} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $fonts->{$tag}->{_size} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $set_sizes->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 80 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 80 | my $col; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | my $spreadimage; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 105 | ▶ | my $col_adjust = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=37.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 105 | ▶ | if ( $ps->{columns} <= 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | warn( "C=-", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | pv( ", T=", $ps->{_top} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | pv( ", L=", $ps->{__leftmargin} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | pv( ", I=", $ps->{_indent} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | pv( ", R=", $ps->{__rightmargin} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | pv( ", S=?", $spreadimage ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 105 | ▶ | "\n") if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 105 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | $x = $ps->{_leftmargin} + $ps->{columnoffsets}->[$col]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $ps->{__leftmargin} = $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | $ps->{__rightmargin} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | $ps->{_leftmargin} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | + $ps->{columnoffsets}->[$col+1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | $ps->{__rightmargin} -= $ps->{columnspace} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if $col < $ps->{columns}-1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | $y = $ps->{_top}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | warn( pv( "C=", $col ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | pv( ", T=", $ps->{_top} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | pv( ", L=", $ps->{__leftmargin} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | pv( ", I=", $ps->{_indent} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | pv( ", R=", $ps->{__rightmargin} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | pv( ", S=?", $spreadimage ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | "\n") if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $x += $ps->{_indent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | $y -= $spreadimage if defined($spreadimage) && !ref($spreadimage); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $spreadimage and not ref $spreadimage
MC/DC0%0/2
defined $spreadimage and not ref $spreadimage
defined $spreadimage
not ref $spreadimage
Truth table0%0/3
A and not(B)
A= defined $spreadimageB= not ref $spreadimage
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # Prevent spread space on other pages (issue #640). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | undef $spreadimage if $col == $ps->{columns}-1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 80 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 80 | my $vsp_ignorefirst; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 80 | my $startpage = $opts->{page_num}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | # These are 1 smaller since they'll be incremented first. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 80 | my $page_num = $startpage - 1; # page number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 80 | my $page_idx = $opts->{page_idx}-1; # page # in PDF | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # Physical newpage handler. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 105 | ▶ | my $newpage = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=20 SCAR=37.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 105 | $page_idx++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 105 | $page_num++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | $s->{meta}->{page} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | [ $s->{page} = $opts->{roman} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 105 | ▶ | ? roman($page_num) : $page_num ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # Add page to the PDF. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 105 | ▶ | $pr->newpage( $opts->{prepend} ? $page_idx : () ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | warn("page: $page_idx(",$s->{page},") added\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 105 | ▶ | if $config->{debug}->{pages} & 0x01; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # Put titles and footer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # If even/odd pages, leftpage signals whether the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # header/footer parts must be swapped. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 105 | my $rightpage = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 105 | ▶ | if ( $pagectrl->{dual_pages} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 95 | $rightpage = is_odd($page_num); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | # margin* are offsets from the edges of the paper. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # _*margin are offsets taking even/odd pages into account. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # _margin* are physical coordinates, taking ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 105 | ▶ | if ( $rightpage ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 71 | $ps->{_leftmargin} = $ps->{marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 71 | $ps->{_marginleft} = $ps->{marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 71 | $ps->{_rightmargin} = $ps->{marginright}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 71 | $ps->{_marginright} = $ps->{papersize}->[0] - $ps->{marginright}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 34 | $ps->{_leftmargin} = $ps->{marginright}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 34 | $ps->{_marginleft} = $ps->{marginright}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 34 | $ps->{_rightmargin} = $ps->{marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 34 | $ps->{_marginright} = $ps->{papersize}->[0] - $ps->{marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 105 | $ps->{_marginbottom} = $ps->{marginbottom}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 105 | $ps->{_margintop} = $ps->{papersize}->[1] - $ps->{margintop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 105 | $ps->{_bottommargin} = $ps->{marginbottom}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | # Physical coordinates; will be adjusted to columns if needed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 105 | $ps->{__leftmargin} = $ps->{_marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 105 | $ps->{__rightmargin} = $ps->{_marginright}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 105 | $ps->{__topmargin} = $ps->{_margintop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 105 | $ps->{__bottommargin} = $ps->{_marginbottom}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # Determine page class and background. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 105 | my $class = 2; # default | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 105 | my $bgpdf = $ps->{formats}->{default}->{background}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 105 | ▶ | if ( $page_num == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 25 | $class = 0; # very first page | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | $bgpdf = $ps->{formats}->{first}->{background} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | || $ps->{formats}->{title}->{background} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 25 | ▶ | || $bgpdf; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$ps->{'formats'}{'first'}{'background'} || $ps->{'formats'}{'title'}{'background'} || $bgpdf
$ps->{"formats"}{"first"}{"background"} or $ps->{"formats"}{"title"}{"background"}
MC/DC0%0/3
$ps->{'formats'}{'first'}{'background'} || $ps->{'formats'}{'title'}{'background'} || $bgpdf
$ps->{"formats"}{"first"}{"background"}
$ps->{"formats"}{"title"}{"background"}
$bgpdf
Truth table25%1/4
A or B || C
A= $ps->{"formats"}{"first"}{"background"}B= $ps->{"formats"}{"title"}{"background"}C= $bgpdf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | elsif ( $page_num == $startpage ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 60 | $class = 1; # first of a song | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | $bgpdf = $ps->{formats}->{title}->{background} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 60 | ▶ | || $bgpdf; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$ps->{'formats'}{'title'}{'background'} || $bgpdf
MC/DC0%0/2
$ps->{'formats'}{'title'}{'background'} || $bgpdf
$ps->{'formats'}{'title'}{'background'}
$bgpdf
Truth table33%1/3
A || B
A= $ps->{'formats'}{'title'}{'background'}B= $bgpdf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 105 | ▶ | if ( $bgpdf ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my ( $fn, $pg ) = ( $bgpdf, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | if ( $bgpdf =~ /^(.+):(\d+)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ( $bgpdf, $pg ) = ( $1, $2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $fn = CP->findres($bgpdf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | if ( $fn && fs_test( rs => $fn ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$fn and fs_test("rs", $fn)
MC/DC0%0/2
$fn and fs_test("rs", $fn)
$fn
fs_test("rs", $fn)
Truth table0%0/3
A and B
A= $fnB= fs_test("rs", $fn)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | $pg++ if $pagectrl->{dual_pages} && !$rightpage; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pagectrl->{"dual_pages"} and not $rightpage
MC/DC0%0/2
$pagectrl->{"dual_pages"} and not $rightpage
$pagectrl->{"dual_pages"}
not $rightpage
Truth table0%0/3
A and not(B)
A= $pagectrl->{"dual_pages"}B= not $rightpage
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | $pr->importpage( $fn, $pg ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | warn( "PDF: Missing or empty background document: ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | $bgpdf, "\n" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 105 | $x = $ps->{__leftmargin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 105 | $y = $ps->{_margintop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 105 | ▶ | $y += $ps->{headspace} if $ps->{'head-first-only'} && $class == 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ps->{"head-first-only"} and $class == 2
MC/DC0%0/2
$ps->{"head-first-only"} and $class == 2
$ps->{"head-first-only"}
$class == 2
Truth table33%1/3
A and B
A= $ps->{"head-first-only"}B= $class == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 105 | $x += $ps->{_indent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 105 | $ps->{_top} = $y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 105 | $col = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 105 | $vsp_ignorefirst = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 105 | $col_adjust->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | # Render the 'allpages' images. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 105 | for ( @allpages ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | my %imageinfo = %$_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my $img = delete $imageinfo{img}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my $x = delete $imageinfo{x}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my $y = delete $imageinfo{y}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $pr->add_object( $img, $x, $y, %imageinfo ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 80 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 222 | ▶ | my $checkspace = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=22.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # Verify that the amount of space if still available. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # If not, perform a column break or page break. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # Use negative argument to force a break. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # Returns true if there was space. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 222 | my $vsp = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 222 | ▶ | return 1 if $vsp >= 0 && $y - $vsp >= $ps->{_bottommargin}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$vsp >= 0 and $y - $vsp >= $ps->{"_bottommargin"}
MC/DC0%0/2
$vsp >= 0 and $y - $vsp >= $ps->{"_bottommargin"}
$vsp >= 0
$y - $vsp >= $ps->{"_bottommargin"}
Truth table33%1/3
A and B
A= $vsp >= 0B= $y - $vsp >= $ps->{"_bottommargin"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | if ( ++$col >= $ps->{columns}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $newpage->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | $vsp_ignorefirst = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | $col_adjust->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 80 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 80 | ▶ | my $chorddiagrams = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=50 SCAR=63.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 80 | my ( $chords, $show, $ldisp ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 80 | ▶ | return if $lyrics_only || !$dctl->{show}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$lyrics_only or not $dctl->{"show"}
MC/DC0%0/2
$lyrics_only or not $dctl->{"show"}
$lyrics_only
not $dctl->{"show"}
Truth table33%1/3
A or not(B)
A= $lyrics_onlyB= not $dctl->{"show"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 80 | my @chords; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | $chords = $s->{chords}->{chords} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 80 | ▶ | if !defined($chords) && $s->{chords}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $chords and $s->{"chords"}
MC/DC0%0/2
not defined $chords and $s->{"chords"}
not defined $chords
$s->{"chords"}
Truth table33%1/3
not(A) and B
A= not defined $chordsB= $s->{"chords"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 80 | ▶ | $show //= $dctl->{show}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$show //= $dctl->{"show"}
MC/DC0%0/2
$show //= $dctl->{"show"}
$show
$dctl->{"show"}
Truth table33%1/3
A //= B
A= $showB= $dctl->{"show"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 80 | ▶ | if ( $chords ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 80 | for ( @$chords ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 54 | ▶ | if ( my $i = $s->{chordsinfo}->{$_} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 54 | ▶ | push( @chords, $i ) if $i->has_diagram; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | warn("PDF: Missing chord info for \"$_\"\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 80 | ▶ | return unless @chords; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | # Determine page class. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 27 | my $class = 2; # default | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 27 | ▶ | if ( $page_num == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 8 | $class = 0; # very first page | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | elsif ( $page_num == $startpage ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 19 | $class = 1; # first of a song | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | warn( "page: ", $page_num, " ($startpage) cls=$class\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 27 | ▶ | if $config->{debug}->{pages} & 0x01; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | # If chord diagrams are to be printed in the right column, put | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | # them on the first page. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 27 | ▶ | if ( $show eq "right" && $class <= 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
$show eq "right" and $class <= 1
MC/DC0%0/2
$show eq "right" and $class <= 1
$show eq "right"
$class <= 1
Truth table33%1/3
A and B
A= $show eq "right"B= $class <= 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | my $vsp = $dd->vsp( undef, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | my $v = int( ( $ps->{_margintop} - $ps->{marginbottom} ) / $vsp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | my $c = int( ( @chords - 1) / $v ) + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | # warn("XXX ", scalar(@chords), ", $c colums of $v max\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | my $column = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | $ps->{_marginright} - $ps->{_marginleft} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | - ($c-1) * $dd->hsp(undef,$ps) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | - $dd->hsp0(undef,$ps); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | my $hsp = $dd->hsp(undef,$ps); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | my $x = $x + $column - $ps->{_indent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | $ps->{_rightmargin} = $ps->{papersize}->[0] - $x + $ps->{columnspace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | $ps->{__rightmargin} = $x - $ps->{columnspace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | set_columns( $ps, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | $s->{settings}->{columns} || $::config->{settings}->{columns} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$s->{'settings'}{'columns'} || $main::config->{'settings'}{'columns'}
MC/DC0%0/2
$s->{'settings'}{'columns'} || $main::config->{'settings'}{'columns'}
$s->{'settings'}{'columns'}
$main::config->{'settings'}{'columns'}
Truth table0%0/3
A || B
A= $s->{'settings'}{'columns'}B= $main::config->{'settings'}{'columns'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | $col_adjust->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $y = $y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | while ( @chords ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | for ( 0..$c-1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | last unless @chords; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | $dd->draw( shift(@chords), $x + $_*$hsp, $y, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $y -= $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | ▶ | elsif ( ( $show eq "top" || $show eq "bottom" ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%3/9
$show eq "top" || $show eq "bottom" and $class <= 1 and $col == 0
$show eq "top" || $show eq "bottom" and $class <= 1
$show eq "top" or $show eq "bottom"
MC/DC0%0/4
$show eq "top" || $show eq "bottom" and $class <= 1 and $col == 0
$show eq "top"
$show eq "bottom"
$class <= 1
$col == 0
Truth table14%1/7
A or B and C and D
A= $show eq "top"B= $show eq "bottom"C= $class <= 1D= $col == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | && $class <= 1 && $col == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 27 | my $ww = $ps->{_marginright} - $ps->{_marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 27 | my $dwidth = $dd->hsp0(undef,$ps); # diag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 27 | my $dadv = $dd->hsp1(undef,$ps); # adv | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 27 | my $hsp = $dwidth + $dadv; # diag + adv | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 27 | my $vsp = $dd->vsp( undef, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | # Number of diagrams, based on minimal required interspace. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | # Add one interspace (cuts off right) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 27 | my $h = int( ( $ww + $dadv ) / $hsp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 27 | ▶ | die("ASSERT: $h should be greater than 0") unless $h > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | # Spread evenly over multiple lines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 27 | ▶ | if ( $dctl->{align} eq "center" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | my $lines = int((@chords-1)/$h) + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $h = int((@chords-1)/$lines) + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 27 | my $y = $y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 27 | ▶ | if ( $show eq "bottom" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 27 | $y = $ps->{marginbottom} + (int((@chords-1)/$h) + 1) * $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 27 | $ps->{_bottommargin} = $y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 27 | $y -= $dd->vsp1( undef, $ps ); # advance height | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 27 | my $h0 = $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 27 | ▶ | while ( @chords ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 27 | my $x = $x - $ps->{_indent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 27 | $checkspace->($vsp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 27 | ▶ | $pr->show_vpos( $y, 0 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 27 | ▶ | if ( $dctl->{align} eq 'spread' && @chords == $h0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$dctl->{"align"} eq "spread" and @chords == $h0
MC/DC0%0/2
$dctl->{"align"} eq "spread" and @chords == $h0
$dctl->{"align"} eq "spread"
@chords == $h0
Truth table33%1/3
A and B
A= $dctl->{"align"} eq "spread"B= @chords == $h0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | my $delta = $ww + $dadv - min( $h0, 0+@chords ) * $hsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | $dadv = $dd->hsp1(undef,$ps) + $delta / ($h0-1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | elsif ( $dctl->{align} =~ /center|right|spread/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | my $delta = $ww + $dadv - min( $h0, 0+@chords ) * $hsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | $delta /= 2 if $dctl->{align} ne 'right'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | $x += $delta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 27 | for ( 1..$h ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 81 | ▶ | last unless @chords; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 54 | $dd->draw( shift(@chords), $x, $y, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 54 | $x += $dwidth + $dadv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 27 | $y -= $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 27 | ▶ | $pr->show_vpos( $y, 1 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 27 | ▶ | $ps->{_top} = $y if $show eq "top"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | elsif ( $show eq "below" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # Note that 'below' chords honour the label margin. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | my $ww = $ps->{__rightmargin} - $ps->{__leftmargin} - $ps->{_indent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | my $dwidth = $dd->hsp0(undef,$ps); # diag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | my $dadv = $dd->hsp1(undef,$ps); # adv | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | my $hsp = $dwidth + $dadv; # diag + adv | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | my $vsp = $dd->vsp( undef, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | my $h = int( ( $ww + $dadv ) / $hsp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | die("ASSERT: $h should be greater than 0") unless $h > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | # Spread evenly over multiple lines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | if ( $dctl->{align} eq "center" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | my $lines = int((@chords-1)/$h) + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | $h = int((@chords-1)/$lines) + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | my $h0 = $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | while ( @chords ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | $checkspace->($vsp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | my $x = $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | $pr->show_vpos( $y, 0 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | ▶ | if ( $dctl->{align} eq 'spread' && @chords == $h0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$dctl->{"align"} eq "spread" and @chords == $h0
MC/DC0%0/2
$dctl->{"align"} eq "spread" and @chords == $h0
$dctl->{"align"} eq "spread"
@chords == $h0
Truth table0%0/3
A and B
A= $dctl->{"align"} eq "spread"B= @chords == $h0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | my $delta = $ww + $dadv - min( $h0, 0+@chords ) * $hsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | $dadv = $dd->hsp1(undef,$ps) + $delta / ($h0-1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | elsif ( $dctl->{align} =~ /center|right|spread/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | my $delta = $ww + $dadv - min( $h0, 0+@chords ) * $hsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | $delta /= 2 if $dctl->{align} ne 'right'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | $x += $delta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | for ( 1..$h ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | last unless @chords; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | $dd->draw( shift(@chords), $x, $y, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | $x += $hsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $y -= $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | ▶ | $pr->show_vpos( $y, 1 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 27 | ▶ | $y = $ps->{_top} if $show eq "top"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 80 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 80 | my @elts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | ▶ | my $dbgop = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | my ( $elts, $pb ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | ▶ | $elts //= $elts[-1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$elts //= $elts[-1]
MC/DC0%0/2
$elts //= $elts[-1]
$elts
$elts[-1]
Truth table0%0/3
A //= B
A= $eltsB= $elts[-1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | $elts = [ $elts ] unless is_arrayref($elts); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | for my $elt ( @$elts ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | my $msg = sprintf("OP L:%2d %s (", $elt->{line}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | $pb ? "pushback($elt->{type})" : $elt->{type} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | ▶ | $msg .= " " . $elt->{subtype} if $elt->{subtype}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | $msg .= " U:" . $elt->{uri} if $elt->{uri}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | $msg .= " O:" . $elt->{orig} if $elt->{orig}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | $msg .= " D:" . $elt->{delegate} if $elt->{delegate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | $msg .= " H:" . $elt->{handler} if $elt->{handler}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | $msg .= " )"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | $msg =~ s/\s+\(\s+\)//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | if ( $config->{debug}->{ops} > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | require ChordPro::Dumper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | ▶ | local *ChordPro::Chords::Appearance::_data_printer = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | my ( $self, $ddp ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | ▶ | "ChordPro::Chords::Appearance('" . $self->key . "'" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | ($self->format ? (", '" . $self->format . "'") : "") . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | ")"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ChordPro::Dumper::ddp( $elt, as => $msg ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | warn( $msg, "\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 80 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | #### CODE STARTS HERE #### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | # prepare_assets( $s, $pr ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 80 | $spreadimage = $s->{spreadimage}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | # Get going. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 80 | $newpage->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | # Embed source and config for debugging; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | $pr->embed($source->{file}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | if $source->{file} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | && ( $options->{debug} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | $config->{debug}->{runtimeinfo} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 80 | ▶ | && $ChordPro::VERSION =~ /_/ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$source->{"file"} and $main::options->{"debug"} || $main::config->{"debug"}{"runtimeinfo"} && $ChordPro::VERSION =~ /_/u
$main::options->{"debug"} or $main::config->{"debug"}{"runtimeinfo"} and $ChordPro::VERSION =~ /_/u
$main::config->{"debug"}{"runtimeinfo"} and $ChordPro::VERSION =~ /_/u
MC/DC0%0/4
$source->{"file"} and $main::options->{"debug"} || $main::config->{"debug"}{"runtimeinfo"} && $ChordPro::VERSION =~ /_/u
$source->{"file"}
$main::options->{"debug"}
$main::config->{"debug"}{"runtimeinfo"}
$ChordPro::VERSION =~ /_/u
Truth table20%1/5
A and B or C and D
A= $source->{"file"}B= $main::options->{"debug"}C= $main::config->{"debug"}{"runtimeinfo"}D= $ChordPro::VERSION =~ /_/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 80 | my $prev; # previous element | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | my $grid_cellwidth; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 80 | my $grid_barwidth = 0.5 * $fonts->{chord}->{size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 80 | my $grid_margin; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 80 | my $did = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 80 | my $curctx = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 80 | my $elt; # current element | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 80 | @elts = @$sb; # song elements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 80 | ▶ | while ( @elts ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 292 | $elt = shift(@elts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 292 | ▶ | if ( $config->{debug}->{ops} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | $dbgop->($elt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 292 | ▶ | if ( $elt->{type} eq "newpage" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 25 | $newpage->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 25 | ▶ | showlayout($ps) if $ps->{showlayout} || $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ps->{"showlayout"} or $main::config->{"debug"}{"spacing"}
MC/DC0%0/2
$ps->{"showlayout"} or $main::config->{"debug"}{"spacing"}
$ps->{"showlayout"}
$main::config->{"debug"}{"spacing"}
Truth table33%1/3
A or B
A= $ps->{"showlayout"}B= $main::config->{"debug"}{"spacing"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 25 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 267 | ▶ | if ( $elt->{type} eq "colb" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | $checkspace->(-1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 267 | ▶ | if ( $elt->{type} ne "set" && !$did++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$elt->{"type"} ne "set" and not $did++
MC/DC50%1/2
$elt->{"type"} ne "set" and not $did++
$elt->{"type"} ne "set"
not $did++
Truth table66%2/3
A and not(B)
A= $elt->{"type"} ne "set"B= not $did++
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | # Insert top/left/right/bottom chord diagrams. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 80 | ▶ | $chorddiagrams->() unless $dctl->{show} eq "below"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | # Prepare the assets now we know the page width. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 80 | $assets = prepare_assets( $s, $pr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | # Spread image. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 80 | ▶ | if ( $spreadimage ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | ▶ | if (ref($spreadimage) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | # Spread image doesn't indent. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | $spreadimage = imagespread( $spreadimage, $x-$ps->{_indent}, $y, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | $y -= $spreadimage; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 80 | ▶ | showlayout($ps) if $ps->{showlayout} || $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ps->{"showlayout"} or $main::config->{"debug"}{"spacing"}
MC/DC0%0/2
$ps->{"showlayout"} or $main::config->{"debug"}{"spacing"}
$ps->{"showlayout"}
$main::config->{"debug"}{"spacing"}
Truth table33%1/3
A or B
A= $ps->{"showlayout"}B= $main::config->{"debug"}{"spacing"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 267 | ▶ | if ( $elt->{type} eq "empty" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 45 | my $y0 = $y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | warn("***SHOULD NOT HAPPEN1***") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 45 | ▶ | if $s->{structure} eq "structured"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 45 | ▶ | if ( $vsp_ignorefirst ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 27 | ▶ | if ( @elts && $elts[0]->{type} !~ /empty|ignore|meta/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@elts and not $elts[0]{"type"} =~ /empty|ignore|meta/u
MC/DC0%0/2
@elts and not $elts[0]{"type"} =~ /empty|ignore|meta/u
@elts
not $elts[0]{"type"} =~ /empty|ignore|meta/u
Truth table33%1/3
A and not(B)
A= @eltsB= not $elts[0]{"type"} =~ /empty|ignore|meta/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 27 | $vsp_ignorefirst = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 27 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 18 | ▶ | $pr->show_vpos( $y, 0 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 18 | my $vsp = empty_vsp( $elt, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 18 | $y -= $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 18 | ▶ | $pr->show_vpos( $y, 1 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 18 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 222 | ▶ | unless ( $elt->{type} =~ /^(?:control|set|ignore|meta)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 195 | $vsp_ignorefirst = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 222 | ▶ | if ( $elt->{type} eq "songline" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$elt->{"type"} eq "songline" or $elt->{"type"} eq "tabline" or $elt->{"type"} =~ /^comment(?:_box|_italic)?$/u
$elt->{"type"} eq "songline" or $elt->{"type"} eq "tabline"
MC/DC33%1/3
$elt->{"type"} eq "songline" or $elt->{"type"} eq "tabline" or $elt->{"type"} =~ /^comment(?:_box|_italic)?$/u
$elt->{"type"} eq "songline"
$elt->{"type"} eq "tabline"
$elt->{"type"} =~ /^comment(?:_box|_italic)?$/u
Truth table50%2/4
A or B or C
A= $elt->{"type"} eq "songline"B= $elt->{"type"} eq "tabline"C= $elt->{"type"} =~ /^comment(?:_box|_italic)?$/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | or $elt->{type} eq "tabline" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | or $elt->{type} =~ /^comment(?:_box|_italic)?$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 141 | ▶ | if ( $elt->{context} ne $curctx ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | $curctx = $elt->{context}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 141 | my $fonts = $ps->{fonts}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 141 | my $type = $elt->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 141 | my $ftext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 141 | ▶ | if ( $type eq "songline" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 141 | ▶ | $ftext = $curctx eq "chorus" ? $fonts->{chorus} : $fonts->{text}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | elsif ( $type =~ /^comment/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | ▶ | $ftext = $fonts->{$type} || $fonts->{comment}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$fonts->{$type} || $fonts->{'comment'}
MC/DC0%0/2
$fonts->{$type} || $fonts->{'comment'}
$fonts->{$type}
$fonts->{'comment'}
Truth table0%0/3
A || B
A= $fonts->{$type}B= $fonts->{'comment'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | elsif ( $type eq "tabline" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | $ftext = $fonts->{tab}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | # Get vertical space the songline will occupy. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 141 | my $vsp = songline_vsp( $elt, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 141 | ▶ | if ( $elt->{type} eq "songline" && !$elt->{indent} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$elt->{"type"} eq "songline" and not $elt->{"indent"}
MC/DC0%0/2
$elt->{"type"} eq "songline" and not $elt->{"indent"}
$elt->{"type"} eq "songline"
not $elt->{"indent"}
Truth table33%1/3
A and not(B)
A= $elt->{"type"} eq "songline"B= not $elt->{"indent"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 141 | my $e = wrap( $pr, $elt, $x ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 141 | ▶ | if ( @$e > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | $checkspace->($vsp * scalar( @$e )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | $elt = shift( @$e ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | unshift( @elts, @$e ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | # Add prespace if fit. Otherwise newpage. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 141 | $checkspace->($vsp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 141 | ▶ | $pr->show_vpos( $y, 0 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 141 | my $indent = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | # Handle decorations. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 141 | ▶ | if ( $elt->{context} eq "chorus" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | my $style = $ps->{chorus}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | $indent = $style->{indent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | ▶ | if ( $style->{bar}->{offset} && $style->{bar}->{width} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$style->{"bar"}{"offset"} and $style->{"bar"}{"width"}
MC/DC0%0/2
$style->{"bar"}{"offset"} and $style->{"bar"}{"width"}
$style->{"bar"}{"offset"}
$style->{"bar"}{"width"}
Truth table0%0/3
A and B
A= $style->{"bar"}{"offset"}B= $style->{"bar"}{"width"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | my $cx = $ps->{__leftmargin} + $ps->{_indent} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | - $style->{bar}->{offset} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | + $indent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | $pr->vline( $cx, $y, $vsp, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | $style->{bar}->{width}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | $style->{bar}->{color} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | $curctx = "chorus"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | $i_tag = "" unless $config->{settings}->{choruslabels}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | # Substitute metadata in comments. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 141 | ▶ | if ( $elt->{type} =~ /^comment/ && !$elt->{indent} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$elt->{"type"} =~ /^comment/u and not $elt->{"indent"}
MC/DC0%0/2
$elt->{"type"} =~ /^comment/u and not $elt->{"indent"}
$elt->{"type"} =~ /^comment/u
not $elt->{"indent"}
Truth table33%1/3
A and not(B)
A= $elt->{"type"} =~ /^comment/uB= not $elt->{"indent"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | $elt = { %$elt }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | # Flatten chords/phrases. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | ▶ | if ( $elt->{chords} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | $elt->{text} = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | for ( 0..$#{ $elt->{chords} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | $elt->{text} .= $elt->{chords}->[$_] . $elt->{phrases}->[$_]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | $elt->{text} = fmt_subst( $s, $elt->{text} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | # Comment decorations. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 141 | $pr->setfont( $ftext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | =begin xxx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | my $text = $elt->{text}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | my $w = $pr->strwidth( $text ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | # Draw background. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | my $bgcol = $ftext->{background}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | if ( $elt->{type} eq "comment" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | # Default to grey. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | $bgcol ||= "#E5E5E5"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | # Since we default to grey, we need a way to cancel it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | undef $bgcol if $bgcol eq "none"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | if ( $bgcol ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | $pr->rectxy( $x + $indent - 2, $y + 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | $x + $indent + $w + 2, $y - $vsp, 3, $bgcol ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | # Draw box. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | my $x0 = $x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | if ( $elt->{type} eq "comment_box" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | $x0 += 0.25; # add some offset for the box | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | $pr->rectxy( $x0 + $indent, $y + 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | $x0 + $indent + $w + 1, $y - $vsp + 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 0.5, undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | $ftext->{color} || $ps->{theme}->{foreground} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 141 | my $r = songline( $elt, $x, $y, $ps, song => $s, indent => $indent ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 141 | $y -= $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 141 | ▶ | $pr->show_vpos( $y, 1 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 141 | ▶ | unshift( @elts, $r ) if $r; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 141 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 81 | ▶ | if ( $elt->{type} eq "chorus" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | warn("NYI: type => chorus\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | my $cy = $y + vsp($ps,-2); # ####TODO???? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | foreach my $e ( @{$elt->{body}} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | ▶ | if ( $e->{type} eq "songline" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | $y = songline( $e, $x, $y, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | elsif ( $e->{type} eq "empty" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | warn("***SHOULD NOT HAPPEN2***"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | $y -= vsp($ps); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | my $style = $ps->{chorus}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | my $cx = $ps->{__leftmargin} - $style->{bar}->{offset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | $pr->vline( $cx, $cy, vsp($ps), 1, $style->{bar}->{color} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | $y -= vsp($ps,4); # chordii | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 81 | ▶ | if ( $elt->{type} eq "verse" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | warn("NYI: type => verse\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | foreach my $e ( @{$elt->{body}} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | ▶ | if ( $e->{type} eq "songline" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | my $h = songline_vsp( $e, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | $checkspace->($h); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | songline( $e, $x, $y, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | $y -= $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | elsif ( $e->{type} eq "empty" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | warn("***SHOULD NOT HAPPEN2***"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | $y -= vsp($ps); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | $y -= vsp($ps,4); # chordii | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 81 | ▶ | if ( $elt->{type} eq "gridline" || $elt->{type} eq "strumline" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$elt->{"type"} eq "gridline" or $elt->{"type"} eq "strumline"
MC/DC0%0/2
$elt->{"type"} eq "gridline" or $elt->{"type"} eq "strumline"
$elt->{"type"} eq "gridline"
$elt->{"type"} eq "strumline"
Truth table33%1/3
A or B
A= $elt->{"type"} eq "gridline"B= $elt->{"type"} eq "strumline"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | ▶ | $vsp_ignorefirst = 1, next if $lyrics_only || !$ps->{grids}->{show}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$lyrics_only or not $ps->{"grids"}{"show"}
MC/DC0%0/2
$lyrics_only or not $ps->{"grids"}{"show"}
$lyrics_only
not $ps->{"grids"}{"show"}
Truth table0%0/3
A or not(B)
A= $lyrics_onlyB= not $ps->{"grids"}{"show"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | my $vsp = grid_vsp( $elt, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | $checkspace->($vsp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | ▶ | $pr->show_vpos( $y, 0 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | my $cells = $grid_margin->[2]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | $grid_cellwidth = ( $ps->{__rightmargin} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | - $ps->{_indent} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | - $ps->{__leftmargin} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | - ($cells)*$grid_barwidth | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | ) / $cells; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | warn("L=", $ps->{__leftmargin}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | ", I=", $ps->{_indent}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | ", R=", $ps->{__rightmargin}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | ", C=$cells, GBW=$grid_barwidth, W=", $grid_cellwidth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | ▶ | "\n") if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | require ChordPro::Output::PDF::Grid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | ChordPro::Output::PDF::Grid::gridline | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | ( $elt, $x, $y, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | $grid_cellwidth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | $grid_barwidth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | $grid_margin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | $ps, song => $s, type => $elt->{type}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | maybe subtype => $elt->{subtype}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | $y -= $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | ▶ | $pr->show_vpos( $y, 1 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 81 | ▶ | if ( $elt->{type} eq "tab" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | warn("NYI? tab\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | $pr->setfont( $fonts->{tab} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | my $dy = $fonts->{tab}->{size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | foreach my $e ( @{$elt->{body}} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | ▶ | next unless $e->{type} eq "tabline"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | $pr->text( $e->{text}, $x, $y ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | $y -= $dy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 81 | ▶ | if ( $elt->{type} eq "tabline" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | my $vsp = tab_vsp( $elt, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | $checkspace->($vsp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | ▶ | $pr->show_vpos( $y, 0 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | songline( $elt, $x, $y, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | $y -= $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | ▶ | $pr->show_vpos( $y, 1 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 81 | ▶ | if ( $elt->{type} eq "image" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | ▶ | next if defined $elt->{opts}->{spread}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | ▶ | next if $elt->{opts}->{omit}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | # Images are slightly more complex. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | # Only after establishing the desired height we can issue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | # the checkspace call, and we must get $y after that. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | ▶ | my $gety = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | my $h = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | my $have = $checkspace->($h); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | ▶ | $ps->{pr}->show_vpos( $y, 1 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | return wantarray ? ($y,$have) : $y; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | my $vsp = imageline( $elt, $x, $ps, $gety ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | # Turn error into comment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 0 | ▶ | unless ( $vsp =~ /^\d/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | unshift( @elts, { %$elt, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | type => "comment_box", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | text => $vsp, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | redo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | $y -= $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | ▶ | $pr->show_vpos( $y, 1 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | ▶ | if ( $elt->{multi} && !$elt->{msel} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$elt->{"multi"} and not $elt->{"msel"}
MC/DC0%0/2
$elt->{"multi"} and not $elt->{"msel"}
$elt->{"multi"}
not $elt->{"msel"}
Truth table0%0/3
A and not(B)
A= $elt->{"multi"}B= not $elt->{"msel"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | my $i = @{ $elt->{multi} } - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | ▶ | while ( $i > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | unshift( @elts, { %$elt, msel => $i } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | $i--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 81 | ▶ | if ( $elt->{type} eq "rechorus" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | my $t = $ps->{chorus}->{recall}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | ▶ | if ( $t->{type} !~ /^comment(?:_italic|_box)?$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | die("Config error: Invalid value for pdf.chorus.recall.type\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | ▶ | if ( $t->{quote} && $elt->{chorus} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$t->{"quote"} and $elt->{"chorus"}
MC/DC0%0/2
$t->{"quote"} and $elt->{"chorus"}
$t->{"quote"}
$elt->{"chorus"}
Truth table0%0/3
A and B
A= $t->{"quote"}B= $elt->{"chorus"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | unshift( @elts, @{ $elt->{chorus} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | ▶ | elsif ( $elt->{chorus} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$elt->{"chorus"} and $elt->{"chorus"}[0]{"type"} eq "set" and $elt->{"chorus"}[0]{"name"} eq "label"
$elt->{"chorus"} and $elt->{"chorus"}[0]{"type"} eq "set"
MC/DC0%0/3
$elt->{"chorus"} and $elt->{"chorus"}[0]{"type"} eq "set" and $elt->{"chorus"}[0]{"name"} eq "label"
$elt->{"chorus"}
$elt->{"chorus"}[0]{"type"} eq "set"
$elt->{"chorus"}[0]{"name"} eq "label"
Truth table0%0/4
A and B and C
A= $elt->{"chorus"}B= $elt->{"chorus"}[0]{"type"} eq "set"C= $elt->{"chorus"}[0]{"name"} eq "label"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | && $elt->{chorus}->[0]->{type} eq "set" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | && $elt->{chorus}->[0]->{name} eq "label" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | ▶ | if ( $config->{settings}->{choruslabels} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | # Use as margin label. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | unshift( @elts, { %$elt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | type => $t->{type} // "comment", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | font => $ps->{fonts}->{$t->{type} // "label"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | text => $ps->{chorus}->{recall}->{tag}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | } ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | ▶ | if $ps->{chorus}->{recall}->{tag} ne ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$t->{"type"} // "comment"
$t->{"type"} // "label"
MC/DC0%0/1
$t->{"type"} // "comment"
$t->{"type"}
MC/DC0%0/1
$t->{"type"} // "label"
$t->{"type"}
Truth table0%0/2
A
A= $t->{"type"}
Truth table0%0/2
A
A= $t->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | unshift( @elts, { %$elt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | type => "set", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | name => "label", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | value => $elt->{chorus}->[0]->{value}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | # Use as tag. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | unshift( @elts, { %$elt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | type => $t->{type} // "comment", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | font => $ps->{fonts}->{$t->{type} // "label"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | text => $elt->{chorus}->[0]->{value}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | } ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$t->{"type"} // "comment"
$t->{"type"} // "label"
MC/DC0%0/1
$t->{"type"} // "comment"
$t->{"type"}
MC/DC0%0/1
$t->{"type"} // "label"
$t->{"type"}
Truth table0%0/2
A
A= $t->{"type"}
Truth table0%0/2
A
A= $t->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | ▶ | if ( $ps->{chorus}->{recall}->{choruslike} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | $elts[0]->{context} = $elts[1]->{context} = "chorus"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | ▶ | elsif ( $t->{tag} && $t->{type} =~ /^comment(?:_(?:box|italic))?/ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$t->{"tag"} and $t->{"type"} =~ /^comment(?:_(?:box|italic))?/u
MC/DC0%0/2
$t->{"tag"} and $t->{"type"} =~ /^comment(?:_(?:box|italic))?/u
$t->{"tag"}
$t->{"type"} =~ /^comment(?:_(?:box|italic))?/u
Truth table0%0/3
A and B
A= $t->{"tag"}B= $t->{"type"} =~ /^comment(?:_(?:box|italic))?/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | unshift( @elts, { %$elt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | type => $t->{type}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | text => $t->{tag}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 0 | } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | ▶ | if ( $ps->{chorus}->{recall}->{choruslike} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | $elts[0]->{context} = "chorus"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | redo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 81 | ▶ | if ( $elt->{type} eq "tocline" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 54 | my $vsp = toc_vsp( $elt, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 54 | my $vsp0 = toc_vsp( { title => "" }, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 54 | $checkspace->($vsp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 54 | ▶ | $pr->show_vpos( $y, 0 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 54 | $y -= $vsp0 * tocline( $elt, $x, $y, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 54 | ▶ | $pr->show_vpos( $y, 1 ) if $config->{debug}->{spacing}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 54 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 27 | ▶ | if ( $elt->{type} eq "diagrams" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | $chorddiagrams->( $elt->{chords}, "below", $elt->{line} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 27 | ▶ | if ( $elt->{type} eq "control" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | ▶ | if ( $elt->{name} =~ /^($propitems_re)-size$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | ▶ | if ( defined $elt->{value} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | $do_size->( $1, $elt->{value} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | # Restore default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | $ps->{fonts}->{$1}->{size} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | $pr->{_df}->{$1}->{size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | warn("No size to restore for font $1\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | ▶ | unless $ps->{fonts}->{$1}->{size}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | elsif ( $elt->{name} =~ /^($propitems_re)-font$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | my $f = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | ▶ | if ( defined $elt->{value} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | my ( $fn, $sz ) = $elt->{value} =~ /^(.*) (\d+(?:\.\d+)?)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | ▶ | $fn //= $elt->{value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$fn //= $elt->{"value"}
MC/DC0%0/2
$fn //= $elt->{"value"}
$fn
$elt->{"value"}
Truth table0%0/3
A //= B
A= $fnB= $elt->{"value"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 0 | ▶ | if ( $fn =~ m;/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$fn =~ m[/]u or $fn =~ /\.(ttf|otf)$/iu
MC/DC0%0/2
$fn =~ m[/]u or $fn =~ /\.(ttf|otf)$/iu
$fn =~ m[/]u
$fn =~ /\.(ttf|otf)$/iu
Truth table0%0/3
A or B
A= $fn =~ m[/]uB= $fn =~ /\.(ttf|otf)$/iu
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | $fn =~ m;\.(ttf|otf)$;i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | delete $ps->{fonts}->{$f}->{description}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | delete $ps->{fonts}->{$f}->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 0 | $ps->{fonts}->{$f}->{file} = $elt->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | # Discard $sz. There will be an {xxxsize} following. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | elsif ( is_corefont( $fn ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 0 | delete $ps->{fonts}->{$f}->{description}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 0 | delete $ps->{fonts}->{$f}->{file}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 0 | $ps->{fonts}->{$f}->{name} = is_corefont($fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | # Discard $sz. There will be an {xxxsize} following. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 0 | delete $ps->{fonts}->{$f}->{file}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 0 | delete $ps->{fonts}->{$f}->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | $ps->{fonts}->{$f}->{description} = $elt->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | # Restore default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | my $sz = $ps->{fonts}->{$1}->{size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | $ps->{fonts}->{$f} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | { %{ $pr->{_df}->{$f} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | # $ps->{fonts}->{$1}->{size} = $sz; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 0 | $pr->init_font($f); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | elsif ( $elt->{name} =~ /^($propitems_re)-color$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | ▶ | if ( defined $elt->{value} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | $ps->{fonts}->{$1}->{color} = $elt->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | # Restore default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | $ps->{fonts}->{$1}->{color} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | $pr->{_df}->{$1}->{color}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 27 | ▶ | if ( $elt->{type} eq "set" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 0 | ▶ | if ( $elt->{name} eq "lyrics-only" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | $lyrics_only = is_true($elt->{value}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 0 | ▶ | unless $lyrics_only > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | elsif ( $elt->{name} eq "gridparams" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | my @v = @{ $elt->{value} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 0 | my $cells; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | my $bars = 8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | $grid_margin = [ 0, 0 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | ▶ | if ( $v[1] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | $cells = $v[0] * $v[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 0 | $bars = $v[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 0 | $cells = $v[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | ▶ | $cells += $grid_margin->[0] = $v[2] if $v[2]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 0 | ▶ | $cells += $grid_margin->[1] = $v[3] if $v[3]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | $grid_margin->[2] = $cells; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | ▶ | if ( $ps->{labels}->{comment} && $v[4] ne "" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ps->{"labels"}{"comment"} and $v[4] ne ""
MC/DC0%0/2
$ps->{"labels"}{"comment"} and $v[4] ne ""
$ps->{"labels"}{"comment"}
$v[4] ne ""
Truth table0%0/3
A and B
A= $ps->{"labels"}{"comment"}B= $v[4] ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | unshift( @elts, { %$elt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | type => $ps->{labels}->{comment}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 0 | text => $v[4], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 0 | redo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | ▶ | $i_tag = $v[4] unless $lyrics_only; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | elsif ( $elt->{name} eq "label" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 0 | ▶ | next if $elt->{context} eq "grid" && $lyrics_only; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$elt->{"context"} eq "grid" and $lyrics_only
MC/DC0%0/2
$elt->{"context"} eq "grid" and $lyrics_only
$elt->{"context"} eq "grid"
$lyrics_only
Truth table0%0/3
A and B
A= $elt->{"context"} eq "grid"B= $lyrics_only
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | ▶ | if ( $ps->{labels}->{comment} && $elt->{value} ne "" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ps->{"labels"}{"comment"} and $elt->{"value"} ne ""
MC/DC0%0/2
$ps->{"labels"}{"comment"} and $elt->{"value"} ne ""
$ps->{"labels"}{"comment"}
$elt->{"value"} ne ""
Truth table0%0/3
A and B
A= $ps->{"labels"}{"comment"}B= $elt->{"value"} ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | unshift( @elts, { %$elt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | type => $ps->{labels}->{comment}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | text => $elt->{value}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 0 | redo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | $i_tag = $elt->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | elsif ( $elt->{name} eq "context" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | $curctx = $elt->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | # Arbitrary pdf config values. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | elsif ( $elt->{name} =~ /^pdf\.(.+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 0 | prpadd2cfg( $ps, $1 => $elt->{value} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | # Arbitrary config values. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | elsif ( $elt->{name} =~ /^(.+)\.(.+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | $config->unlock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | prpadd2cfg( $config, $elt->{name} => $elt->{value} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | $config->lock; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 27 | ▶ | if ( $elt->{type} eq "meta" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 27 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 0 | ▶ | if ( $elt->{type} eq "ignore" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | warn("PDF: Unhandled operator: ", $elt->{type}, " (ignored)\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | continue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 292 | $prev = $elt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 80 | ▶ | if ( $dctl->{show} eq "below" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 0 | $chorddiagrams->( undef, "below"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 80 | my $pages = $page_num - $startpage + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | $newpage->(), $pages++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | if ( $pagectrl->{align_songs_extend} && $pages % 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | && ( $opts->{songindex} < $opts->{numsongs} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 80 | ▶ | || $opts->{forcealign} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition22%2/9
$pagectrl->{"align_songs_extend"} and $pages % 2 and $opts->{"songindex"} < $opts->{"numsongs"} || $opts->{"forcealign"}
$pagectrl->{"align_songs_extend"} and $pages % 2
$opts->{"songindex"} < $opts->{"numsongs"} or $opts->{"forcealign"}
MC/DC0%0/4
$pagectrl->{"align_songs_extend"} and $pages % 2 and $opts->{"songindex"} < $opts->{"numsongs"} || $opts->{"forcealign"}
$pagectrl->{"align_songs_extend"}
$pages % 2
$opts->{"songindex"} < $opts->{"numsongs"}
$opts->{"forcealign"}
Truth table20%1/5
A and B and C or D
A= $pagectrl->{"align_songs_extend"}B= $pages % 2C= $opts->{"songindex"} < $opts->{"numsongs"}D= $opts->{"forcealign"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | # Now for the page headings and footers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 80 | $page_num = $opts->{page_num} - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 80 | $page_idx = $opts->{page_idx} - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 80 | $s->{meta}->{pages} = [ $pages ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 80 | for my $p ( 1 .. $pages ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 105 | $page_num++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 105 | $page_idx++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | warn( "page: $page_num($page_idx), ", $s->{meta}->{title}->[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | ", ", plural($pages," page"), "\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 105 | ▶ | if $config->{debug}->{pages} & 0x01; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 105 | $pr->openpage($page_idx); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | # Put titles and footer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | # If even/odd pages, leftpage signals whether the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | # header/footer parts must be swapped. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 105 | my $rightpage = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 105 | ▶ | if ( $pagectrl->{dual_pages} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 95 | $rightpage = is_odd($page_num); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 105 | ▶ | $s->{meta}->{'page.side'} = $rightpage ? "right" : "left"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | # margin* are offsets from the edges of the paper. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | # _*margin are offsets taking even/odd pages into account. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | 105 | ▶ | if ( $rightpage ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 71 | $ps->{_leftmargin} = $ps->{marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | 71 | $ps->{_rightmargin} = $ps->{marginright}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 34 | $ps->{_leftmargin} = $ps->{marginright}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | 34 | $ps->{_rightmargin} = $ps->{marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | # _margin* are physical coordinates, taking even/odd pages into account. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 105 | $ps->{_marginleft} = $ps->{_leftmargin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 105 | $ps->{_marginright} = $ps->{papersize}->[0] - $ps->{_rightmargin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 105 | $ps->{_marginbottom} = $ps->{marginbottom}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 105 | $ps->{_margintop} = $ps->{papersize}->[1] - $ps->{margintop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | # Bottom margin, taking bottom chords into account. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 105 | $ps->{_bottommargin} = $ps->{marginbottom}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | # Physical coordinates; will be adjusted to columns if needed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 105 | $ps->{__leftmargin} = $ps->{_marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 105 | $ps->{__rightmargin} = $ps->{_marginright}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 105 | $ps->{__topmargin} = $ps->{_margintop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 105 | $ps->{__bottommargin} = $ps->{_marginbottom}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | $s->{meta}->{page} = [ $s->{page} = $opts->{roman} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | 105 | ▶ | ? roman($page_num) : $page_num ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | # Determine page class. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 105 | my $class = 2; # default | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 105 | ▶ | if ( $page_num == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 25 | $class = 0; # very first page | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | elsif ( $page_num == $startpage ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 60 | $class = 1; # first of a song | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 105 | $s->{meta}->{'page.class'} = $classes[$class]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | # Remember first page (see below). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 105 | ▶ | $s->{meta}->{'page.first.side'} //= $s->{meta}->{'page.side'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$s->{"meta"}{"page.first.side"} //= $s->{"meta"}{"page.side"}
MC/DC0%0/2
$s->{"meta"}{"page.first.side"} //= $s->{"meta"}{"page.side"}
$s->{"meta"}{"page.first.side"}
$s->{"meta"}{"page.side"}
Truth table66%2/3
A //= B
A= $s->{"meta"}{"page.first.side"}B= $s->{"meta"}{"page.side"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | warn("page: $page_num($page_idx), side = ", $s->{meta}->{'page.side'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | " class = ", $classes[$class], "\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 105 | ▶ | if $::config->{debug}->{pages} & 0x01; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | # Three-part title handlers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 105 | ▶ | my $tpt = sub { tpt( $ps, $class, $_[0], $rightpage, $x, $y, $s ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | 105 | $x = $ps->{__leftmargin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 105 | ▶ | if ( $ps->{headspace} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | warn("Metadata for pageheading: ", ::dump($s->{meta}), "\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | 105 | ▶ | if $config->{debug}->{meta}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 105 | $y = $ps->{_margintop} + $ps->{headspace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 105 | $y -= $pr->font_bl($fonts->{title}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 105 | $y = $tpt->("title"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 105 | $y = $tpt->("subtitle"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 105 | ▶ | if ( $ps->{footspace} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 105 | $y = $ps->{marginbottom} - $ps->{footspace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 105 | $tpt->("footer"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | # This is mainly for debugging/development. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 80 | $s->{meta}->{'page.side'} = delete $s->{meta}->{'page.first.side'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 80 | return $pages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | ▶ | sub prlabel { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prlabel: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 0 | my ( $ps, $label, $x, $y ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | 0 | ▶ | return if $label eq "" || $ps->{_indent} == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$label eq "" or $ps->{"_indent"} == 0
MC/DC0%0/2
$label eq "" or $ps->{"_indent"} == 0
$label eq ""
$ps->{"_indent"} == 0
Truth table0%0/3
A or B
A= $label eq ""B= $ps->{"_indent"} == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 0 | my $align = $ps->{labels}->{align}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 0 | ▶ | my $font= $ps->{fonts}->{label} || $ps->{fonts}->{text}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ps->{'fonts'}{'label'} || $ps->{'fonts'}{'text'}
MC/DC0%0/2
$ps->{'fonts'}{'label'} || $ps->{'fonts'}{'text'}
$ps->{'fonts'}{'label'}
$ps->{'fonts'}{'text'}
Truth table0%0/3
A || B
A= $ps->{'fonts'}{'label'}B= $ps->{'fonts'}{'text'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 0 | ▶ | $font->{size} ||= $font->{fd}->{size}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$font->{"size"} ||= $font->{"fd"}{"size"}
MC/DC0%0/2
$font->{"size"} ||= $font->{"fd"}{"size"}
$font->{"size"}
$font->{"fd"}{"size"}
Truth table0%0/3
A ||= B
A= $font->{"size"}B= $font->{"fd"}{"size"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 0 | $ps->{pr}->setfont($font); # for strwidth. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | # Now we have quoted strings we can have real newlines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | # Split on real and unescaped (old style) newlines. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | 0 | for ( split( /\\n|\n/, $label ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 0 | my $label = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 0 | ▶ | if ( $align eq "right" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | 0 | my $avg_space_width = $ps->{pr}->strwidth("m"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | $ps->{pr}->text( $label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 0 | $x - $avg_space_width - $ps->{pr}->strwidth($label), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | $y, $font ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | elsif ( $align =~ /^cent(?:er|re)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | $ps->{pr}->text( $label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | 0 | $x - $ps->{_indent} + $ps->{pr}->strwidth($label)/2, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | $y, $font ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | $ps->{pr}->text( $label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 0 | $x - $ps->{_indent}, $y, $font ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 0 | $y -= $font->{size} * 1.2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | # Propagate markup entries over the fragments so that each fragment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | # is properly terminated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 338 | ▶ | sub defrag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
defrag: called CC=11 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | 338 | my ( $frag ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 338 | my @stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | my @res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | 338 | foreach my $f ( @$frag ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 556 | my @a = split( /(<.*?>)/, $f ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 556 | ▶ | if ( @stack ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 2 | unshift( @a, @stack ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 2 | @stack = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 556 | my @r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 556 | foreach my $a ( @a ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 515 | ▶ | if ( $a =~ m;^<\s*/\s*(\w+)(.*)>$; ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 3 | my $k = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | #$a =~ s/\b //g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | #$a =~ s/ \b//g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | 3 | ▶ | if ( @stack ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | 3 | ▶ | if ( $stack[-1] =~ /^<\s*$k\b/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | 3 | pop(@stack); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | 0 | warn("Markup error: \"@$frag\"\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | " Closing <$k> but $stack[-1] is open\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 0 | warn("Markup error: \"@$frag\"\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | " Closing <$k> but no markup is open\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | elsif ( $a =~ m;^<\s*(\w+)(.*)>$; ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 6 | my $k = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 6 | my $v = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | # Do not push if self-closed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 6 | ▶ | push( @stack, "<$k$v>" ) unless $v =~ m;/\s*$;; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | 515 | push( @r, $a ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 556 | ▶ | if ( @stack ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 2 | push( @r, map { my $t = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | 3 | $t =~ s;^<\s*(\w+).*;</$1>;; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 3 | $t; } reverse @stack ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 556 | push( @res, join("", @r ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | 338 | ▶ | if ( @stack ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | 0 | warn("Markup error: \"@$frag\"\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | 0 | " Unclosed markup: @{[ reverse @stack ]}\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | #warn("defrag: ", join('', @res), "\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 338 | \@res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 141 | ▶ | sub songline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
songline: called CC=61 SCAR=70.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 141 | my ( $elt, $x, $ytop, $ps, %opts ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | # songline draws text in boxes as follows: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | # +------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | # | C F G | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | # | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | # +------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | # | Lyrics text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | # +------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | # Variants are: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | # +------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | # | Lyrics text (lyrics-only, or single-space and no chords) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | # +------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | # Likewise comments and tabs (which may have different fonts / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | # decorations). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | # And: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | # +-----------------------+------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | # | Lyrics text | C F G | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | # +-----------------------+------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | # Note that printing text involves baselines, and that chords | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | # may have a different height than lyrics. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | # To find the upper/lower extents, the ratio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | # $font->ascender / $font->descender | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | # can be used. E.g., a font of size 16 with descender -250 and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | # ascender 750 must be drawn at 12 points under $ytop. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | 141 | my $pr = $ps->{pr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | 141 | my $fonts = $ps->{fonts}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | 141 | my $type = $elt->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | 141 | my $ftext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | my $ytext; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | 141 | my @phrases = @{ defrag( $elt->{phrases} ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 141 | ▶ | if ( $type =~ /^comment/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 0 | ▶ | $ftext = $elt->{font} || $fonts->{$type} || $fonts->{comment}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$elt->{'font'} || $fonts->{$type} || $fonts->{'comment'}
$elt->{"font"} or $fonts->{$type}
MC/DC0%0/3
$elt->{'font'} || $fonts->{$type} || $fonts->{'comment'}
$elt->{"font"}
$fonts->{$type}
$fonts->{'comment'}
Truth table0%0/4
A or B || C
A= $elt->{"font"}B= $fonts->{$type}C= $fonts->{'comment'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | 0 | $ytext = $ytop - $pr->font_bl($ftext); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | my $song = $opts{song}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 0 | ▶ | $x += $opts{indent} if $opts{indent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | 0 | ▶ | $x += $elt->{indent} if $elt->{indent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 0 | pr_label_maybe( $ps, $x, $ytext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | 0 | my $t = $elt->{text}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 0 | ▶ | if ( $elt->{chords} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 0 | $t = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 0 | my @ph = @{ $elt->{phrases} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | 0 | for ( @{ $elt->{chords} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | 0 | my $chord = $_; # prevent chord clobber in 2pass mode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | 0 | ▶ | if ( $chord eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | 0 | $chord = $chord->chord_display; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | 0 | $t .= $chord . shift(@ph); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 0 | my ( $text, $ex ) = wrapsimple( $pr, $t, $x, $ftext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | 0 | $pr->text( $text, $x, $ytext, $ftext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 0 | my $wi = $pr->strwidth( $config->{settings}->{wrapindent} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | 0 | ▶ | return $ex ne "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | ? { %$elt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | indent => $wi, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | text => $ex, chords => undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 141 | ▶ | if ( $type eq "tabline" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 0 | $ftext = $fonts->{tab}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 0 | $ytext = $ytop - $pr->font_bl($ftext); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | 0 | ▶ | $x += $opts{indent} if $opts{indent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 0 | pr_label_maybe( $ps, $x, $ytext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 0 | $pr->text( $elt->{text}, $x, $ytext, $ftext, undef, "no markup" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | # assert $type eq "songline"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 141 | ▶ | $ftext = $fonts->{ $elt->{context} eq "chorus" ? "chorus" : "text" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 141 | $ytext = $ytop - $pr->font_bl($ftext); # unless lyrics AND chords | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 141 | my $fchord = $fonts->{chord}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | 141 | my $ychord = $ytop - $pr->font_bl($fchord); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | # Just print the lyrics if no chords. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 141 | ▶ | if ( $lyrics_only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$lyrics_only or $suppress_empty_chordsline and not has_visible_chords($elt)
$suppress_empty_chordsline and not has_visible_chords($elt)
MC/DC33%1/3
$lyrics_only or $suppress_empty_chordsline and not has_visible_chords($elt)
$lyrics_only
$suppress_empty_chordsline
not has_visible_chords($elt)
Truth table50%2/4
A or B and not(C)
A= $lyrics_onlyB= $suppress_empty_chordslineC= not has_visible_chords($elt)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | $suppress_empty_chordsline && !has_visible_chords($elt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 60 | my $x = $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | 60 | ▶ | $x += $opts{indent} if $opts{indent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | 60 | ▶ | $x += $elt->{indent} if $elt->{indent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 60 | pr_label_maybe( $ps, $x, $ytext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 60 | my ( $text, $ex ) = wrapsimple( $pr, join( "", @phrases ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | $x, $ftext ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 60 | $pr->text( $text, $x, $ytext, $ftext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | 60 | my $wi = $pr->strwidth( $config->{settings}->{wrapindent} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 60 | ▶ | return $ex ne "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | ? { %$elt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | indent => $wi, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | phrases => [$ex] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 81 | ▶ | if ( $chordscol || $inlinechords ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$chordscol or $inlinechords
MC/DC0%0/2
$chordscol or $inlinechords
$chordscol
$inlinechords
Truth table33%1/3
A or B
A= $chordscolB= $inlinechords
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 0 | ▶ | $ytext = $ychord if $ytext > $ychord; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | 0 | $ychord = $ytext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | elsif ( $chordsunder ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | 0 | ( $ytext, $ychord ) = ( $ychord, $ytext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | # Adjust lyrics baseline for the chords. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | $ychord -= $ps->{fonts}->{text}->{size} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | 0 | * $ps->{spacing}->{lyrics}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | # Adjust lyrics baseline for the chords. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | $ytext -= $ps->{fonts}->{chord}->{size} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | 81 | * $ps->{spacing}->{chords}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | 81 | ▶ | $elt->{chords} //= [ '' ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$elt->{"chords"} //= [""]
MC/DC0%0/1
$elt->{"chords"} //= [""]
$elt->{"chords"}
Truth table50%1/2
A
A= $elt->{"chords"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | 81 | ▶ | $x += $elt->{indent} if $elt->{indent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | 81 | my $chordsx = $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 81 | ▶ | $chordsx += $ps->{chordscolumn} if $chordscol; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 81 | ▶ | if ( $chordsx < 0 ) { #### EXPERIMENTAL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 0 | ($x, $chordsx) = (-$chordsx, $x); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 81 | ▶ | $x += $opts{indent} if $opts{indent}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | # How to embed the chords. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | 81 | ▶ | if ( $inlinechords ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 0 | ▶ | $inlinechords = '[%s]' unless $inlinechords =~ /%[cs]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 0 | $ychord = $ytext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 81 | my @chords; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 81 | my $n = $#{$elt->{chords}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 81 | foreach my $i ( 0 .. $n ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | 162 | my $chord = $elt->{chords}->[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | 162 | my $phrase = $phrases[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | 162 | ▶ | if ( $chordscol && $chord ne "" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$chordscol and $chord ne ""
MC/DC0%0/2
$chordscol and $chord ne ""
$chordscol
$chord ne ""
Truth table33%1/3
A and B
A= $chordscolB= $chord ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 0 | ▶ | if ( $chordscapo ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | $pr->text(fmt_subst( $opts{song}, $ps->{capoheading} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | $chordsx, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | $ytext + $ftext->{size} * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | $ps->{spacing}->{chords}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | 0 | $fonts->{chord} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | 0 | undef $chordscapo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | # Underline the first word of the phrase, to indicate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | # the actual chord position. Skip leading non-letters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | 0 | ▶ | $phrase = " " if $phrase eq ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | # This may screw up in some markup situations. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | 0 | my ( $pre, $word, $rest ) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | $phrase =~ /^((?:\<[^>]*?\>|\W)+)?(\w+)(.+)?$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | # This should take case of most cases... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | 0 | ▶ | unless ( $i == $n || defined($rest) && $rest !~ /^\</ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$i == $n or defined $rest and not $rest =~ /^\</u
defined $rest and not $rest =~ /^\</u
MC/DC0%0/3
$i == $n or defined $rest and not $rest =~ /^\</u
$i == $n
defined $rest
not $rest =~ /^\</u
Truth table0%0/4
A or B and not(C)
A= $i == $nB= defined $restC= not $rest =~ /^\</u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | 0 | ▶ | $rest = chop($word) . ($rest//""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$rest // ""
MC/DC0%0/1
$rest // ""
$rest
Truth table0%0/2
A
A= $rest
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 0 | ▶ | $phrase = ($pre//"") . "<u>" . $word . "</u>" . ($rest//""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$pre // ""
$rest // ""
MC/DC0%0/1
$pre // ""
$pre
MC/DC0%0/1
$rest // ""
$rest
Truth table0%0/2
A
A= $pre
Truth table0%0/2
A
A= $rest
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | # Print the text. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 0 | pr_label_maybe( $ps, $x, $ytext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 0 | $x = $pr->text( $phrase, $x, $ytext, $ftext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | # Collect chords to be printed in the side column. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 0 | $chord = $chord->chord_display; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | 0 | push( @chords, $chord ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | 162 | my $xt0 = $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | 162 | my $font = $fchord; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 162 | ▶ | if ( $chord ne '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | 162 | my $ch = $chord->chord_display; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | 162 | my $dp = $ch . " "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | 162 | ▶ | if ( $chord->info->is_annotation ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 0 | $font = $fonts->{annotation}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | 0 | ▶ | ( $dp = $inlineannots ) =~ s/%[cs]/$ch/g | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | if $inlinechords; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | elsif ( $inlinechords ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | 0 | ( $dp = $inlinechords ) =~ s/%[cs]/$ch/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | 162 | $xt0 = $pr->text( $dp, $x, $ychord, $font ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | # Do not indent chorus labels (issue #81). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 162 | pr_label_maybe( $ps, $x-$opts{indent}, $ytext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 162 | ▶ | if ( $inlinechords ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 0 | $x = $pr->text( $phrase, $xt0, $ytext, $ftext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | 162 | my $xt1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 162 | ▶ | if ( $phrase =~ /^\s+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 0 | $xt1 = $xt0 + length($phrase) * $pr->strwidth(" ",$ftext); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | # $xt1 = $pr->text( "n" x length($phrase), $xt0, $ytext, $ftext ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | 162 | $xt1 = $pr->text( $phrase, $x, $ytext, $ftext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 162 | ▶ | if ( $xt0 > $xt1 ) { # chord is wider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | # Do we need to insert a split marker? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 0 | ▶ | if ( $i < $n | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$i < $n and not demarkup($phrase) =~ /\s$/u and not demarkup($phrases[$i + 1]) =~ /^\s/u and my $marker = $ps->{"split-marker"}
$i < $n and not demarkup($phrase) =~ /\s$/u and not demarkup($phrases[$i + 1]) =~ /^\s/u
$i < $n and not demarkup($phrase) =~ /\s$/u
MC/DC0%0/4
$i < $n and not demarkup($phrase) =~ /\s$/u and not demarkup($phrases[$i + 1]) =~ /^\s/u and my $marker = $ps->{"split-marker"}
$i < $n
not demarkup($phrase) =~ /\s$/u
not demarkup($phrases[$i + 1]) =~ /^\s/u
my $marker = $ps->{"split-marker"}
Truth table0%0/5
A and not(B) and not(C) and D
A= $i < $nB= not demarkup($phrase) =~ /\s$/uC= not demarkup($phrases[$i + 1]) =~ /^\s/uD= my $marker = $ps->{"split-marker"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | && demarkup($phrase) !~ /\s$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | && demarkup($phrases[$i+1]) !~ /^\s/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | # And do we have one? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | && ( my $marker = $ps->{'split-marker'} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | # Marker has 3 parts: start, repeat, and final. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | # final is always printed, last. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | # start is printed if there is enough room. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | # repeat is printed repeatedly to fill the rest. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | 0 | ▶ | $marker = [ $marker, "", "" ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | unless is_arrayref($marker); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | # Reserve space for final. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | 0 | my $w = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | 0 | $pr->setfont($ftext); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | 0 | ▶ | $w = $pr->strwidth($marker->[2]) if $marker->[2]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | 0 | $xt0 -= $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | # start or repeat (if no start). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | 0 | ▶ | my $m = $marker->[0] || $marker->[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$marker->[0] || $marker->[1]
MC/DC0%0/2
$marker->[0] || $marker->[1]
$marker->[0]
$marker->[1]
Truth table0%0/3
A || B
A= $marker->[0]B= $marker->[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 0 | $x = $xt1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | 0 | ▶ | $x = $xt0 unless $m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | 0 | ▶ | while ( $x < $xt0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 0 | $x = $pr->text( $m, $x, $ytext, $ftext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | # After the first, use repeat. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 0 | $m = $marker->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | 0 | ▶ | $x = $xt0, last unless $m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | # Print final. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | 0 | ▶ | if ( $w ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 0 | $x = $pr->text( $marker->[2], $x, $ytext, $ftext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | # Adjust the position for the chord and spit marker width. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 0 | ▶ | $x = $xt0 if $xt0 > $x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | # Use lyrics width. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | 162 | $x = $xt1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | # Print side column with chords, if any. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 81 | ▶ | $pr->text( join(", ", @chords), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | $chordsx, $ychord, $fchord ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | if @chords; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | 81 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 0 | ▶ | sub imageline_vsp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
imageline_vsp: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | 0 | ▶ | sub imageline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
imageline: not called CC=76 SCAR=86.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 0 | my ( $elt, $x, $ps, $gety ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 0 | my $x0 = $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 0 | my $pr = $ps->{pr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 0 | my $id = $elt->{id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 0 | my $asset = $assets->{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | 0 | ▶ | unless ( $asset ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | 0 | warn("Line " . $elt->{line} . ", Undefined image id: \"$id\"\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | 0 | ▶ | my $opts = { %{$asset->{opts}//{}}, %{$elt->{opts}//{}} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$asset->{"opts"} // {}
$elt->{"opts"} // {}
MC/DC0%0/1
$asset->{"opts"} // {}
$asset->{"opts"}
MC/DC0%0/1
$elt->{"opts"} // {}
$elt->{"opts"}
Truth table0%0/2
A
A= $asset->{"opts"}
Truth table0%0/2
A
A= $elt->{"opts"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | 0 | my $img = $asset->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | 0 | my $label = $opts->{label}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | 0 | ▶ | my $anchor = $opts->{anchor} //= "float"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opts->{"anchor"} //= "float"
MC/DC0%0/1
$opts->{"anchor"} //= "float"
$opts->{"anchor"}
Truth table0%0/2
A
A= $opts->{"anchor"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | 0 | my $allpages = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | 0 | ▶ | if ( $anchor eq "allpages" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | 0 | $anchor = "page"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | 0 | $allpages = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 0 | my $width = $opts->{width}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | 0 | my $height = $opts->{height}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | 0 | my $avwidth = $asset->{vwidth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | 0 | my $avheight = $asset->{vheight}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | 0 | ▶ | my $scalex = $asset->{opts}->{design_scale} || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$asset->{'opts'}{'design_scale'} || 1
MC/DC0%0/1
$asset->{'opts'}{'design_scale'} || 1
$asset->{'opts'}{'design_scale'}
Truth table0%0/2
A
A= $asset->{'opts'}{'design_scale'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | 0 | my $scaley = $scalex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | 0 | ▶ | unless ( $img ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | 0 | return "Unhandled image type: asset=$id"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | 0 | ▶ | if ( $assets->{$id}->{multi} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | 0 | $elt->{multi} = $assets->{$id}->{multi}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | 0 | ▶ | if ( $elt->{msel} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | 0 | for ( $assets->{$id}->{multi}->[$elt->{msel}] ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 0 | $img = $_->{xo}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | # Take vwidth/vheight from subimage. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | 0 | $avwidth = $_->{vwidth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | 0 | $avheight = $_->{vheight}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | 0 | $width = $height = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | 0 | $label = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | # Available width and height. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | 0 | my ( $pw, $ph ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | 0 | ▶ | if ( $anchor eq "paper" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | 0 | ( $pw, $ph ) = @{$ps->{papersize}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | 0 | ▶ | if ( $ps->{columns} > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | $pw = $ps->{columnoffsets}->[1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | - $ps->{columnoffsets}->[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 0 | - $ps->{columnspace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | # $pw = $ps->{__rightmargin} - $ps->{_leftmargin}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | # See issue #428. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | 0 | $pw = $ps->{_marginright} - $ps->{_leftmargin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | 0 | $ph = $ps->{_margintop} - $ps->{_marginbottom}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | 0 | ▶ | $pw -= $ps->{_indent} if $anchor eq "float"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | 0 | ▶ | if ( $width && $width =~ /^(\d+(?:\.\d+)?)\%$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$width and $width =~ /^(\d+(?:\.\d+)?)\%$/u
MC/DC0%0/2
$width and $width =~ /^(\d+(?:\.\d+)?)\%$/u
$width
$width =~ /^(\d+(?:\.\d+)?)\%$/u
Truth table0%0/3
A and B
A= $widthB= $width =~ /^(\d+(?:\.\d+)?)\%$/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | 0 | $width = $1/100 * $pw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 0 | ▶ | if ( $height && $height =~ /^(\d+(?:\.\d+)?)\%$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$height and $height =~ /^(\d+(?:\.\d+)?)\%$/u
MC/DC0%0/2
$height and $height =~ /^(\d+(?:\.\d+)?)\%$/u
$height
$height =~ /^(\d+(?:\.\d+)?)\%$/u
Truth table0%0/3
A and B
A= $heightB= $height =~ /^(\d+(?:\.\d+)?)\%$/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | 0 | $height = $1/100 * $ph; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | 0 | ▶ | my ( $w, $h ) = ( $width || $avwidth || $img->width, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/12
$width || $avwidth || $img->width
$width or $avwidth
$height || $avheight || $img->height
$height or $avheight
MC/DC0%0/3
$width || $avwidth || $img->width
$width
$avwidth
$img->width
MC/DC0%0/3
$height || $avheight || $img->height
$height
$avheight
$img->height
Truth table0%0/4
A or B || C
A= $widthB= $avwidthC= $img->width
Truth table0%0/4
A or B || C
A= $heightB= $avheightC= $img->height
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | $height || $avheight || $img->height ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | # Scale proportionally if width xor height was explicitly requested. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | 0 | ▶ | if ( $width && !$height ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$width and not $height
MC/DC0%0/2
$width and not $height
$width
not $height
Truth table0%0/3
A and not(B)
A= $widthB= not $height
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 0 | ▶ | $h = $width / ($avwidth || $img->width) * ($avheight || $img->height); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$avwidth || $img->width
$avheight || $img->height
MC/DC0%0/2
$avwidth || $img->width
$avwidth
$img->width
MC/DC0%0/2
$avheight || $img->height
$avheight
$img->height
Truth table0%0/3
A || B
A= $avwidthB= $img->width
Truth table0%0/3
A || B
A= $avheightB= $img->height
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | ▶ | elsif ( !$width && $height ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $width and $height
MC/DC0%0/2
not $width and $height
not $width
$height
Truth table0%0/3
not(A) and B
A= not $widthB= $height
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 0 | ▶ | $w = $height / ($avheight || $img->height) * ($avwidth || $img->width); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$avheight || $img->height
$avwidth || $img->width
MC/DC0%0/2
$avheight || $img->height
$avheight
$img->height
MC/DC0%0/2
$avwidth || $img->width
$avwidth
$img->width
Truth table0%0/3
A || B
A= $avheightB= $img->height
Truth table0%0/3
A || B
A= $avwidthB= $img->width
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | 0 | ▶ | if ( $w > $pw ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | 0 | $scalex = $pw / $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | 0 | ▶ | if ( $h*$scalex > $ph ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | 0 | $scalex = $ph / $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | 0 | $scaley = $scalex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | 0 | ▶ | if ( $opts->{scale} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | 0 | my @s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | 0 | ▶ | if ( is_arrayref( $opts->{scale} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | 0 | @s = @{$opts->{scale}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | 0 | for ( split( /,/, $opts->{scale} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | 0 | ▶ | $_ = $1 / 100 if /^([\d.]+)\%$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | 0 | push( @s, $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | 0 | ▶ | push( @s, $s[0] ) unless @s > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 0 | ▶ | carp("Invalid scale attribute: \"$opts->{scale}\" (too many values)\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | unless @s == 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | 0 | $scalex *= $s[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | 0 | $scaley *= $s[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | warn("Image scale: ", pv($scalex), " ", pv($scaley), "\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | 0 | ▶ | if $config->{debug}->{images}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | 0 | $w *= $scalex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 0 | $h *= $scaley; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | 0 | my $align = $opts->{align}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | # If the image is wider than the page width, and scaled to fit, it may | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | # not be centered (https://github.com/ChordPro/chordpro/issues/428#issuecomment-2356447522). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | 0 | ▶ | if ( $w >= $pw ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | 0 | $align = "left"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | 0 | my $ox = $opts->{x}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | 0 | my $oy = $opts->{y}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | # Not sure I like this... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | 0 | ▶ | if ( defined $oy && $oy =~ /base([-+].*)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $oy and $oy =~ /base([-+].*)/u
MC/DC0%0/2
defined $oy and $oy =~ /base([-+].*)/u
defined $oy
$oy =~ /base([-+].*)/u
Truth table0%0/3
A and B
A= defined $oyB= $oy =~ /base([-+].*)/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | 0 | $oy = -$1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | 0 | ▶ | $oy += $opts->{base}*$scaley if $opts->{base}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | 0 | warn("Y: ", $opts->{y}, " BASE: ", $opts->{base}, " -> $oy\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | 0 | ▶ | if ( $anchor eq "float" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | # Note that with indent, the image is aligned to the indented area. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | 0 | ▶ | $align //= ( $opts->{center} // 1 ) ? "center" : "left"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$align //= $opts->{"center"} // 1 ? "center" : "left"
$opts->{"center"} // 1
MC/DC0%0/1
$align //= $opts->{"center"} // 1 ? "center" : "left"
$align
Truth table0%0/2
A
A= $align
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | # Note that image is placed aligned on $x. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | 0 | ▶ | if ( $align eq "center" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | 0 | $x += $pw / 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | elsif ( $align eq "right" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | 0 | $x += $pw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | 0 | ▶ | warn("Image $align: $_[1] -> $x\n") if $config->{debug}->{images}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | 0 | ▶ | $align //= "left"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$align //= "left"
MC/DC0%0/1
$align //= "left"
$align
Truth table0%0/2
A
A= $align
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | # Extra scaling in case the available page width is temporarily | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | # reduced, e.g. due to a right column for chords. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | 0 | my $w_actual = $ps->{__rightmargin}-$ps->{__leftmargin}-$ps->{_indent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | 0 | my $xtrascale = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | 0 | ▶ | if ( $w > $w_actual ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | 0 | $xtrascale = $w_actual / $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | 0 | ▶ | my ( $y, $spaceok ) = $gety->($anchor eq "float" ? $h*$xtrascale : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | # y may have been changed by checkspace. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | 0 | ▶ | if ( !$spaceok && $xtrascale < 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $spaceok and $xtrascale < 1
MC/DC0%0/2
not $spaceok and $xtrascale < 1
not $spaceok
$xtrascale < 1
Truth table0%0/3
not(A) and B
A= not $spaceokB= $xtrascale < 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | # An extra scaled image is flushed to the next page, recalc xtrascale. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | 0 | ▶ | $y = $gety->($anchor eq "float" ? $h : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | $xtrascale = ( $ps->{__rightmargin}-$ps->{_leftmargin} ) / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | 0 | ( $ps->{_marginright}-$ps->{_leftmargin} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | 0 | ▶ | warn("ASSERT: xtrascale = $xtrascale, should be 1\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | unless abs( $xtrascale - 1 ) < 0.01; # fuzz; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | 0 | ▶ | if ( defined ( my $tag = $i_tag // $label ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$i_tag // $label
MC/DC0%0/2
$i_tag // $label
$i_tag
$label
Truth table0%0/3
A // B
A= $i_tagB= $label
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | 0 | $i_tag = $tag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | 0 | my $ftext = $ps->{fonts}->{comment}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | 0 | my $ytext = $y - $pr->font_bl($ftext); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | 0 | pr_label_maybe( $ps, $x0, $ytext ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | 0 | ▶ | my $calc = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | 0 | my ( $l, $r, $t, $b, $mirror ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | 0 | ▶ | my $_ox = $ox // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ox // 0
MC/DC0%0/1
$ox // 0
$ox
Truth table0%0/2
A
A= $ox
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | 0 | ▶ | my $_oy = $oy // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$oy // 0
MC/DC0%0/1
$oy // 0
$oy
Truth table0%0/2
A
A= $oy
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | 0 | $x = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | 0 | $y = $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | 0 | ▶ | if ( $_ox =~ /^([-+]?[\d.]+)\%$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | 0 | $ox = $_ox = $1/100 * ($r - $l) - ( $1/100 ) * $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | 0 | ▶ | if ( $_oy =~ /^([-+]?[\d.]+)\%$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | 0 | $oy = $_oy = $1/100 * ($t - $b) - ( $1/100 ) * $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | 0 | ▶ | if ( $mirror ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | 0 | ▶ | $x = $r - $w if $_ox =~ /^-/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | 0 | ▶ | $y = $b + $h if $_oy =~ /^-/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | 0 | ▶ | if ( $anchor eq "column" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | # Relative to the column. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | 0 | $calc->( @{$ps}{qw( __leftmargin __rightmargin | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | __topmargin __bottommargin )}, 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | elsif ( $anchor eq "page" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | # Relative to the page. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | 0 | $calc->( @{$ps}{qw( _marginleft _marginright | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | __topmargin __bottommargin )}, 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | elsif ( $anchor eq "paper" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | # Relative to the paper. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | 0 | $calc->( 0, $ps->{papersize}->[0], $ps->{papersize}->[1], 0, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | # image is line oriented. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | # See issue #428. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | # $calc->( $x, $ps->{__rightmargin}, $y, $ps->{__bottommargin}, 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | 0 | $calc->( $x, $ps->{_marginright}, $y, $ps->{__bottommargin}, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | warn( pv( "_MR = ", $ps->{_marginright} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | pv( ", _RM = ", $ps->{_rightmargin} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | pv( ", __RM = ", $ps->{__rightmargin} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | pv( ", XS = ", $xtrascale ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | 0 | ▶ | "\n") if $config->{debug}->{x3}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | 0 | ▶ | $x += $ox if defined $ox; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | 0 | ▶ | $y -= $oy if defined $oy; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | 0 | ▶ | if ( $config->{debug}->{images} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | 0 | my $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | 0 | my $scale_x = $w/$img->width * $xtrascale; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | 0 | my $scale_y = $h/$img->height * $xtrascale; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | 0 | ▶ | if ( abs( $scale_x - $scale_y ) < 0.01 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | 0 | $s = sprintf( "%.2f", $scale_x ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | 0 | $s = sprintf( "%.2f,%.2f", $scale_x, $scale_y ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | 0 | ▶ | warn( sprintf("add_image x=%.1f y=%.1f w=%.1f h=%.1f scale=%sx%.1f (%s x%+.1f y%+.1f) %s\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$ox // 0
$oy // 0
MC/DC0%0/1
$ox // 0
$ox
MC/DC0%0/1
$oy // 0
$oy
Truth table0%0/2
A
A= $ox
Truth table0%0/2
A
A= $oy
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | $x, $y, $w, $h, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | $s, $xtrascale, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | $anchor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | $ox//0, $oy//0, $align, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | )); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | $pr->add_object( $img, $x, $y, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | xscale => $w/$img->width * $xtrascale, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | yscale => $h/$img->height * $xtrascale, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | border => $opts->{border} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | maybe bordertrbl => $opts->{bordertrbl}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | valign => $opts->{valign} // "top", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | align => $align, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | maybe href => $opts->{href}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$opts->{'border'} || 0
$opts->{"valign"} // "top"
MC/DC0%0/1
$opts->{'border'} || 0
$opts->{'border'}
MC/DC0%0/1
$opts->{"valign"} // "top"
$opts->{"valign"}
Truth table0%0/2
A
A= $opts->{'border'}
Truth table0%0/2
A
A= $opts->{"valign"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | # For 'allpages' images, remember the calculated results. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | 0 | ▶ | if ( $allpages ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | push( @allpages, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | { img => $img, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | x => $x, y => $y, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | xscale => $w/$img->width * $xtrascale, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | yscale => $h/$img->height * $xtrascale, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | border => $opts->{border} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | maybe bordertrbl => $opts->{bordertrbl}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | valign => $opts->{valign} // "top", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | align => $align, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | maybe href => $opts->{href}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | 0 | ▶ | } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$opts->{'border'} || 0
$opts->{"valign"} // "top"
MC/DC0%0/1
$opts->{'border'} || 0
$opts->{'border'}
MC/DC0%0/1
$opts->{"valign"} // "top"
$opts->{"valign"}
Truth table0%0/2
A
A= $opts->{'border'}
Truth table0%0/2
A
A= $opts->{"valign"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | 0 | ▶ | if ( $anchor eq "float" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | 0 | ▶ | return ($h + ($oy//0)) * $xtrascale; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$oy // 0
MC/DC0%0/1
$oy // 0
$oy
Truth table0%0/2
A
A= $oy
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | 0 | return 0; # vertical size | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | 0 | ▶ | sub imagespread { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
imagespread: not called CC=23 SCAR=63.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | 0 | my ( $si, $x, $y, $ps ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | 0 | my $pr = $ps->{pr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | 0 | my $tag = "id=" . $si->{id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | return "Unknown asset: $tag" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | 0 | ▶ | unless exists( $assets->{$si->{id}} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | 0 | my $asset = $assets->{$si->{id}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | 0 | my $img = $asset->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | 0 | ▶ | return "Unhandled asset: $tag" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | unless $img; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | 0 | my $opts = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | # Available width and height. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | 0 | my $pw = $ps->{_marginright} - $ps->{_marginleft}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | 0 | my $ph = $ps->{_margintop} - $ps->{_marginbottom}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | my ( $w, $h ) = ( $opts->{width} || $img->width, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | 0 | ▶ | $opts->{height} || $img->height ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$opts->{'width'} || $img->width
$opts->{'height'} || $img->height
MC/DC0%0/2
$opts->{'width'} || $img->width
$opts->{'width'}
$img->width
MC/DC0%0/2
$opts->{'height'} || $img->height
$opts->{'height'}
$img->height
Truth table0%0/3
A || B
A= $opts->{'width'}B= $img->width
Truth table0%0/3
A || B
A= $opts->{'height'}B= $img->height
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | # Design scale. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | 0 | ▶ | my $scalex = $asset->{opts}->{scale} || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$asset->{'opts'}{'scale'} || 1
MC/DC0%0/1
$asset->{'opts'}{'scale'} || 1
$asset->{'opts'}{'scale'}
Truth table0%0/2
A
A= $asset->{'opts'}{'scale'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | 0 | my $scaley = $scalex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | 0 | ▶ | if ( $w > $pw ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | 0 | $scalex = $pw / $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | 0 | ▶ | if ( $h*$scalex > $ph ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | 0 | $scalex = $ph / $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | 0 | $scaley = $scalex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | 0 | ▶ | if ( $opts->{scale} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | 0 | my @s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | 0 | ▶ | if ( is_arrayref($opts->{scale}) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | 0 | @s = @{$opts->{scale}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | 0 | for ( split( /,/, $opts->{scale} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | 0 | ▶ | $_ = $1 / 100 if /^([\d.]+)\%$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | 0 | push( @s, $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | 0 | ▶ | push( @s, $s[0] ) unless @s > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | 0 | ▶ | carp("Invalid scale attribute: \"$opts->{scale}\" (too many values)\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | unless @s == 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | 0 | $scalex *= $s[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | 0 | $scaley *= $s[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | 0 | ▶ | warn("Image scale: $scalex $scaley\n") if $config->{debug}->{images}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | 0 | $h *= $scalex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | 0 | $w *= $scaley; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | 0 | my $align = $opts->{align}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | 0 | ▶ | $align //= ( $opts->{center} // 1 ) ? "center" : "left"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$align //= $opts->{"center"} // 1 ? "center" : "left"
$opts->{"center"} // 1
MC/DC0%0/1
$align //= $opts->{"center"} // 1 ? "center" : "left"
$align
Truth table0%0/2
A
A= $align
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | # Note that image is placed aligned on $x. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | 0 | ▶ | if ( $align eq "center" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | 0 | $x += $pw / 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | elsif ( $align eq "right" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | 0 | $x += $pw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | 0 | ▶ | warn("Image $align: $_[1] -> $x\n") if $config->{debug}->{images}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | 0 | ▶ | warn("add_image\n") if $config->{debug}->{images}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | # $pr->add_image( $img, $x, $y, $w, $h, $opts->{border} || 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | $pr->add_object( $img, $x, $y, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | xscale => $w/$img->width, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | yscale => $h/$img->height, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | border => $opts->{border} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | maybe bordertrbl => $opts->{bordertrbl}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | 0 | ▶ | valign => "top", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opts->{'border'} || 0
MC/DC0%0/1
$opts->{'border'} || 0
$opts->{'border'}
Truth table0%0/2
A
A= $opts->{'border'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | align => $align, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | 0 | return $h + $si->{space}; # vertical size | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | 54 | ▶ | sub tocline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tocline: called CC=4 SCAR=14.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | 54 | my ( $elt, $x, $y, $ps ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | 54 | my $pr = $ps->{pr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | 54 | my $fonts = $ps->{fonts}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | 54 | my $y0 = $y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | 54 | my $ftoc = $fonts->{toc}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | 54 | $y -= $pr->font_bl($ftoc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | 54 | $pr->setfont($ftoc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | 54 | my $tpl = $elt->{title}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | 54 | my $lines = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | 54 | my $blines = 0; # lines for break | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | 54 | my $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | 54 | ▶ | my $p = $elt->{pageno} // ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$elt->{"pageno"} // ""
MC/DC0%0/1
$elt->{"pageno"} // ""
$elt->{"pageno"}
Truth table50%1/2
A
A= $elt->{"pageno"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | 54 | my $pw = $pr->strwidth($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | 54 | my $ww = $ps->{__rightmargin} - $x - $pr->strwidth("xxx$p"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | # Formatter sub. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | 54 | ▶ | my $f = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=17.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | 54 | my ( $tpl, $p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | 54 | my $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | 54 | for my $text ( split( /\\n|\n/, $tpl ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | 54 | $lines++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | # Suppress unclosed markup warnings. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | 0 | ▶ | local $SIG{__WARN__} = sub{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | 0 | ▶ | CORE::warn(@_) unless "@_" =~ /Unclosed markup/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | 54 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | # Get the part that fits (hopefully, all) and print. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | 54 | ( $text, my $ex ) = @{ defrag( [ $pr->wrap( $text, $ww ) ] ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | 54 | $pr->text( $text, $x, $y ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | 54 | ▶ | unless ($vsp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | 54 | $ps->{pr}->text( $p, $ps->{__rightmargin} - $pw, $y ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | 54 | $vsp = _vsp("toc", $ps); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | $x += $pr->strwidth( $config->{settings}->{wrapindent} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | 54 | ▶ | if $ex ne ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | 54 | $y -= $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | 54 | ▶ | if ( $ex ne "" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | 0 | $text = $ex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | 0 | redo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | 54 | return $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | 54 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | # First the break, if any. No page number. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | 54 | ▶ | if ( $elt->{break} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | 0 | $vsp = $f->( $elt->{break}, "" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | 0 | $blines = $lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | 0 | $lines = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | # Then the actual content line, with page number. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | 54 | $vsp = $f->( $tpl, $p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | 54 | ▶ | if ( $elt->{page} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | 54 | my $ann = $pr->{pdfpage}->annotation; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | 54 | $ann->link($elt->{page}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | 54 | $ann->rect( $ps->{__leftmargin}, $y0-($blines+$lines)*$vsp, $ps->{__rightmargin}, $y0-$blines*$vsp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | 54 | return $blines + $lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | 282 | ▶ | sub has_visible_chords { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_visible_chords: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | 282 | my ( $elt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | 282 | ▶ | if ( $elt->{chords} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | 162 | for ( @{ $elt->{chords} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | 324 | ▶ | next if defined; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | 0 | warn("Undefined chord in chords: ", ::dump($elt) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | 162 | return join( "", @{ $elt->{chords} } ) =~ /\S/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | 120 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | 0 | ▶ | sub has_visible_text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_visible_text: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | 0 | my ( $elt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | 0 | ▶ | $elt->{phrases} && join( "", @{ $elt->{phrases} } ) =~ /\S/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | 141 | ▶ | sub songline_vsp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
songline_vsp: called CC=12 SCAR=32.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | 141 | my ( $elt, $ps ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | # Calculate the vertical span of this songline. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | 141 | my $fonts = $ps->{fonts}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | 141 | ▶ | if ( $elt->{type} =~ /^comment/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | 0 | ▶ | my $ftext = $fonts->{$elt->{type}} || $fonts->{comment}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$$fonts{$elt->{'type'}} || $fonts->{'comment'}
MC/DC0%0/2
$$fonts{$elt->{'type'}} || $fonts->{'comment'}
$$fonts{$elt->{'type'}}
$fonts->{'comment'}
Truth table0%0/3
A || B
A= $$fonts{$elt->{'type'}}B= $fonts->{'comment'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | 0 | return $ftext->{size} * $ps->{spacing}->{lyrics}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | 141 | ▶ | if ( $elt->{type} eq "tabline" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | 0 | my $ftext = $fonts->{tab}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | 0 | return $ftext->{size} * $ps->{spacing}->{tab}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | # Vertical span of the lyrics and chords. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | # my $vsp = $fonts->{text}->{size} * $ps->{spacing}->{lyrics}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | 141 | my $vsp = text_vsp( $elt, $ps ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | 141 | my $csp = $fonts->{chord}->{size} * $ps->{spacing}->{chords}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | 141 | ▶ | return $vsp if $lyrics_only || $chordscol; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$lyrics_only or $chordscol
MC/DC0%0/2
$lyrics_only or $chordscol
$lyrics_only
$chordscol
Truth table33%1/3
A or B
A= $lyrics_onlyB= $chordscol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | 141 | ▶ | return $vsp if $suppress_empty_chordsline && ! has_visible_chords($elt); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$suppress_empty_chordsline and not has_visible_chords($elt)
MC/DC50%1/2
$suppress_empty_chordsline and not has_visible_chords($elt)
$suppress_empty_chordsline
not has_visible_chords($elt)
Truth table66%2/3
A and not(B)
A= $suppress_empty_chordslineB= not has_visible_chords($elt)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | # No text printing if no text. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | 81 | ▶ | $vsp = 0 if $suppress_empty_lyricsline && join( "", @{ $elt->{phrases} } ) !~ /\S/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$suppress_empty_lyricsline and not join("", @{$elt->{"phrases"};}) =~ /\S/u
MC/DC0%0/2
$suppress_empty_lyricsline and not join("", @{$elt->{"phrases"};}) =~ /\S/u
$suppress_empty_lyricsline
not join("", @{$elt->{"phrases"};}) =~ /\S/u
Truth table33%1/3
A and not(B)
A= $suppress_empty_lyricslineB= not join("", @{$elt->{"phrases"};}) =~ /\S/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | 81 | ▶ | if ( $inlinechords ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | 0 | ▶ | $vsp = $csp if $csp > $vsp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | # We must show chords above lyrics, so add chords span. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | 81 | $vsp += $csp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | 81 | return $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | 321 | ▶ | sub _vsp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_vsp: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | 321 | my ( $eltype, $ps, $sptype ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | 321 | ▶ | $sptype ||= $eltype; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$sptype ||= $eltype
MC/DC0%0/2
$sptype ||= $eltype
$sptype
$eltype
Truth table66%2/3
A ||= B
A= $sptypeB= $eltype
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | # Calculate the vertical span of this element. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | 321 | my $font = $ps->{fonts}->{$eltype}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | 321 | ▶ | confess("Font $eltype has no size!") unless $font->{size}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | 321 | $font->{size} * $ps->{spacing}->{$sptype}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | 18 | ▶ | sub empty_vsp { _vsp( "empty", $_[1] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
empty_vsp: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | 0 | ▶ | sub grid_vsp { _vsp( "grid", $_[1] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grid_vsp: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | 0 | ▶ | sub tab_vsp { _vsp( "tab", $_[1] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tab_vsp: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | 108 | ▶ | sub toc_vsp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toc_vsp: called CC=3 SCAR=11.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | 108 | my $vsp = _vsp( "toc", $_[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | 108 | my $tpl = $_[0]->{title}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | 108 | ▶ | $tpl = $_[0]->{break} . "\\n" . $tpl if $_[0]->{break}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | 108 | my $ret = $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | 108 | ▶ | while ( $tpl =~ /\\n/g ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | 0 | $ret += $vsp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | 108 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2102 | 141 | ▶ | sub text_vsp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_vsp: called CC=5 SCAR=17.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2103 | 141 | my ( $elt, $ps ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2105 | 141 | ▶ | my $ftext = $ps->{fonts}->{ $elt->{context} eq "chorus" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2106 | ? "chorus" : "text" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2107 | 141 | my $layout = $ps->{pr}->{layout}->copy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2108 | 141 | $layout->set_font_description( $ftext->{fd} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2109 | 141 | $layout->set_font_size( $ftext->{size} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2110 | #warn("vsp: ".join( "", @{$elt->{phrases}} )."\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2112 | 141 | my $msg = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2113 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2114 | 0 | ▶ | local $SIG{__WARN__} = sub { $msg .= "@_" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2115 | 141 | $layout->set_markup( join( "", @{$elt->{phrases}} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2117 | 141 | ▶ | if ( $msg && $elt->{line} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$msg and $elt->{"line"}
MC/DC0%0/2
$msg and $elt->{"line"}
$msg
$elt->{"line"}
Truth table33%1/3
A and B
A= $msgB= $elt->{"line"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2118 | 0 | $msg =~ s/^(.*)\n\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2119 | 0 | warn("Line ", $elt->{line}, ", $msg\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2121 | 141 | my $vsp = $layout->get_size->{height} * $ps->{spacing}->{lyrics}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2122 | #warn("vsp $vsp \"", $layout->get_text, "\"\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2123 | # Calculate the vertical span of this line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2125 | 141 | ▶ | _vsp( $elt->{context} eq "chorus" ? "chorus" : "text", $ps, "lyrics" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2128 | 80 | ▶ | sub set_columns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_columns: called CC=16 SCAR=48.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2129 | 80 | my ( $ps, $cols ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2130 | 80 | my @cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2131 | 80 | ▶ | if ( is_arrayref($cols) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2132 | 0 | @cols = @$cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2133 | 0 | $cols = @$cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2135 | 80 | ▶ | unless ( $cols ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2136 | 0 | ▶ | $cols = $ps->{columns} ||= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ps->{"columns"} ||= 1
MC/DC0%0/1
$ps->{"columns"} ||= 1
$ps->{"columns"}
Truth table0%0/2
A
A= $ps->{"columns"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2138 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2139 | 80 | ▶ | $ps->{columns} = $cols ||= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$cols ||= 1
MC/DC0%0/1
$cols ||= 1
$cols
Truth table50%1/2
A
A= $cols
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2142 | my $w = $ps->{papersize}->[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2143 | 80 | - $ps->{_leftmargin} - $ps->{_rightmargin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2144 | 80 | $ps->{columnoffsets} = [ 0 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2146 | 80 | ▶ | if ( @cols ) { # columns with explicit widths | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2147 | 0 | my $stars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2148 | 0 | my $wx = $w + $ps->{columnspace}; # available | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2149 | 0 | for ( @cols ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2150 | 0 | ▶ | if ( !$_ || $_ eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
not $_ or $_ eq "*"
MC/DC0%0/2
not $_ or $_ eq "*"
not $_
$_ eq "*"
Truth table0%0/3
not(A) or B
A= not $_B= $_ eq "*"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2151 | 0 | $stars++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2153 | elsif ( /^(\d+)%$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2154 | 0 | $_ = $1 * $w / 100; # patch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2156 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2157 | 0 | $wx -= $_; # subtract from avail width | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2160 | 0 | ▶ | my $sw = $wx / $stars if $stars; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2161 | 0 | my $l = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2162 | 0 | for ( @cols ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2163 | 0 | ▶ | if ( !$_ || $_ eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $_ or $_ eq "*"
MC/DC0%0/2
not $_ or $_ eq "*"
not $_
$_ eq "*"
Truth table0%0/3
not(A) or B
A= not $_B= $_ eq "*"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2164 | 0 | $l += $sw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2166 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2167 | 0 | $l += $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2169 | 0 | push( @{ $ps->{columnoffsets} }, $l ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2171 | #warn("COL: @{ $ps->{columnoffsets} }\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2172 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2175 | 80 | ▶ | push( @{ $ps->{columnoffsets} }, $w ), return unless $cols > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2177 | 0 | my $d = ( $w - ( $cols - 1 ) * $ps->{columnspace} ) / $cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2178 | 0 | $d += $ps->{columnspace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2179 | 0 | for ( 1 .. $cols-1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2180 | 0 | push( @{ $ps->{columnoffsets} }, $_ * $d ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2182 | 0 | push( @{ $ps->{columnoffsets} }, $w ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2183 | #warn("COL: @{ $ps->{columnoffsets} }\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2186 | 0 | ▶ | sub showlayout { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
showlayout: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2187 | 0 | my ( $ps ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2188 | 0 | my $pr = $ps->{pr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2189 | 0 | my $col = "red"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2190 | 0 | my $lw = 0.5; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2191 | 0 | my $font = $ps->{fonts}->{grid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2193 | 0 | my $mr = $ps->{_rightmargin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2194 | 0 | my $ml = $ps->{_leftmargin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2196 | 0 | ▶ | my $f = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2197 | 0 | my $t = sprintf( "%.1f", shift ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2198 | 0 | $t =~ s/\.0$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2199 | 0 | return $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2200 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2202 | $pr->rectxy( $ml, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2203 | $ps->{marginbottom}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2204 | $ps->{papersize}->[0]-$mr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2205 | $ps->{papersize}->[1]-$ps->{margintop}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2206 | 0 | $lw, undef, $col); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2208 | 0 | my $fsz = 7; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2209 | 0 | my $ptop = $ps->{papersize}->[1]-$ps->{margintop}+$fsz-3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2210 | 0 | $pr->setfont($font,$fsz); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2211 | 0 | $pr->text( "<span color='red'>$ml</span>", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2212 | $ml, $ptop, $font, $fsz ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2213 | 0 | my $t = $f->($ps->{papersize}->[0]-$mr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2214 | $pr->text( "<span color='red'>$t</span>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2215 | 0 | $ps->{papersize}->[0]-$mr-$pr->strwidth("$mr"), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2216 | $ptop, $font, $fsz ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2217 | 0 | $t = $f->($ps->{papersize}->[1]-$ps->{margintop}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2218 | $pr->text( "<span color='red'>$t </span>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2219 | $ml-$pr->strwidth("$t "), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2220 | 0 | $ps->{papersize}->[1]-$ps->{margintop}-2, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2221 | $font, $fsz ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2222 | 0 | $t = $f->($ps->{marginbottom}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2223 | $pr->text( "<span color='red'>$t </span>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2224 | $ml-$pr->strwidth("$t "), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2225 | 0 | $ps->{marginbottom}-2, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2226 | $font, $fsz ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2227 | my @a = ( $ml, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2228 | $ps->{papersize}->[1]-$ps->{margintop}+$ps->{headspace}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2229 | 0 | $ps->{papersize}->[0]-$ml-$mr, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2230 | $lw, $col ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2231 | 0 | $pr->hline(@a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2232 | 0 | $t = $f->($a[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2233 | 0 | $pr->text( "<span color='red'>$t </span>", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2234 | $ml-$pr->strwidth("$t "), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2235 | $a[1]-2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2236 | $font, $fsz ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2237 | 0 | $a[1] = $ps->{marginbottom}-$ps->{footspace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2238 | 0 | $pr->hline(@a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2239 | 0 | $t = $f->($a[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2240 | 0 | $pr->text( "<span color='red'>$t </span>", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2241 | $ml-$pr->strwidth("$t "), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2242 | $a[1]-2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2243 | $font, $fsz ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2245 | 0 | my $spreadimage = $ps->{_spreadimage}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2246 | 0 | ▶ | if ( defined($spreadimage) && !ref($spreadimage) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $spreadimage and not ref $spreadimage
MC/DC0%0/2
defined $spreadimage and not ref $spreadimage
defined $spreadimage
not ref $spreadimage
Truth table0%0/3
A and not(B)
A= defined $spreadimageB= not ref $spreadimage
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2247 | 0 | my $mr = $ps->{marginright}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2248 | 0 | $a[1] = $ps->{papersize}->[1]-$ps->{margintop} - $spreadimage; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2249 | 0 | $a[2] = $ps->{papersize}->[0]-$ml-$mr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2250 | 0 | $pr->hline(@a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2251 | 0 | $t = $f->($a[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2252 | 0 | $pr->text( "<span color='red'>$t </span>", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2253 | $ml-$pr->strwidth("$t "), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2254 | $a[1]-2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2255 | $font, $fsz ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2256 | 0 | $a[0] = $ps->{papersize}->[0]-$mr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2257 | 0 | $a[1] = $ps->{papersize}->[1]-$ps->{margintop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2258 | 0 | $a[2] = $a[1] - $ps->{marginbottom}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2259 | 0 | $pr->vline(@a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2260 | 0 | $t = $f->($a[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2261 | 0 | $pr->text( "<span color='red'>$t </span>", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2262 | $a[0]-$pr->strwidth("$t")/2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2263 | $ptop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2264 | $font, $fsz ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2267 | 0 | my @off = @{ $ps->{columnoffsets} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2268 | 0 | pop(@off); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2269 | 0 | ▶ | @off = ( $ps->{chordscolumn} ) if $chordscol; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2270 | @a = ( undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2271 | $ps->{marginbottom}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2272 | $ps->{margintop}-$ps->{papersize}->[1]+$ps->{marginbottom}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2273 | 0 | $lw, $col ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2274 | 0 | foreach my $i ( 0 .. @off-1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2275 | 0 | ▶ | next unless $off[$i]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2276 | 0 | $a[0] = $f->($ml + $off[$i]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2277 | 0 | $pr->text( "<span color='red'>$a[0]</span>", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2278 | $a[0] - $pr->strwidth($a[0])/2, $ptop, $font, $fsz ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2279 | 0 | $pr->vline(@a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2280 | 0 | $a[0] = $f->($ml + $off[$i] - $ps->{columnspace}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2281 | 0 | $pr->text( "<span color='red'>$a[0]</span>", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2282 | $a[0] - $pr->strwidth($a[0])/2, $ptop, $font, $fsz ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2283 | 0 | $pr->vline(@a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2284 | 0 | ▶ | if ( $ps->{_indent} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2285 | 0 | $a[0] = $ml + $off[$i] + $ps->{_indent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2286 | 0 | $pr->vline(@a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2289 | 0 | ▶ | if ( $ps->{_indent} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2290 | 0 | $a[0] = $ml + $ps->{_indent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2291 | 0 | $pr->vline(@a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2296 | # Get a format string for a given page class and type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2297 | # Page classes have fallbacks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2298 | 315 | ▶ | sub get_format { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_format: called CC=14 SCAR=31.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2299 | 315 | my ( $ps, $class, $type, $rightpage ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2300 | 315 | ▶ | for ( my $i = $class; $i < @classes; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2301 | 365 | $class = $classes[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2302 | 365 | ▶ | next if $class eq 'filler'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2303 | 365 | my $fmt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2304 | 365 | my $swap = !$rightpage; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2305 | 365 | ▶ | if ( !$rightpage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
not $rightpage and exists $ps->{"formats"}{$class . '-even'}{$type}
MC/DC0%0/2
not $rightpage and exists $ps->{"formats"}{$class . '-even'}{$type}
not $rightpage
exists $ps->{"formats"}{$class . '-even'}{$type}
Truth table66%2/3
not(A) and B
A= not $rightpageB= exists $ps->{"formats"}{$class . '-even'}{$type}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2306 | && exists($ps->{formats}->{$class."-even"}->{$type}) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2307 | 0 | $fmt = $ps->{formats}->{$class."-even"}->{$type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2308 | 0 | $swap = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2310 | elsif ( exists($ps->{formats}->{$class}->{$type}) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2311 | 315 | $fmt = $ps->{formats}->{$class}->{$type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2313 | 365 | ▶ | next unless $fmt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2315 | # This should be dealt with in Config... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2316 | 315 | ▶ | $fmt = [ $fmt ] if @$fmt == 3 && !is_arrayref($fmt->[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@$fmt == 3 and not is_arrayref($fmt->[0])
MC/DC0%0/2
@$fmt == 3 and not is_arrayref($fmt->[0])
@$fmt == 3
not is_arrayref($fmt->[0])
Truth table33%1/3
A and not(B)
A= @$fmt == 3B= not is_arrayref($fmt->[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2318 | # Swap left/right for even pages. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2319 | 315 | ▶ | if ( $swap ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2320 | # make a copy! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2321 | 102 | $fmt = [ map { [ reverse @$_ ] } @$fmt ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2324 | 315 | ▶ | if ( $::config->{debug}->{pages} & 0x02 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2325 | warn( "format[$class,$type], ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2326 | $rightpage ? "right" : "left", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2327 | ", swap = ", $swap ? "yes" : "no", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2328 | 0 | ▶ | ", fmt = \"" . join('" "', @{$fmt->[0]}) . "\"\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2330 | 315 | ▶ | return $fmt if $fmt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2332 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2335 | # Three-part titles. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2336 | # Note: baseline printing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2337 | 315 | ▶ | sub tpt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tpt: called CC=15 SCAR=27.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2338 | 315 | my ( $ps, $class, $type, $rightpage, $x, $y, $s ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2339 | 315 | my $fmt = get_format( $ps, $class, $type, $rightpage ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2340 | 315 | ▶ | return unless $fmt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2341 | warn("page: ", $s->{meta}->{page}->[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2342 | ", fmt[", $s->{meta}->{"page.class"}, ",$type] = \"", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2343 | 0 | join('" "',@{$fmt->[0]}), "\"\n" ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2344 | 315 | ▶ | if $::config->{debug}->{pages} & 0x01; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2346 | 315 | my $pr = $ps->{pr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2347 | 315 | my $font = $ps->{fonts}->{$type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2349 | 315 | my $havefont; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2350 | 315 | my $rm = $ps->{papersize}->[0] - $ps->{_rightmargin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2352 | 315 | for my $fmt ( @$fmt ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2353 | 315 | ▶ | if ( @$fmt % 3 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2354 | 0 | die("ASSERT: " . scalar(@$fmt)," part format $class $type"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2357 | # Left part. Easiest. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2358 | 315 | ▶ | if ( $fmt->[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2359 | 44 | my $t = fmt_subst( $s, $fmt->[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2360 | 44 | ▶ | if ( $t ne "" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2361 | 44 | ▶ | $pr->setfont($font) unless $havefont++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2362 | 44 | $pr->text( $t, $x, $y ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2366 | # Center part. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2367 | 315 | ▶ | if ( $fmt->[1] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2368 | 170 | my $t = fmt_subst( $s, $fmt->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2369 | 170 | ▶ | if ( $t ne "" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2370 | 85 | ▶ | $pr->setfont($font) unless $havefont++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2371 | 85 | $pr->text( $t, ($rm+$x-$pr->strwidth($t))/2, $y ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2375 | # Right part. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2376 | 315 | ▶ | if ( $fmt->[2] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2377 | 56 | my $t = fmt_subst( $s, $fmt->[2] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2378 | 56 | ▶ | if ( $t ne "" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2379 | 56 | ▶ | $pr->setfont($font) unless $havefont++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2380 | 56 | $pr->text( $t, $rm-$pr->strwidth($t), $y ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2384 | 315 | ▶ | $y -= $font->{size} * ($ps->{spacing}->{$type} || 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$ps->{'spacing'}{$type} || 1
MC/DC100%1/1
$ps->{'spacing'}{$type} || 1
$ps->{'spacing'}{$type}
Truth table100%2/2
A
A= $ps->{'spacing'}{$type}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2387 | # Return updated baseline. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2388 | 315 | return $y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2391 | 141 | ▶ | sub wrap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap: called CC=19 SCAR=37.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2392 | 141 | my ( $pr, $elt, $x ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2393 | 141 | ▶ | return [ $elt ] unless $::config->{settings}->{wraplines}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2395 | 141 | my $res = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2396 | 141 | ▶ | my @chords = @{ $elt->{chords} // [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$elt->{"chords"} // []
MC/DC100%1/1
$elt->{"chords"} // []
$elt->{"chords"}
Truth table100%2/2
A
A= $elt->{"chords"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2397 | 141 | ▶ | my @phrases = @{ defrag( $elt->{phrases} // [] ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$elt->{"phrases"} // []
MC/DC0%0/1
$elt->{"phrases"} // []
$elt->{"phrases"}
Truth table50%1/2
A
A= $elt->{"phrases"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2398 | 141 | my @rchords; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2399 | my @rphrases; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2400 | 141 | my $m = $pr->{ps}->{__rightmargin}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2401 | my $wi = $pr->strwidth( $config->{settings}->{wrapindent}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2402 | 141 | $pr->{ps}->{fonts}->{text} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2403 | #warn("WRAP x=$x rm=$m w=", $m - $x, "\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2405 | 141 | ▶ | while ( @chords ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2406 | 162 | my $chord = shift(@chords); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2407 | 162 | ▶ | my $phrase = shift(@phrases) // ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift @phrases // ""
MC/DC0%0/1
shift @phrases // ""
shift @phrases
Truth table50%1/2
A
A= shift @phrases
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2408 | 162 | my $ex = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2409 | #warn("wrap x=$x rm=$m w=", $m - $x, " ch=$chord, ph=$phrase\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2411 | 162 | ▶ | if ( @rchords && $chord ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@rchords and $chord
MC/DC50%1/2
@rchords and $chord
@rchords
$chord
Truth table66%2/3
A and B
A= @rchordsB= $chord
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2412 | # Does the chord fit? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2413 | 81 | my $c = $chord->chord_display; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2414 | 81 | my $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2415 | 81 | ▶ | if ( $c =~ /^\*(.+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2416 | 0 | $pr->setfont( $pr->{ps}->{fonts}->{annotation} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2417 | 0 | $c = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2419 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2420 | 81 | $pr->setfont( $pr->{ps}->{fonts}->{chord} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2422 | 81 | $w = $pr->strwidth($c); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2423 | 81 | ▶ | if ( $w > $m - $x ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2424 | # Nope. Move to overflow. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2425 | 0 | $ex = $phrase; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2429 | 162 | ▶ | if ( $ex eq "" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2430 | # Do lyrics fit? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2431 | 162 | my $font = $pr->{ps}->{fonts}->{text}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2432 | 162 | $pr->setfont($font); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2433 | 162 | my $ph; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2434 | 162 | ( $ph, $ex ) = $pr->wrap( $phrase, $m - $x ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2435 | # If it doesn not fit, it is usually a case a bad luck. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2436 | # However, we may be able to move to overflow. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2437 | 162 | my $w = $pr->strwidth($ph); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2438 | 162 | ▶ | if ( $w > $m - $x && @rchords > 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$w > $m - $x and @rchords > 1
MC/DC0%0/2
$w > $m - $x and @rchords > 1
$w > $m - $x
@rchords > 1
Truth table33%1/3
A and B
A= $w > $m - $xB= @rchords > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2439 | 0 | $ex = $phrase; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2441 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2442 | 162 | push( @rchords, $chord ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2443 | 162 | push( @rphrases, $ph ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2444 | 162 | $chord = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2446 | 162 | $x += $w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2449 | 162 | ▶ | if ( $ex ne "" ) { # overflow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2450 | 0 | ▶ | if ( $rphrases[-1] =~ /[[:alpha:]]$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$rphrases[-1] =~ /[[:alpha:]]$/u and $ex =~ /^[[:alpha:]]/u and $chord ne ""
$rphrases[-1] =~ /[[:alpha:]]$/u and $ex =~ /^[[:alpha:]]/u
MC/DC0%0/3
$rphrases[-1] =~ /[[:alpha:]]$/u and $ex =~ /^[[:alpha:]]/u and $chord ne ""
$rphrases[-1] =~ /[[:alpha:]]$/u
$ex =~ /^[[:alpha:]]/u
$chord ne ""
Truth table0%0/4
A and B and C
A= $rphrases[-1] =~ /[[:alpha:]]$/uB= $ex =~ /^[[:alpha:]]/uC= $chord ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2451 | && $ex =~ /^[[:alpha:]]/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2452 | && $chord ne '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2453 | 0 | $rphrases[-1] .= "-"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2455 | 0 | unshift( @chords, $chord ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2456 | 0 | unshift( @phrases, $ex ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2457 | 0 | push( @$res, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2458 | { %$elt, chords => [@rchords], phrases => [@rphrases] } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2459 | 0 | $x = $_[2] + $wi;; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2460 | 0 | ▶ | $res->[-1]->{indent} = $wi if @$res > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2461 | 0 | @rchords = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2462 | 0 | @rphrases = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2465 | 141 | push( @$res, { %$elt, chords => \@rchords, phrases => \@rphrases } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2466 | 141 | ▶ | $res->[-1]->{indent} = $wi if @$res > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2467 | 141 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2470 | 60 | ▶ | sub wrapsimple { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrapsimple: called CC=4 SCAR=15.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2471 | 60 | my ( $pr, $text, $x, $font ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2472 | 60 | ▶ | return ( "", "" ) unless length($text); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2473 | 60 | ▶ | return ( $text, "" ) unless $::config->{settings}->{wraplines}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2475 | 60 | ▶ | $font ||= $pr->{font}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$font ||= $pr->{"font"}
MC/DC0%0/2
$font ||= $pr->{"font"}
$font
$pr->{"font"}
Truth table33%1/3
A ||= B
A= $fontB= $pr->{"font"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2476 | 60 | $pr->setfont($font); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2477 | 60 | $pr->wrap( $text, $pr->{ps}->{__rightmargin} - $x ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2480 | 12 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||