diff options
author | Karl Berry <karl@freefriends.org> | 2010-03-13 00:45:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-03-13 00:45:41 +0000 |
commit | 8b0df13bf2b160d1d8909b4c8eefa1458ef21083 (patch) | |
tree | 98a91437e0d338a815a1a37c8f3acbdd8ace5a76 /Master/texmf-dist/tex | |
parent | 9eb31afb3789eabfb19cb98e86ad031df3b880cb (diff) |
context-lilypond update (12mar10)
git-svn-id: svn://tug.org/texlive/trunk@17445 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/context/third/lilypond/t-lilypond.tex | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/Master/texmf-dist/tex/context/third/lilypond/t-lilypond.tex b/Master/texmf-dist/tex/context/third/lilypond/t-lilypond.tex index 4a6b57c67c8..acde63655e8 100644 --- a/Master/texmf-dist/tex/context/third/lilypond/t-lilypond.tex +++ b/Master/texmf-dist/tex/context/third/lilypond/t-lilypond.tex @@ -1,9 +1,9 @@ %D \module %D [ file=t-lilypond, -%D version=2009.06.04, +%D version=2010.03.11, %D title=\CONTEXT\ User Modules, %D subtitle=LilyPond Bridge (Music Typesetting), -%D author={Christopher Creutzig, Henning Hraban Ramm, Mojca Miklavec, Wolfgang Schuster}, +%D author={Christopher Creutzig, H. Ramm et al.}, % , Mojca Miklavec, Wolfgang Schuster %D maintainer={Henning Hraban Ramm, hraban@fiee.net}, %D date=\currentdate, %D copyright=the authors] @@ -24,9 +24,9 @@ %D \NC indent\NC 0pt\NC first line indent \NC\NR %D \NC time\NC yes\NC count time? (i.e. show time signature, set bars, split line) \NC\NR %D \NC clef\NC yes\NC show clef? \NC\NR -%D \NC linewidth\NC \\localhsize\NC \NC\NR +%D \NC linewidth\NC \type{\localhsize}\NC \NC\NR %D \NC betweensystemspace\NC 54pt\NC space between systems \NC\NR -%D \NC height\NC \\textheight\NC \NR +%D \NC height\NC \type{\textheight}\NC \NR %D \NC align\NC ?\NC default depends on fragment=... \NC\NR %D \NC fragment\NC no\NC whole staff line or only snippet? \NC\NR %D \NC barnumbers\NC no\NC show numbers of measures? \NC\NR @@ -40,7 +40,7 @@ %D %D {\bfa Todo list} %D -%D \startitemize +%D \startitemize[packed,joinedup] %D \item Proper support for multipage results. %D \item Set LilyPond page size to remaining page space. %D \item Place instrument names in margin. @@ -147,6 +147,8 @@ /egroup +%D Here, we define our parameters: + \newdimen\lily!linewidth \newdimen\lily!vsize \newdimen\lily!indent @@ -192,21 +194,17 @@ %D %D If you want to know which fonts of your system LilyPond can see %D with which names, try \type{lilypond -dshow-available-fonts any}. -%D (The 3rd parameter is necessary, but can be anything.) +%D (The 3rd parameter is necessary, but can be anything.)\par %D There are a lot of restrictions, e.g. no fonts from the \TeX\ tree (don't know why), %D only one face per font file etc. + %D -%D \type{\startlilypond} is a multistage implementation, because -%D end-of-line characters must be treated specially in the -%D \type{\startlilypond}\textellipsis\type{\stoplilypond} range. +%D Check if temporary and image directories exist and create them if not: %D \def\tmpdir{\@@lilytmpdir} % for intermediate files \def\imgdir{\@@lilyimgdir} % for music PDFs -%D -%D Check if temporary and image directories exist and create them if not: -%D \startluacode if not lfs.isdir("\tmpdir") then logs.report("LilyPond Warn ", "Temporary directory not found, trying to make '\tmpdir'") @@ -218,6 +216,11 @@ end \stopluacode +%D +%D \type{\startlilypond} is a multistage implementation, because +%D end-of-line characters must be treated specially in the +%D \type{\startlilypond} \dots\ \type{\stoplilypond} range. +%D \def\startlilypond {\bgroup @@ -231,14 +234,18 @@ \long\def\dodostartlilypond[#1]#2\stoplilypond {\egroup \bgroup - %D The default of the \type{linewidth} parameter is the local \type{\hsize}. +%D +%D The default of the \type{linewidth} parameter is the local \type{\hsize}. +%D \setlocalhsize \getparameters[\??lily][linewidth=\the\localhsize,height=\the\textheight,#1]% \lily!linewidth\@@lilylinewidth \lily!vsize\@@lilyheight \lily!indent\@@lilyindent \lily!betweensystemspace\@@lilybetweensystemspace - %D The default of \type{align} depends on whether we typeset a fragment: +%D +%D The default of \type{align} depends on whether we typeset a fragment: +%D \doifelse\@@lilyalign\v!yes\lily!aligntrue\lily!alignfalse \doif\@@lilyfragment\v!no{\doif\@@lilyalign{?}\lily!aligntrue}% \doifelse\@@lilytime\v!yes\lily!timetrue\lily!timefalse @@ -247,7 +254,7 @@ \doifelse\@@lilyclef\v!yes\lily!cleftrue\lily!cleffalse %D %D We are using a counter to keep the different LilyPond pieces -%D separate. This allows to typeset them only once, during the +%D separate. This allows to typeset them only once, during the %D first run. %D %D TODO: This won't work any longer once we pass the remaining @@ -255,59 +262,50 @@ %D \doglobal\increment\lily!figures \edef\lily!filename{\bufferprefix lilypond-\lily!figures}% - \edef\lily!tmpfilename{\tmpdir/\bufferprefix lilypond-\lily!figures}% + \edef\lily!tmpfilename{\tmpdir/\lily!filename.tmp}% \edef\lily!img{\imgdir/\lily!filename.pdf} \def\obeyedlines{\string^^J}% \convertargument#2\to\ascii \startexpanded - \noexpand\setbuffer[lilypond-\lily!figures]% + \noexpand\setbuffer[\lily!tmpfilename]% \lily!prefix \letterhash(set-global-staff-size \getvalue{\??lily staffsize})\string^^J% \ifdefined\@@lilyfragment\lily!fragmentprefix\fi - %% TODO: Option "packed" +%D TODO: Option \quote{packed} \ascii \ifdefined\@@lilyfragment\lily!fragmentsuffix\fi \noexpand\endbuffer \stopexpanded %D -%D In Lua\TeX buffers are kept in memory +%D In \LUATEX\ buffers are kept in memory %D in contrast to older flavours of \TeX\ where they're written to a %D file automatically. We have to require writing to a file explicitely %D with \type{\savebuffer}. %D -%D That applies \type{\bufferprefix} automatically, so we can't directly write to our temp directory. -%D -%D At least on Windows, Lua's os.rename won't overwrite existing files, so we need to remove them before. -%D -%D \writestatus{LilyPond}{\lily!filename} \startluacode - buffers.save('lilypond-\lily!figures') - if not lfs.isfile('\lily!filename.tmp') then - logs.report("LilyPond ERROR", "File '\lily!filename.tmp' was not written!") - else - if lfs.isfile('\tmpdir/\lily!filename.tmp') then - os.remove('\tmpdir/\lily!filename.tmp') - end - os.rename('\lily!filename.tmp', '\tmpdir/\lily!filename.tmp') + buffers.save('\lily!tmpfilename') + if not lfs.isfile('\lily!tmpfilename') then + logs.report("LilyPond ERROR", "File '\lily!tmpfilename' was not written!") end %D %D Generating a PDF directly previously created always a whole page, so we generate EPS first. %D In recent versions of LilyPond that gets converted to PDF immediately, but we check for that. %D %D It would be nice, if \type{-ddelete-intermediate-files} would delete all useless intermediate files. -%D It would be even better, if mtxrun wouldn't declare non-existing files as \quotation{unchanged}. +%D It would be even better, if mtxrun wouldn't declare non-existing files as \quotation{unchanged}. (Is that fixed now?) %D %D Remember: More possible options in \type{lily.scm}. %D - os.execute('mtxrun --ifchanged="\lily!tmpfilename.tmp" --exec bin:lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts -ddelete-intermediate-files -o"\lily!tmpfilename" "\lily!tmpfilename.tmp"') - if not lfs.isfile('\lily!tmpfilename.pdf') then - os.execute('mtxrun --ifchanged="\lily!tmpfilename.eps" --exec bin:pstopdf "\lily!tmpfilename.eps"') + os.execute('mtxrun --ifchanged="\lily!tmpfilename" --exec bin:lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts -ddelete-intermediate-files -o"\tmpdir/\lily!filename" "\lily!tmpfilename"') + if not lfs.isfile('\tmpdir/\lily!filename.pdf') then + os.execute('mtxrun --ifchanged="\tmpdir/\lily!filename.eps" --exec bin:pstopdf "\tmpdir/\lily!filename.eps"') end - if lfs.isfile('\lily!img') and lfs.isfile('\lily!tmpfilename.pdf') then +%D At least on Windows, Lua's \type{os.rename} won't overwrite existing files, so we need to remove them before. + if lfs.isfile('\lily!img') and lfs.isfile('\tmpdir/\lily!filename.pdf') then os.remove('\lily!img') end - os.rename('\lily!tmpfilename.pdf', '\lily!img') + os.rename('\tmpdir/\lily!filename.pdf', '\lily!img') \stopluacode %D %D TODO: Get the relevant dimension directly from LilyPond, @@ -342,7 +340,9 @@ \protect \doifnotmode{demo}{\endinput} -%D End of file +%D End of file. +%D +%D Here follows a sample. (\type{context t-lilypond --mode=demo}) \starttext @@ -371,7 +371,7 @@ is typeset as \getbuffer[sample] \type{\startlilypond} accepts options, as in\crlf -\type{\startlilypond[staffsize=24, linewidth=14cm, indent=5cm, time=no, clef=no]}: +\type{\startlilypond[staffsize=18, linewidth=14cm, indent=5cm, time=no, clef=no]}: \nobreak \startlilypond[staffsize=18,linewidth=14cm,indent=5cm,time=no,clef=no] \relative c' { @@ -413,6 +413,7 @@ Here is a sample with lyrics: cis4 cis8 b( cis d) | cis( d) e e4 e,8 | fis4 fis8 gis4. + \bar ":|" } } >> |