App-Music-ChordPro
view release on metacpan or search on metacpan
lib/ChordPro/res/abc/abc2svg/README.md view on Meta::CPAN
- `script.js` is an optional backend script.
It defaults to `tohtml.js` (HTML+SVG)
- `options` are the ABC options.
For compatibility, the last options are moved before the last ABC file.
These scripts try to read a file `default.abc` at startup time.
This file and also the files included by `%%abc-include` are searched
in the current directory or in the colon separated list of directories
contained in the environment variable `ABCPATH`.
#### 2.2 Backend scripts
By default, the shell scripts generate (HTML+SVG) files.
This output may be modified by backend scripts. These ones must appear
immediately following the name of the shell script.
They are:
- `toabc.js`
This script returns the (selected) ABC tunes from the ABC source file
applying transposition.
The resulting file does not contain the formatting parameters.
Example:
`Â Â Â Â Â Â Â Â abcqjs toabc.js my_file.abc --select X:2 > tune_2.abc`
- `toabw.js`
This script outputs an Abiword file (ABW+SVG) that can be read by some
word processors (abiword, libreoffice...). The word processor allows
you to convert the file to many other formats from a command line.
The abc2svg music font (`abc2svf.woff` or `abc2svg.ttf`) must be installed
in the local system for displaying and/or converting the .abw file.
Example:
`Â Â Â Â Â Â Â Â abcmjs toabw.js my_file.abc > my_file.abw`
- `tomei.js`
This script outputs the music as a [MEI](https://music-encoding.org/) file.
Note, only one tune may be translated from ABC to MEI (multi-tunes ABC files
generate bad MEI files).
- `tonotes.js`
This script outputs a list of the MIDI events.
- `toodt.js`
This script creates an Open Document (ODT+SVG) which can be read by most
word processors (abiword, libreoffice...).
When runs with the shell script `abc2svg`, it asks for the npm module
`jszip` to be installed.
When run with `abcqjs` on unix-like systems, it creates a temporary
directory tree in `/tmp`.
The output ODT document may be specified in the command line argument
after `-o` (default `abc.odt`).
Example:
`Â Â Â Â Â Â Â Â abcqjs toodt.js my_file.abc -o my_file.odt`
- `toparam.js`
This script just outputs the abc2svg parameters.
- `tosvg.js`
This script creates a SVG file that includes all the SVGs of the generation.
The included SVG images are updated for being correctly rendered by tools
that use librsvg, the SVG library for GNOME (feh, viewnior, swayimg...).
#### 2.3 PDF generation
`abctopdf` is a shell script which converts ABC to PDF using one of the
previous shell scripts and, either a chrome/chromium compatible web browser
(settable by the environment variable 'BROWSER'),
or the program [weasyprint](https://weasyprint.org/).
Note also that, with `weasyprint`, the paper size is forced to A4.
Instructions for changing this size may be found in the script source.
The output PDF document may be specified by the command line argument `-o`
(default `abc.pdf`).
Example:
`Â Â Â Â Â Â Â Â abctopdf my_file.abc -o my_file.pdf`
### 3. Build
The abc2svg scripts which are used to render the music
either by a web browser or by a shell script must be built from
the source files you got by tarball or fossil clone.
Quoting [Douglas Crockford](https://www.crockford.com/jsmin.html),
minification is a process that removes comments and unnecessary whitespace from
JavaScript files. It typically reduces file size by half, resulting in
faster downloads.
If you can run one of the tools [ninja](https://ninja-build.org/)
or [samurai](https://github.com/michaelforney/samurai), you can build
the scripts
- without minification
This is useful for debugging purposes and the scripts are more human friendly.
`Â Â Â Â Â Â Â Â NOMIN=1 samu -v`
or
`Â Â Â Â Â Â Â Â NOMIN=1`
`Â Â Â Â Â Â Â Â export NOMIN`
`Â Â Â Â Â Â Â Â ninja -v`
- in a standard way with minification
In this case, you need one of the tools
[JSMin](https://www.crockford.com/jsmin.html) or
`uglifyjs` which comes with nodeJS.
`Â Â Â Â Â Â Â Â samu -v`
If you also want to change or add music glyphs, you may edit the source
file `font/abc2svg.sfd`.
In this case, you will need both `base64` and `fontforge`, and run
`Â Â Â Â Â Â Â Â samu -v font.js`
If you cannot or don't want to install `ninja` or `samurai`, you may build
the abc2svg files by the shell script `./build`.
(This script must be run by a Posix compatible shell.)
( run in 1.404 second using v1.01-cache-2.11-cpan-98e64b0badf )