From: Werner Lemberg Date: Mon, 14 Oct 2002 22:18:30 +0000 (+0000) Subject: Further improve TeX output. The produced files are about 40% X-Git-Tag: release/1.6.6~7 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d5e26c9e7cbf4257d828bd0795c2f60956b2381f;p=lilypond.git Further improve TeX output. The produced files are about 40% smaller. `lilyponddefs.tex' is now read only once. * tex/lilyponddefs.tex: Remove footer stuff. (\ifundefined): Renamed to... (\lilypondundefined): This. Use LaTeX's definition to make it nestable and make it global. (\lilypondstart, \lilypondend): New macro to initialize LilyPond output. (\lilypondspecial): New macro to read `music-drawing-routines.ps'. (\fetasixteen, \fetafont, \fetachar, \botalign, \leftalign): Make them global. (\placebox): Renamed to... (\lyitem): This. Make it global and call \outputscale by itself. (\lybox, \lyvrule): New macros to reduce input data. (\lilypondfirst, \lilypondsecond, \lilypondloop, \lilyponditerate): New auxiliary macros. (\SkipLilydefs, \EndLilyPondOutput): Removed. * tex/lily-pdf-defs.tex, tex/lily-ps-defs.tex (\lilySpace): Renamed to... (\lilypondspace): This and made it global. (\turnOnPostScript): Renamed to... (\lilypondpostscript): This and made it global. (\turnOnExperimentalFeatures): Renamed to... (\lilypondexperimentalfeatures): This and made it global. * tex/lily-ps-defs.tex (\PSsetTeXdimen): Renamed to... (\lilypondsetdimen): This and made it global. * tex/lilypond-latex.tex, tex/lilypond-plaintex.tex: Removed. * tex/GNUmakefile (TEX_FILES): Add `music-drawing-routines.ps' (all, $(outdir)/music-drawing-routines.ps): New rules. * buildscripts/mf-to-table.py (write_tex_defs): Use \gdef. * scm/pdftex.scm, scm/tex.scm (end-output, header-end, placebox, start-system, stop-system, stop-last-system, filledbox): Updated to use the changed macros from lilyponddefs.tex. * scripts/lilypond-book.ly (output_dict) : Ditto. --- diff --git a/ChangeLog b/ChangeLog index cd7a00f1ef..156abc9d7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2002-10-14 Werner Lemberg + + Further improve TeX output. The produced files are about 40% + smaller. `lilyponddefs.tex' is now read only once. + + * tex/lilyponddefs.tex: Remove footer stuff. + (\ifundefined): Renamed to... + (\lilypondundefined): This. Use LaTeX's definition to + make it nestable and make it global. + (\lilypondstart, \lilypondend): New macro to initialize LilyPond + output. + (\lilypondspecial): New macro to read `music-drawing-routines.ps'. + (\fetasixteen, \fetafont, \fetachar, \botalign, \leftalign): Make + them global. + (\placebox): Renamed to... + (\lyitem): This. + Make it global and call \outputscale by itself. + (\lybox, \lyvrule): New macros to reduce input data. + (\lilypondfirst, \lilypondsecond, \lilypondloop, \lilyponditerate): + New auxiliary macros. + (\SkipLilydefs, \EndLilyPondOutput): Removed. + * tex/lily-pdf-defs.tex, tex/lily-ps-defs.tex (\lilySpace): Renamed + to... + (\lilypondspace): This and made it global. + (\turnOnPostScript): Renamed to... + (\lilypondpostscript): This and made it global. + (\turnOnExperimentalFeatures): Renamed to... + (\lilypondexperimentalfeatures): This and made it global. + * tex/lily-ps-defs.tex (\PSsetTeXdimen): Renamed to... + (\lilypondsetdimen): This and made it global. + * tex/lilypond-latex.tex, tex/lilypond-plaintex.tex: Removed. + * tex/GNUmakefile (TEX_FILES): Add `music-drawing-routines.ps' + (all, $(outdir)/music-drawing-routines.ps): New rules. + * buildscripts/mf-to-table.py (write_tex_defs): Use \gdef. + * scm/pdftex.scm, scm/tex.scm (end-output, header-end, placebox, + start-system, stop-system, stop-last-system, filledbox): Updated to + use the changed macros from lilyponddefs.tex. + * scripts/lilypond-book.ly (output_dict) : Ditto. + 2002-10-07 Jan Nieuwenhuizen * Documentation/windows/installing.texi: Update. diff --git a/buildscripts/mf-to-table.py b/buildscripts/mf-to-table.py index d8aa7275d9..998893c9f0 100644 --- a/buildscripts/mf-to-table.py +++ b/buildscripts/mf-to-table.py @@ -120,7 +120,7 @@ Comment Automatically generated by mf-to-table.py def write_tex_defs (file, global_info, charmetrics): nm = global_info['FontFamily'] for m in charmetrics: - file.write (r'''\def\%s%s{\char%d}%%%s''' % (nm, m['tex'], m['code'],'\n')) + file.write (r'''\gdef\%s%s{\char%d}%%%s''' % (nm, m['tex'], m['code'],'\n')) file.write ('\\endinput\n') def write_ps_encoding (file, global_info, charmetrics): diff --git a/scm/pdftex.scm b/scm/pdftex.scm index d6fb881969..25ba5b604f 100644 --- a/scm/pdftex.scm +++ b/scm/pdftex.scm @@ -113,7 +113,7 @@ (begin ; uncomment for some stats about lily memory ; (display (gc-stats)) - (string-append "%\n\\EndLilyPondOutput\n" + (string-append "%\n\\lilypondend\n" ; Put GC stats here. ))) @@ -164,9 +164,11 @@ (else (error "unknown unit" (ly-unit))) )) "}%\n" - "\\input lilyponddefs\n" + "\\ifx\\lilypondstart\\undefined\n" + " \\input lilyponddefs\n" + "\\fi\n" "\\outputscale=\\lilypondpaperoutputscale \\lilypondpaperunit\n" - "\\turnOnPostScript\n" + "\\lilypondpostscript\n" "\\pdfcompresslevel=0")) ;; Note: this string must match the string in ly2dvi.py!!! @@ -205,9 +207,10 @@ (ly-number->string x) " \\outputscale ")) (define (placebox x y s) - (string-append - "\\placebox{" - (number->dim y) "}{" (number->dim x) "}{" s "}%\n")) + (string-append "\\lyitem{" + (ly-number->string y) "}{" + (ly-number->string x) "}{" + s "}%\n")) (define (bezier-bow l thick) (embedded-pdf (list 'bezier-bow `(quote ,l) thick))) @@ -218,24 +221,24 @@ (define (start-system wd ht) (string-append "\\leavevmode\n" "\\scoreshift = " (number->dim (* ht 0.5)) "\n" - "\\ifundefined{lilypondscoreshift}%\n" - "\\else\n" - " \\advance\\scoreshift by -\\lilypondscoreshift\n" - "\\fi\n" - "\\hbox to " (number->dim wd) "{%\n" - "\\lower\\scoreshift\n" - "\\vbox to " (number->dim ht) "{\\hbox{%\n")) + "\\lilypondifundefined{lilypondscoreshift}%\n" + " {}%\n" + " {\\advance\\scoreshift by -\\lilypondscoreshift}%\n" + "\\lybox{" + (ly-number->string wd) "}{" + (ly-number->string ht) "{%\n")) (define (stop-system) - "}\\vss}\\hss}\\interscoreline\n") + "}%\n%\n\\interscoreline\n%\n") (define (stop-last-system) - "}\\vss}\\hss}") + "}%\n") + (define (filledbox breapth width depth height) - (string-append - "\\kern" (number->dim (- breapth)) - "\\vrule width " (number->dim (+ breapth width)) - "depth " (number->dim depth) - "height " (number->dim height) " ")) + (string-append "\\lyvrule{" + (ly-number->string (- breapth)) "}{" + (ly-number->string (+ breapth width)) "}{" + (ly-number->string depth) "}{" + (ly-number->string height) "}")) (define (roundfilledbox x y width height blotdiam) (embedded-pdf (list 'roundfilledbox x y width height blotdiam))) diff --git a/scm/tex.scm b/scm/tex.scm index dba7f1955c..9073bf6cd6 100644 --- a/scm/tex.scm +++ b/scm/tex.scm @@ -143,18 +143,7 @@ ; uncomment for some stats about lily memory ; (display (gc-stats)) (string-append - "%\n" - "\\EndLilyPondOutput\n" - "\\begingroup\n" - "\\ifx\\LilyPondDocument\\undefined\n" - " \\def\\x{\\endgroup}%\n" - "\\else\n" - " \\def\\x{%\n" - " \\endgroup\n" - " \\enddocument\n" - " }\n" - "\\fi\n" - "\\x\n" + "\\lilypondend\n" ; Put GC stats here. ))) @@ -180,41 +169,14 @@ ((equal? (ly-unit) "pt") (/ 72.0 72.27)) (else (error "unknown unit" (ly-unit))) )) - " mul }%\n" - "\\special{\\string! " - - ;; URG: ly-gulp-file: now we can't use scm output without Lily - (if use-regex - ;; fixed in 1.3.4 for powerpc -- broken on Windows - (regexp-substitute/global #f "\n" - (ly-gulp-file "music-drawing-routines.ps") 'pre " %\n" 'post) - (ly-gulp-file "music-drawing-routines.ps")) -; (if (defined? 'ps-testing) "/testing true def%\n" "") - "}%\n" - "\\begingroup\n" - "\\catcode `\\@=11\n" - "\\expandafter\\ifx\\csname @nodocument\\endcsname \\relax\n" - " \\def\\x{\\endgroup}%\n" - "\\else\n" - " \\def\\x{%\n" - " \\endgroup\n" - " \\def\\LilyPondDocument{}\n" - " \\documentclass{article}\n" - " \\pagestyle{empty}\n" - ; argh, we can't say \begin{document} because \begin is defined as - ; \outer in texinfo - " \\begingroup\n" - " \\document\n" - " \\ifdim\\lilypondpaperlinewidth\\lilypondpaperunit > 0pt\n" - " \\hsize\\lilypondpaperlinewidth\\lilypondpaperunit\n" - " \\fi\n" - " \\parindent 0pt\n" - " }\n" + " mul }%\n" + "\\ifx\\lilypondstart\\undefined\n" + " \\input lilyponddefs\n" "\\fi\n" - "\\x\n" - "\\input lilyponddefs\n" - "\\outputscale=\\lilypondpaperoutputscale \\lilypondpaperunit\n" - "\\turnOnPostScript\n")) + "\\outputscale = \\lilypondpaperoutputscale\\lilypondpaperunit\n" + "\\lilypondstart\n" + "\\special{\\string!\\lilypondspecial}%\n" + "\\lilypondpostscript\n")) ;; Note: this string must match the string in ly2dvi.py!!! (define (header creator generate) @@ -253,9 +215,10 @@ (ly-number->string x) " \\outputscale ")) (define (placebox x y s) - (string-append - "\\placebox{" - (number->dim y) "}{" (number->dim x) "}{" s "}%\n")) + (string-append "\\lyitem{" + (ly-number->string y) "}{" + (ly-number->string x) "}{" + s "}%\n")) (define (bezier-bow l thick) (embedded-ps (list 'bezier-bow `(quote ,l) thick))) @@ -266,29 +229,28 @@ (define (start-system wd ht) (string-append "\\leavevmode\n" "\\scoreshift = " (number->dim (* ht 0.5)) "\n" - "\\ifundefined{lilypondscoreshift}%\n" - "\\else\n" - " \\advance\\scoreshift by -\\lilypondscoreshift\n" - "\\fi\n" - "\\hbox to " (number->dim wd) "{%\n" - "\\lower\\scoreshift\n" - "\\vbox to " (number->dim ht) "{\\hbox{%\n")) + "\\lilypondifundefined{lilypondscoreshift}%\n" + " {}%\n" + " {\\advance\\scoreshift by -\\lilypondscoreshift}%\n" + "\\lybox{" + (ly-number->string wd) "}{" + (ly-number->string ht) "}{%\n")) (define (stop-system) - "}\\vss}\\hss}\\interscoreline\n") + "}%\n%\n\\interscoreline\n%\n") (define (stop-last-system) - "}\\vss}\\hss}") + "}%\n") (define (filledbox breapth width depth height) (if (and #f (defined? 'ps-testing)) (embedded-ps (string-append (numbers->string (list breapth width depth height)) " draw_box" )) - (string-append - "\\kern" (number->dim (- breapth)) - "\\vrule width " (number->dim (+ breapth width)) - "depth " (number->dim depth) - "height " (number->dim height) " "))) + (string-append "\\lyvrule{" + (ly-number->string (- breapth)) "}{" + (ly-number->string (+ breapth width)) "}{" + (ly-number->string depth) "}{" + (ly-number->string height) "}"))) (define (roundfilledbox x y width height blotdiam) (embedded-ps (list 'roundfilledbox x y width height blotdiam))) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 77870ede96..fcd0f6fb47 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -4,7 +4,6 @@ # * junk --outdir for --output # * Figure out clean set of options. # * -# * EndLilyPondOutput is def'd as vfil. Causes large white gaps. # * texinfo: add support for @pagesize # todo: dimension handling (all the x2y) is clumsy. (tca: Thats @@ -462,16 +461,12 @@ output_dict= { %s@end example ''', # do some tweaking: @ is needed in some ps stuff. - # override EndLilyPondOutput, since @tex is done - # in a sandbox, you can't do \input lilyponddefs at the - # top of the document. # # ugh, the

below breaks inline images... 'output-texi-noquote': r'''@tex \catcode`\@=12 \parindent 0pt -\input lilyponddefs -\def\EndLilyPondOutput{} +\def\lilypondbook{} \input %(fn)s.tex \catcode`\@=0 @end tex @@ -484,8 +479,7 @@ output_dict= { 'output-texi-quoted': r'''@quotation @tex \catcode`\@=12 -\input lilyponddefs -\def\EndLilyPondOutput{} +\def\lilypondbook{} \input %(fn)s.tex \catcode`\@=0 @end tex diff --git a/tex/GNUmakefile b/tex/GNUmakefile index c9f4c4b19b..b58a7e55ce 100644 --- a/tex/GNUmakefile +++ b/tex/GNUmakefile @@ -1,6 +1,6 @@ depth = .. -TEX_FILES = $(wildcard *.tex) +TEX_FILES = $(wildcard *.tex) $(outdir)/music-drawing-routines.ps EXTRA_DIST_FILES = $(TEX_FILES) STEPMAKE_TEMPLATES=install @@ -10,3 +10,7 @@ INSTALLATION_FILES=$(TEX_FILES) include $(depth)/make/stepmake.make +$(outdir)/music-drawing-routines.ps: $(depth)/ps/music-drawing-routines.ps + -cp $< $@ + +all: $(INSTALLATION_FILES) diff --git a/tex/lily-pdf-defs.tex b/tex/lily-pdf-defs.tex index f85aa5b1e8..69af9f0465 100644 --- a/tex/lily-pdf-defs.tex +++ b/tex/lily-pdf-defs.tex @@ -5,23 +5,23 @@ \edef\lilypdfdefsELC{\the\endlinechar}% \endlinechar -1\relax -\def\lilySpace{ } +\gdef\lilypondspace{ } -\def\turnOnPostScript{ +\gdef\lilypondpostscript{ % This sets CTM so that you get to the currentpoint % by executing a 0 0 moveto \def\embeddedpdf##1{ \pdfliteral{ - q \lilypondpaperoutputscale\lilySpace 0 0 % - \lilypondpaperoutputscale\lilySpace 0 0 cm % - \lilyoutputscalefactor\lilySpace 0 0 % - \lilyoutputscalefactor\lilySpace 0 0 cm % + q \lilypondpaperoutputscale\lilypondspace 0 0 % + \lilypondpaperoutputscale\lilypondspace 0 0 cm % + \lilyoutputscalefactor\lilypondspace 0 0 % + \lilyoutputscalefactor\lilypondspace 0 0 cm % ##1 Q } } } -\def\turnOnExperimentalFeatures{} +\gdef\lilypondexperimentalfeatures{} \endlinechar \lilypdfdefsELC \endinput diff --git a/tex/lily-ps-defs.tex b/tex/lily-ps-defs.tex index 4efc3c418c..71e31e8aab 100644 --- a/tex/lily-ps-defs.tex +++ b/tex/lily-ps-defs.tex @@ -9,30 +9,30 @@ % Escape the colon with \string to avoid problems with French while using % the Babel package. -\def\PSsetTeXdimen#1{ +\gdef\lilypondsetdimen#1{ \expandafter\special{ ! /#1 (\csname #1\endcsname) set_tex_dimen } } -\def\lilySpace{ } +\gdef\lilypondspace{ } -\def\turnOnPostScript{ +\gdef\lilypondpostscript{ % This sets CTM so that you get to the currentpoint % by executing a 0 0 moveto \def\embeddedps##1{ \special{ ps\string: @beginspecial @setspecial % - \lilypondpaperoutputscale\lilySpace\scaletounit % - \lilypondpaperoutputscale\lilySpace\scaletounit % + \lilypondpaperoutputscale\lilypondspace\scaletounit % + \lilypondpaperoutputscale\lilypondspace\scaletounit % % FUCKING REDHAT XDVI -- ARG! skeel ##1 @endspecial } } - \PSsetTeXdimen{lilypondpaperblotdiameter} + \lilypondsetdimen{lilypondpaperblotdiameter} } -\def\turnOnExperimentalFeatures{} +\gdef\lilypondexperimentalfeatures{} \endlinechar \lilypsdefsELC \endinput diff --git a/tex/lilypond-latex.tex b/tex/lilypond-latex.tex deleted file mode 100644 index e139af70cb..0000000000 --- a/tex/lilypond-latex.tex +++ /dev/null @@ -1,46 +0,0 @@ -% lilypond-latex.tex -% -\edef\lilypondlatexELC{\the\endlinechar}% -\endlinechar -1\relax - -\message{LaTeX definitions} - -\def\texsuffix{LaTeX} - -\def\lilyfooterLaTeX{ - \let\nopagenumbers\relax - - %% FIXME - \def\ps@plain{ - \renewcommand{\@oddhead}{} - \renewcommand{\@evenfoot}{} - \renewcommand{\@evenhead}{} - \renewcommand{\@oddfoot}{ - \ifnum\thepage = 1\relax - {\hfil \lilypondtagline} - \else - {foo\hfil \the\pageno \hfil} - \fi - } - } - - \def\ps@empty{ - \renewcommand{\@oddhead}{} - \renewcommand{\@evenfoot}{} - \renewcommand{\@evenhead}{} - \renewcommand{\@oddfoot}{ - \ifnum\thepage = 1\relax - {\hfil \lilypondtagline} - \else - {foo\hfil \the\pageno \hfil} - \fi - } - } - - \nopagenumbers -} - -\def\nolilyfooterLaTeX{} - -\endlinechar \lilypondlatexELC -\endinput diff --git a/tex/lilypond-plaintex.tex b/tex/lilypond-plaintex.tex deleted file mode 100644 index b269993355..0000000000 --- a/tex/lilypond-plaintex.tex +++ /dev/null @@ -1,38 +0,0 @@ -% lilypond-plaintex.tex -% -\edef\lilypondplaintexELC{\the\endlinechar}% -\endlinechar -1\relax - -\message{LilyPond Plain TeX settings} - -\def\texsuffix{PlainTeX} - -\def\lilyfooterPlainTeX{ - \footline = { - \ifnum\pageno = 1\relax - \smalltextfont\lilypondcopyright\hfil \lilypondtagline - \else - \hfil \the\pageno \hfil - \fi - } -} - - -%% make plain work ok Out Of The Box - -\ifundefined{lilypondpaperunit} -\def\lhsize{\hsize} -\else -\def\lhsize{\lilypondpaperlinewidth\lilypondpaperunit} -\fi - -\ifdim0pt<\lhsize -\hsize=\lhsize -\fi - -\advance\hoffset by -.6in - -\def\nolilyfooterPlainTeX{\nopagenumbers} - -\endlinechar \lilypondplaintexELC -\endinput diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index acacba8e3d..1cf39f92d3 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -2,130 +2,218 @@ % % Include file for LilyPond. % -% This file defines various macros to accomodate lilypond output. +% This file defines various macros to acommodate lilypond output. +% +% It should run with plain TeX, LaTeX, pdftex, and texinfo. +% +% To avoid interferences, lilyponddefs.tex should be loaded within a group. +% To load it only once, most of the definitions must be global. +% +% The overall structure of a file created by LilyPond is as follows: +% +% +% \ifx\lilypondstart \undefined +% \input lilyponddefs +% \fi +% \lilypondstart +% +% \lilypondend +% +% No footers and headers are provided for the stand-alone run (i.e., for +% directly saying `latex '. +% % % Avoid \par while reading this file. \edef\lilyponddefsELC{\the\endlinechar}% \endlinechar -1\relax -% TeXbook ex 7.7 -\def\ifundefined#1{ - \expandafter\ifx\csname#1\endcsname\relax -} +% the next three macros are taken from LaTeX +\long\gdef\lilypondfirst#1#2{#1} -% If we must make titles, do so, before we're skipped. +\long\gdef\lilypondsecond#1#2{#2} -\ifx\mustmakelilypondtitle\undefined -\else - \makelilypondtitle -\fi +\gdef\lilypondifundefined#1{ + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\lilypondfirst + \else + \expandafter\lilypondsecond + \fi +} -\ifx\mustmakelilypondpiecetitle\undefined -\else - \makelilypondpiecetitle -\fi +\gdef\lilypondstart{ + \begingroup + \catcode `\@=11\relax + % \@nodocument is defined as \relax after `\begin{document}' + \lilypondifundefined{@nodocument} + { + % either plain TeX or texinfo or not at the beginning of LaTeX input + \def\x{\endgroup} + } + { + % provide a proper LaTeX preamble (for A4 paper format) + \def\x{ + \endgroup + \def\lilyponddocument{} + \documentclass[a4paper]{article} + \pagestyle{empty} + % \begin is defined as \outer in texinfo, thus we use \csname + \csname begin\endcsname{document} + % center staves horizontally on page + \ifdim\lilypondpaperlinewidth\lilypondpaperunit > 0pt + \hsize\lilypondpaperlinewidth\lilypondpaperunit + % we abuse \scoreshift temporarily + \scoreshift \paperwidth + \advance\scoreshift -\the\hsize + \scoreshift 0.5\scoreshift + \advance\scoreshift -1in + \oddsidemargin \scoreshift + \evensidemargin \scoreshift + \fi + \parindent 0pt + } + } + + \x + + \lilypondifundefined{mustmakelilypondtitle} + {} + {\makelilypondtitle} + + \lilypondifundefined{mustmakelilypondpiecetitle} + {} + {\makelilypondpiecetitle} +} -% skip if included already +\gdef\lilypondend{ + \lilypondifundefined{lilypondbook} + {\lilypondifundefined{lilypondpaperlastpagefill} + {\vskip 0pt plus \lilypondpaperinterscorelinefill00 fill} + {} + } + {} + + \begingroup + \lilypondifundefined{lilyponddocument} + { + \def\x{\endgroup} + } + { + \def\x{ + \endgroup + \csname end\endcsname{document} + } + } + + \x +} -\def\SkipLilydefs{ - \endlinechar \lilyponddefsELC - \endinput} -\ifundefined{EndLilyPondOutput} - \def\EndLilyPondOutput{\csname bye\endcsname} - \def\SkipLilydefs{} -\fi -\SkipLilydefs +% this is an inversed \loop ... \repeat macro +\def\lilypondloop#1\lilypondrepeat{ + \def\lilypondbody{#1} + \lilyponditerate +} -% need to do some stuff to turn page numbering off +\def\lilyponditerate{ + % \if ... + \lilypondbody + \let\lilypondnext \relax + \else + \let\lilypondnext \lilyponditerate + \fi + \lilypondnext +} -\ifundefined{documentclass} - \input lilypond-plaintex -\else - \input lilypond-latex -\fi +\newread\lilypondinput + +% after executing the following code, \lilypondspecial contains the +% contents of `music-drawing-routines.ps' +\lilypondifundefined{lilypondspecial} + { + \begingroup + \openin\lilypondinput music-drawing-routines.ps + \xdef\lilypondspecial{} + \lilypondloop + \endlinechar \lilyponddefsELC + \catcode`\^^M 10\relax + \read\lilypondinput to \lilypondspecialline + \expandafter\xdef\expandafter\lilypondspecial\expandafter{ + \lilypondspecial\lilypondspecialline + } + \ifeof\lilypondinput + \lilypondrepeat + \closein\lilypondinput + \endgroup + } + {} -% The feta characters +% the feta characters \input feta20 -\font\fetasixteen = feta16 -\def\fetafont{\fetasixteen} -\def\fetachar#1{\hbox{\fetasixteen#1}} +\global\font\fetasixteen = feta16 +\gdef\fetafont{\fetasixteen} +\gdef\fetachar#1{\hbox{\fetasixteen#1}} -\def\botalign#1{ +\gdef\botalign#1{ \vbox to 0pt{\vss #1} } -\def\leftalign#1{ +\gdef\leftalign#1{ \hbox to 0pt{#1\hss} } -% Attempt to keep lilypiecetitle together with the piece: +\gdef\lyitem#1#2#3{ + \botalign{ + \hbox{\raise #1\outputscale + \leftalign{\kern #2\outputscale #3}} + } +} -% -% TODO: figure this out. -% +\gdef\lybox#1#2#3{ + \hbox to #1\outputscale { + \lower\scoreshift \vbox to #2\outputscale { + \hbox{#3} + \vss + } + \hss + } +} -\def\myfilbreak{}%\par\vfil\penalty200\vfilneg} +\gdef\lyvrule#1#2#3#4{ + \kern #1\outputscale + \vrule width #2\outputscale depth #3\outputscale height #4\outputscale +} +% Attempt to keep lilypiecetitle together with the piece: +% +% TODO: figure this out. +\gdef\myfilbreak{}%\par\vfil\penalty200\vfilneg} -\ifundefined{lilypondpaperinterscorelinefill} - \def\lilypondpaperinterscorelinefill{0} -\else - \def\lilypondpaperinterscorelinefill{1} -\fi +\lilypondifundefined{lilypondpaperinterscorelinefill} + {\gdef\lilypondpaperinterscorelinefill{0}} + {\gdef\lilypondpaperinterscorelinefill{1}} -\def\interscoreline{ +\gdef\interscoreline{ \vskip \lilypondpaperinterscoreline \lilypondpaperunit plus \lilypondpaperinterscorelinefill fill } -\def\placebox#1#2#3{ - \botalign{ - \hbox{\raise #1\leftalign{\kern #2{}#3}} - } -} - % Are we using PDFTeX? If so, use pdf definitions. -% MiKTeX checks \pdfoutput the wrong way; this makes our -% check more complicated. -\ifx\pdfoutput\undefined - \input lily-ps-defs -\else - \ifx\pdfoutput\relax - \input lily-ps-defs - \else - \pdfoutput = 1 - \input lily-pdf-defs - \fi -\fi - -\def\EndLilyPondOutput{ - \ifundefined{lilypondpaperlastpagefill} - \vskip 0pt plus \lilypondpaperinterscorelinefill00 fill - \fi - \csname bye\endcsname -} +% MiKTeX checks \pdfoutput the wrong way, thus we use \csname. +\lilypondifundefined{lilypondpostscript} + { + \lilypondifundefined{pdfoutput} + {\input lily-ps-defs } + { + \pdfoutput = 1 + \input lily-pdf-defs + } + } + {} -% Need to do some stuff to turn page numbering off; -% they seriously mess up your fragments. - -\ifx\csname nolilyfooter\endcsname\relax - \message{[footer defined]} - \csname lilyfooter\texsuffix\endcsname -\else - \message{[footer empty]} - \csname nolilyfooter\texsuffix\endcsname -\fi - -% It is very bad that lilyponddefs.tex gets included in every lilypond -% output snippet. This is necessary because these output snippets -% often get encapsulated, eg by texinfo. This should be fixed by -% putting the variable parts in this file into a macro so that loading -% the file multiple times can be avoided. -\ifx\outputscale\undefined - \csname global\endcsname\csname newdimen\endcsname\outputscale - \csname global\endcsname\csname newdimen\endcsname\scoreshift -\fi +\newdimen\outputscale +\newdimen\scoreshift % Restore newline functionality (disabled to avoid \par). \endlinechar \lilyponddefsELC \endinput + +% EOF