App-Music-ChordPro

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    - To avoid confusion, command line option `--print-default-config`
      will now print the **template** config instead of the **full**
      config. To print the full config, repeat the option.

    - In case of emergency it is now possible to obtain chord brackets
      in lyrics and annotations.

    - Allow name based array access in config augment.

    - Font specifications in the config may now carry (some) properties.
      E.g. `pdf.fonts.comment_box : "sans 12; color=blue; frame=1"`.

    - Command line options `--even-pages-number-left` (`-L`) and
      `--odd-pages-numbers-left` are no longer functional. They did the
      wrong thing anyway. Use [`pdf.songbook`](https://www.chordpro.org/chordpro/chordpro-configuration-pdf/#songbook-pages) in the config file
      instead.

    !Bug Fixes

    - Prevent "settings migrated" dialog if not applicable.
    - Some issues with Unicode filenames on Windows.

Changes  view on Meta::CPAN


0.96	2018-07-11

    - (pp/linux/GNUmakefile) Verify we're running the right perl.
    - Upgrade to App::Packager 1.43.
    - Fix transpose of Asus and Esus chords.
    - Fix issue #47 by Increasing base fret limit to 23.
    - Fix error handling with illegal chord definitions.
    - (wxChordPro) Fix file saving logic.
    - Experimental: Markup for song sections.
    - Experimental: All fonts can have background and frame.

0.95	2018-06-04

    - Add (derived) meta item _key to reflect the actual song key,
      taking capo setting into account.
    - Allow {comment} without background colour.
    - Make {comment_box} box the same colour as its text.
    - Warn if multiple {capo} settings.
    - Fix problem that chords in grids were not transposed.
    - Add value "auto" for pdf.labels.width to automatically reserve

lib/ChordPro/Config.pm  view on Meta::CPAN

    for my $f ( keys %{$cfg->{pdf}->{fonts}} ) {
	next if ref($cfg->{pdf}->{fonts}->{$f}) eq 'HASH';
	for ( $cfg->{pdf}->{fonts}->{$f} ) {
	    my $v = $_;
	    $v =~ s/\s*;\s*$//;
	    my $i = {};

	    # Break out ;xx=yy properties.
	    while ( $v =~ s/\s*;\s*(\w+)\s*=\s*(.*?)\s*(;|$)/$3/ ) {
		my ( $k, $v ) = ( $1, $2 );
		if ( $k =~ /^(colou?r|background|frame|numbercolou?r|size)$/ ) {
		    $k =~ s/colour/color/;
		    $v =~ s/^(['"]?)(.*)\1$/$2/;
		    $i->{$k} = $v;
		}
		else {
		    warn("Unknown font property: $k (ignored)\n");
		}
	    }

	    # Break out size.

lib/ChordPro/Config/Data.pm  view on Meta::CPAN

use JSON::Relaxed::Parser qw();
use feature qw(state);
# Config version.
our $VERSION = 6.081;

sub config {
    state $pp = JSON::XS->new->utf8
	->boolean_values( $JSON::Boolean::false, $JSON::Boolean::true );

    $pp->decode( <<'EndOfJSON' );
{"$schema":"https://chordpro.org/beta/resources/config.schema","a2crd":{"classifier":"pct_chords","infer-titles":true,"tabstop":"8"},"assets":{},"chord-formats":{"common":"%{root|%{}%{qual|%{}}%{ext|%{}}%{bass|/%{}}|%{name}}","nashville":"%{root|%{}%...
EndOfJSON
}

1;

lib/ChordPro/Output/PDF/Configurator.pm  view on Meta::CPAN

	my %ps = "${pdfapi}::Resource::PaperSizes"->get_paper_sizes;
	die("Unhandled paper size: ", $pdf->{papersize}, "\n")
	  unless exists $ps{lc $pdf->{papersize}};
	$pdf->{papersize} = $ps{lc $pdf->{papersize}}
    }

    # Merge properties for derived fonts.
    my $fm = sub {
	my ( $font, $def ) = @_;
	for ( keys %{ $fonts->{$def} } ) {
	    next if /^(?:background|frame)$/;
	    next if $font eq "chordfingers" && $_ eq "size";
	    $fonts->{$font}->{$_} //= $fonts->{$def}->{$_};
	}
    };
    $fm->( qw( subtitle       text     ) );
    $fm->( qw( chorus         text     ) );
    $fm->( qw( comment_italic text     ) );
    $fm->( qw( comment_box    text     ) );
    $fm->( qw( comment        text     ) );
    $fm->( qw( annotation     chord    ) );

lib/ChordPro/Output/PDF/Writer.pm  view on Meta::CPAN

    $y -= $self->{layout}->get_baseline;
    $self->{layout}->show( $x, $y, $self->{pdftext} );

    my $e = $self->{layout}->get_pixel_extents;
    $e->{y} += $e->{height};

    # Handle decorations (background, box).
    my $bgcol = $self->_bgcolor($font->{background});
    undef $bgcol if $bgcol && $bgcol =~ /^no(?:ne)?$/i;
    my $debug = $ENV{CHORDPRO_DEBUG_TEXT} ? "magenta" : undef;
    my $frame = $font->{frame} || $debug;
    undef $frame if $frame && $frame =~ /^no(?:ne)?$/i;
    if ( $bgcol || $frame ) {
	printf("BB: %.2f %.2f %.2f %.2f\n", @{$e}{qw( x y width height ) } )
	  if $debug;
	# Draw background and.or frame.
	my $d = $debug ? 0 : 1;
	$frame = $debug || $font->{color} || $self->{ps}->{theme}->{foreground} if $frame;
	$self->rectxy( $x + $e->{x} - $d,
		       $y + $e->{y} + $d,
		       $x + $e->{x} + $e->{width} + $d,
		       $y + $e->{y} - $e->{height} - $d,
		       0.5, $bgcol, $frame);
    }

    $x += $e->{width};
#    print STDERR ("TX: $x\n");
    return $x;
}

sub setfont {
    my ( $self, $font, $size ) = @_;
    $self->{font} = $font;

lib/ChordPro/Wx/Utils.pm  view on Meta::CPAN

  }
}

################ ################

# Create / update menu bar.
#
# setup_menubar is called by main ctor, update_menubar by the refresh
# methods of main and panels.
# This is intended to be called by a panel, but the actual menu bar is
# attached to the top level frame. The callbacks are routed to the
# methods in the panel, if possible.

use constant
  { M_ALL	=> 0xff,
    M_MAIN	=> 0x01,
    M_EDITOR	=> 0x02,
    M_SONGBOOK	=> 0x04,
  };

push( @EXPORT, qw( M_MAIN M_EDITOR M_SONGBOOK ) );

lib/ChordPro/res/config/chordpro.json  view on Meta::CPAN

{"$schema":"https://chordpro.org/beta/resources/config.schema","a2crd":{"classifier":"pct_chords","infer-titles":true,"tabstop":8},"assets":{},"chord-formats":{"common":"%{root|%{}%{qual|%{}}%{ext|%{}}%{bass|/%{}}|%{name}}","nashville":"%{root|%{}%{q...

lib/ChordPro/res/config/chordpro.rjson  view on Meta::CPAN

        // `size` doesn't matter unless `diagrams.fingers` = `"below"`.
        chordfingers : "sans; numbercolor=background"

        // The font used for comments. If not set, falls back on the `text` font.
        comment : "Helvetica 12; background=foreground-light"

        // The font used for `comment_italic` directives. If not set, falls back on the `chord` font.
        comment_italic : "Helvetica-Oblique 12"

        // The font used for `comment_box` directives. If not set, falls back on the `chord` font.
        comment_box : "Helvetica 12; frame=1"

        // The font used for the contents of tab environments.
        tab : "Courier 10"

        // The font used for the table of contents. If not set, falls back on the `text` font.
        toc : "Times-Roman 11"

        // The font used for grid elements. If not set, falls back on the `chord` font.
        grid : "Helvetica 10"

lib/ChordPro/res/config/config.schema  view on Meta::CPAN

              "description": "Font size."
            },
            "color": {
              "$ref": "#/definitions/color",
              "description": "The colour of the font. See [ChordPro Colours](https://www.chordpro.org/chordpro/chordpro-colours/) for details on colours."
            },
            "background": {
              "$ref": "#/definitions/color",
              "description": "Background color for the element."
            },
            "frame": {
              "description": "A boolean value indicating that a frame (box) should be drawn around the text.\nPrimarily used to specify the thickness of a comment box (`comment_box` directive) via the `comment_box` font, but can be used for any font....
              "oneOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "integer"
                }
              ],
              "enum": [true, false, 0, 1]
            }

lib/ChordPro/res/config/config.schema  view on Meta::CPAN

                        "size": 12
                      },
                      "examples": ["sans italics 12"]
                    },
                    "comment_box": {
                      "$ref": "#/definitions/fontspec",
                      "description": "The font used for `comment_box` directives. If not set, falls back on the `chord` font.",
                      "default": {
                        "name": "Helvetica",
                        "size": 12,
                        "frame": 1
                      },
                      "examples": [
                        {
                          "description": "sans 12",
                          "frame": 1
                        }
                      ]
                    },
                    "grid": {
                      "$ref": "#/definitions/fontspec",
                      "description": "The font used for grid elements. If not set, falls back on the `chord` font.",
                      "default": {
                        "name": "Helvetica",
                        "size": 10
                      },

lib/ChordPro/res/config/config.tmpl  view on Meta::CPAN

// Colour specification.
# pdf.fonts.chordfingers.numbercolor : background

// Font for typesetting comment text.
# pdf.fonts.comment : "sans 12; background=foreground-light"

// Font for typesetting italised comment text.
# pdf.fonts.comment_italic : "Helvetica-Oblique 12"

// Font for typesetting boxed comment text.
# pdf.fonts.comment_box : "sans 12; frame=1"

// Font for typesetting tabs.
# pdf.fonts.tab : "mono 10"

// Font for typesetting the table of contents.
# pdf.fonts.toc : "serif 11"

// Font for typesetting grids.
# pdf.fonts.grid : "sans 10"

lib/ChordPro/res/pod/Config.pod  view on Meta::CPAN

            // `size` doesn't matter unless `diagrams.fingers` = `"below"`.
            chordfingers : "sans; numbercolor=background"
    
            // The font used for comments. If not set, falls back on the `text` font.
            comment : "Helvetica 12; background=foreground-light"
    
            // The font used for `comment_italic` directives. If not set, falls back on the `chord` font.
            comment_italic : "Helvetica-Oblique 12"
    
            // The font used for `comment_box` directives. If not set, falls back on the `chord` font.
            comment_box : "Helvetica 12; frame=1"
    
            // The font used for the contents of tab environments.
            tab : "Courier 10"
    
            // The font used for the table of contents. If not set, falls back on the `text` font.
            toc : "Times-Roman 11"
    
            // The font used for grid elements. If not set, falls back on the `chord` font.
            grid : "Helvetica 10"
    

lib/ChordPro/res/templates/comment.tt  view on Meta::CPAN

\begin{tcolorbox}[colback=gray!30,%gray background
                  colframe=black,% black frame colour
                  width=\textwidth-2cm,% Use 5cm total width,
                  arc=3mm, auto outer arc,
                  size=small]
                \chordsoff [% comment %] 
\end{tcolorbox}

lib/ChordPro/res/templates/guitar_comment.tt  view on Meta::CPAN

\begin{tcolorbox}[colback=gray!30,
                  colframe=black,
                  width=\textwidth-2cm,
                  arc=3mm, auto outer arc,
                  size=small]
                [% comment %] 
\end{tcolorbox}

lib/ChordPro/res/templates/guitar_songbook.tt  view on Meta::CPAN

[% # these variables are obligatory to set 
 newpage_tag = '\newpage' _ "\n"  # _ is concatenate
 emptyline_tag = '\newline'_"\n" 
 columnbreak_tag = "\\par\n" 
 beginchorus_tag =  "\\begin{tcolorbox}[boxrule=0pt,frame hidden,sharp corners,enhanced,borderline west={1pt}{0pt}{black},colback=white]" 
 endchorus_tag = "\\end{tcolorbox}" 
 beginverse_tag = "" 
 endverse_tag = '\newline' 
 beginabc_tag = "\\begin{abc}" 
 endabc_tag = "\\end{abc}" 
 beginlilypond_tag = "\\begin{lilypond}" 
 endlilypond_tag = "\\end{lilypond}" 
 begingrid_tag = "\\begin{singlespace*}\n\\begin{verbatim}" 
 endgrid_tag = "\\end{verbatim}\n\\end{singlespace*}" 
 begintab_tag = "\\begin{singlespace*}\n\\begin{verbatim}" 

lib/ChordPro/res/templates/guitar_songbook.tt  view on Meta::CPAN

\title{my Songbook}
\author{The Author}
\date{\today}
\maketitle

\section{Songbook-chapter} 

[%  FOREACH song IN songs %]
\newpage
\subsection{[% song.title %]}
[% IF song.chords.0 %]\begin{tcolorbox}[colback=white,colframe=black,width=0.75\textwidth,arc=3mm, auto outer arc]
 \chords{
[%  FOREACH chord IN song.chords %]\chord{t}{[% FOREACH fret IN chord.frets.split(''); 
IF fret != 'X'; 
  IF fret != '0';
  'p'; fret; END; 
ELSE; 'x'; 
END;  
IF not loop.last; ','; END;
END; -%]}{[% chord.chord %]} [% elements = loop.count % 5 %][% IF ((elements == 0) and (not loop.last)) %]\newline[% END %][% END %]
 }\end{tcolorbox}[% END %]

lib/ChordPro/res/templates/songbook.tt  view on Meta::CPAN

\begin{songs}{titleidx,authidx,scripidx}
[% FOREACH song IN songs %]
\newpage
\beginsong{[% song.title %][%  FOREACH st IN song.subtitle %] \\ [% st %][%  END %]}
[
  by={[% song.meta.composer.0 %]},
  sr={[% song.meta.lyricist.0 %]},
  cr={[% song.meta.copyright.0 %]},
  index={[% song.meta.index %]}] 
[% IF song.meta.capo.0 %]\capo{[% song.meta.capo.0 %]}[% END %]
[% IF song.chords.0 %]\begin{tcolorbox}[colback=white,colframe=black,width=0.75\textwidth,arc=3mm, auto outer arc]
[%  FOREACH chord IN song.chords %]\gtab{[% chord.chord %]}{[% chord.frets %]}[% elements = loop.count % 5 %][% IF ((elements == 0) and (not loop.last)) %]\newline[% END %][% END %]\end{tcolorbox}[% END %]

[% song.songlines | eval %]
\endsong

[% END %]
\end{songs}

\pagenumbering{Alph}
%\showindex{Index of Authors and Composers}{authidx}

t/380_roundtrip.t  view on Meta::CPAN

	  size = 12
	  background = "#E5E5E5"
      }
      comment_italic {
	  name = "Helvetica-Oblique"
	  size = 12
      }
      comment_box {
	  name = "Helvetica"
	  size = 12
	  frame = 1
      }
      tab {
	  name = "Courier"
	  size = 10
      }
      toc {
	  name = "Times-Roman"
	  size = 11
      }
      grid {



( run in 1.541 second using v1.01-cache-2.11-cpan-e1769b4cff6 )