App-Music-ChordPro
view release on metacpan or search on metacpan
It looks great and behaves nicely in the way macOS applications should
behave. And it doesn't have the restrictions on opening and saving
of files that the 'classic' GUI suffers from.
Thanks Nick!
- ChordPro bundles free replacement fonts to be used instead of
the corefonts. No configs or settings needed.
!Functionality
- (PDF, page sort) Use sorttitle for page sorting.
- Images: Ignore align with x percentage. Issue warning.
- Detection of attributes in labels now requires quoting.
- Handle \u escapes for surrogates and extended chars (\u{...}).
- 'chordpro -A -A -A' will produce runtime info in JSON.
- Add '--convert-config' to convert config to new style.
- Add href property for images.
- New metadata: chordpro, chordpro.version and chordpro.songsource.
- Upgrade JSON::Relaxed to 0.096.
- Upgrade SVGPDF to 0.087. Enables transparent SVG images.
- Add independent horizontal and vertical scaling for images.
Requires Text::Layout 0.037_002.
- Enhance Utils to use signatures to catch call errors.
6.010 2023-06-05
- !ChordPro functionality
- Allow line continuation for input lines using a backslash.
- Allow define chord "|" in config.
- Allow graceful handling of rootless chords.
- Allow simple markup in chords. Yes, this includes grid chords.
- Add flags for preprocessor pattern replacements.
- Allow image scale as a percentage.
- Experimental: Absolute placement for images.
- Experimental: Diagram control in {define}.
- Remove diagrams.auto from config.
- !BugFixes
- Add Pod::Usage to required modules. Some distros seem to have
removed it from the core.
- Add jpeg library to MacOS kit.
- Add some missing files for docs building.
- Fix root relocation when transcoding to a movable system.
- Fix missing parser in {define XX} without frets etc.
This can be top, bottom, right of the first page, and below,
following the last song line.
- Provide song source for unknown chords message.
- Handle UTF-8 encoded filenames correctly.
- Implement in-line printing of chords, config:
settings.inline-chords.
Add style 'inline'.
- Fix problem with font restore after {textfont} cs.
- Fix problem that trailing empty lines were discarded.
- Fix final line discard if input is not newline terminated.
- Fix issue#31 (textsize directive with percentage raises error).
- Fix problem where first empty line was inadvertently ignored.
0.910.1 2017-11-09
- Add style 'modern3'.
0.91 2017-11-09
- Add printing of bars in chord diagrams.
- Allow PDF config "fontdir" to take an array of paths. Also,
lib/ChordPro/Output/PDF.pm view on Meta::CPAN
}
elsif ( $k eq "type" && $v =~ /^(strings?|keyboard)$/ ) {
$ctl{instrument} = $v;
}
elsif ( $k =~ /^(width|height|dx|dy|w|h)$/ ) {
$v = $1 if $v =~ /^(-?[\d.]+)pt$/;
$v = $1 * $ctx->{size} if $v =~ /^(-?[\d.]+)em$/;
$v = $1 * $ctx->{size} / 2 if $v =~ /^(-?[\d.]+)ex$/;
#$v = $1 * $ctx->{size} / 100 if $v =~ /^(-?[\d.]+)\%$/;
if ( $v =~ /^(-?[\d.]+)\%$/ ) {
warn("Invalid img attribute: \"$kk\" (percentage not allowed)\n");
$err++;
}
else {
$ctl{$k} = $v;
}
}
elsif ( $k =~ /^(scale)$/ ) {
my @s;
for ( split( /,/, $v ) ) {
$_ = $1 / 100 if /^([\d.]+)\%$/;
lib/ChordPro/Song.pm view on Meta::CPAN
my $pkg = 'ChordPro::Delegate::' . $a->{delegate};
eval "require $pkg" || warn($@);
if ( my $c = $pkg->can("options") ) {
$opts = $c->($a->{data});
$id = $opts->{id};
}
}
$opts = $a->{opts} = { %$opts, %{$a->{opts}} };
unless ( is_true($opts->{omit}) ) {
if ( $opts->{align} && $opts->{x} && $opts->{x} =~ /\%$/ ) {
do_warn( "Useless combination of x percentage with align (align ignored)" );
delete $opts->{align};
}
my $def = !!$id;
$id //= "_Image".$assetid++;
if ( defined $opts->{spread} ) {
$def++;
if ( exists $self->{spreadimage} ) {
do_warn("Skipping superfluous spread image");
lib/ChordPro/Song.pm view on Meta::CPAN
}
}
return if is_true($opts{omit});
unless ( $uri || $id || $chord ) {
do_warn( "Missing image source\n" );
return;
}
if ( $opts{align} && $opts{x} && $opts{x} =~ /\%$/ ) {
do_warn( "Useless combination of x percentage with align (align ignored)" );
delete $opts{align};
}
# If the image uri does not have a directory, look it up
# next to the song, and then in the images folder of the
# resources.
if ( $uri && CP->is_here($uri) ) {
my $found = CP->siblingres( $diag->{file}, $uri, class => "images" )
|| CP->siblingres( $diag->{file}, $uri, class => "icons" );
if ( $found ) {
lib/ChordPro/lib/SVGPDF.pm view on Meta::CPAN
if ( $cdata =~ /\S/ ) {
$css->read_string($cdata);
}
my $atts = $svg->atts;
# The viewport, llx lly width height.
my $vbox = delete $atts->{viewbox};
# Width and height are the display size of the viewport.
# Resolve em, ex and percentages.
my $vwidth = delete $atts->{width} // 0;
my $vheight = delete $atts->{height} // 0;
for ( $vwidth ) {
$_ = $svg->u( $_, width => $pagesize->[0],
fontsize => $fontsize );
}
for ( $vheight ) {
$_ = $svg->u( $_, width => $pagesize->[1],
fontsize => $fontsize );
}
lib/ChordPro/lib/SVGPDF.pm view on Meta::CPAN
# Set up result forms.
$xoforms->[-1] =
{ xo => $xo,
# Design (desired) width and height.
vwidth => $vwidth || $vb[2],
vheight => $vheight || $vb[3],
# viewBox (SVG coordinates)
vbox => [ @vb ],
width => $vb[2],
height => $vb[3],
# See e.g. https://oreillymedia.github.io/Using_SVG/extras/ch05-percentages.html
diag => sqrt( $vb[2]**2 + $vb[3]**2 ) / sqrt(2),
# bbox (PDF coordinates)
bbox => [ @bb ],
};
# Not sure if this is ever needed.
$xoforms->[-1]->{valign} = $valign if $valign;
# use DDumper; DDumper( { %{$xoforms->[-1]}, xo => 'XO' } );
# <svg> coordinates are topleft down, so translate.
$self->_dbg( "matrix( 1 0 0 -1 0 0)" );
lib/ChordPro/lib/SVGPDF.pm view on Meta::CPAN
=back
The following SVG features are partially implemented.
=over 3
=item *
Percentage units. For most "y", "h" or "height" attributes the result
will be the percentage of the viewBox height.
Similar for "x", "w" and "width".
Everything else will result in a percentage of the viewBox diagonal
(according to the specs).
=item *
Embedded SVG elements and preserveAspectRatio.
=item *
Standalone T-path elements.
lib/ChordPro/lib/SVGPDF/Rect.pm view on Meta::CPAN
$xo->save;
$self->set_graphics;
$self->set_transform($tf) if $tf;
unless ( $rx || $ry ) {
$xo->rectangle( $x, $y, $x+$w, $y+$h );
}
else {
# https://svgwg.org/svg2-draft/shapes.html#RectElement
# Resolve percentages.
if ( $rx ) {
$rx = $1 * $w if $rx =~ /^([-+,\d]+)\%$/;
}
if ( $ry ) {
$ry = $1 * $h if $ry =~ /^([-+,\d]+)\%$/;
}
# Default one to the other.
$rx ||= $ry; $ry ||= $rx;
# Maximize to half of the width/height.
if ( $rx > $w/2 ) {
lib/ChordPro/res/examples/bgdemo.pdf view on Meta::CPAN
%PDF-1.4
%ÆÍ͵
1 0 obj << /Type /Catalog /PageLayout /SinglePage /PageMode /UseNone /Pages 2 0 R /ViewerPreferences << /NonFullScreenPageMode /UseNone >> >> endobj
2 0 obj << /Type /Pages /Count 6 /Kids [ 6 0 R 8 0 R 10 0 R 12 0 R 14 0 R 16 0 R ] /MediaBox [ 0 0 595 842 ] /Resources 3 0 R >> endobj
3 0 obj << /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> endobj
4 0 obj << /Producer (PDF::API2 2.041 [linux]) >> endobj
5 0 obj << /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding << /Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [ 0 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.not...
6 0 obj << /Type /Page /Contents [ 7 0 R ] /Parent 2 0 R /Resources << /Font << /HelvCBA~1646908528 5 0 R >> /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> >> endobj
7 0 obj << /Filter [ /FlateDecode ] /Length 93 >> stream
x
;@PE·rKf÷+=!´ÌBií&·9¹99@V ¶ëís÷±(º&
;¨ò!JËQ¹dg<ì¶1ÌudþbUKè Æ6XP
endstream endobj
8 0 obj << /Type /Page /Contents [ 9 0 R ] /Parent 2 0 R /Resources << /Font << /HelvCBA~1646908528 5 0 R >> /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> >> endobj
9 0 obj << /Filter [ /FlateDecode ] /Length 96 >> stream
x
;@PE·rKg÷)BËÛ¡Q(Ýä4''¹è2PMÛõö]û±(jÁBÈ;Èù¥a(4$âäÏË
ls£çeÍ%ò v
endstream endobj
10 0 obj << /Type /Page /Contents [ 11 0 R ] /Parent 2 0 R /Resources << /Font << /HelvCBA~1646908528 5 0 R >> /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> >> endobj
( run in 0.536 second using v1.01-cache-2.11-cpan-709fd43a63f )