Changes

Jump to navigation Jump to search
453 bytes added ,  20:16, 8 October 2006
adaptions for module v.2006-10-08
< [[Graphics]] | [[Using Graphics]] >
[http://www.lilypond.org LilyPond] is a great music engraver, and you can include LilyPond in ConTeXt source using [http://modules.contextgarden.net/t-lilypond the lilypond module] (also here: [[Image:T-lilypond.tex]]).
== Setup ==
* First you need a working [http://www.lilypond.org LilyPond] installation (version 2.8+) plus dependencies like GhostScript.* At the moment (2006-10-08), this module doesn't work with the "modern" Ruby scripts (<tt>texmfstart</tt>), but only with the older Perl <tt>texexec</tt>!
* Include the lilypond module
<texcode>
=== options ===
{| style="border: solid 1px black; padding: 0.5em; vertical-align: top; width: 5080%;"
|- style="border: solid 1px black; padding: 0.5em; vertical-align: top; background: #eeeeee;"
! option !! values !! default !! meaning
| staffsize || number (pt) || 20 || height of the staff
|-
| time || yes/no || yes || count the time (i.e. show time signature, draw bars, split the staff)?|-| clef || yes/no || yes || show the clef?
|-
| align || yes/no || depends on fragment || ragged-right = (not align)
| fragment || yes/no || no || typeset only a snippet (instead of a whole line)?
|-
| barnumbers || yes/no || no || show bar measure numbers?|-| seriffont || "name" || "Century Schoolbook L" || serif font (e.g. for Lyrics and \markup)|-| sansfont || "name" || "LMSans10" || sans serif font (e.g. for chords)|-| monofont || "name" || "Bitstream Vera Sans Mono" || monospace font (normally not used)
|}
\stoplilypond
</texcode>
 
== Font hints ==
 
LilyPond depends on the fonts that pango/fontconfig can find. But not even all of those will work, e.g. no fonts from the TeX tree (don't know why), only one face per font file etc.
Therefore it doesn't use ConTeXt's font setup.
 
If you want to know which fonts of your system LilyPond can see with which names, try
lilypond -dshow-available-fonts any
(The 3rd parameter is necessary, but can be anything.)
 
LilyPond's default text font is Century Schoolbook. You can use it in ConTeXt like this:
 
<texcode>
\starttypescript[wiki][songbook]
\usetypescript [serif] [schoolbook] [\defaultencoding]
\definetypeface [songbook] [rm] [serif] [schoolbook] [default] [encoding=\defaultencoding]
\definetypeface [songbook] [ss] [sans] [default][default] [encoding=ec]
\definetypeface [songbook] [tt] [mono] [default][default] [encoding=ec]
\stoptypescript
 
\usetypescript [wiki] [songbook]
\setupbodyfont[songbook, rm, 8.5pt]
</texcode>
 
== Developer's Corner ==
Things that have not been implemented yet include:
* set the text font (default should be ConTeXt's bodyfont instead of LilyPond's)
* make lilypond call back on ConTeXt for included TeX (cf. [http://lsr.dsi.unimi.it/LSR/Item?id=107])
* get information from lilypond about the baseline, for run-in music fragments
* tell lilypond how much space is left on the first page
* check and probably work on proper multi-page music
* LilyPond variables
 
LilyPond uses fontconfig for font search. At least on MacOS X it's very restricted what kind of fonts it can use - only single-style TrueType (including dfont). I didn't manage yet to use fonts from the TeX tree. (That doesn't seem to be fontconfig's fault - it writes appropriate font cache files everywhere.)
To remember:
--[[User:ChristopherCreutzig|Christopher Creutzig]] after ideas by [[User:Hraban|Hraban]]
 
== Tweaks ==
 
At the moment it's not possible to change LilyPond's fonts. The text font is Century Schoolbook. You can use it as ConTeXt's default font like this:
 
<texcode>
\starttypescript[wiki][songbook]
\usetypescript [serif] [schoolbook] [\defaultencoding]
\definetypeface [songbook] [rm] [serif] [schoolbook] [default] [encoding=\defaultencoding]
\definetypeface [songbook] [ss] [sans] [default][default] [encoding=ec]
\definetypeface [songbook] [tt] [mono] [default][default] [encoding=ec]
\stoptypescript
 
\usetypescript [wiki] [songbook]
\setupbodyfont[songbook, rm, 8.5pt]
</texcode>
== Older Workarounds ==
'''Beware: These relate to the old version of the module and older versions of LilyPond(earlier than 2.7)! Nowadays, LilyPond and epstopdf get called via texmfstart, that works without patching!'''
=== LilyPond is not found ===

Navigation menu