% Copyright 2015 by Don Simons and Bob Tennent
% licensed under the LaTeX Project Public Licence
%
% Begin Bob Tennent's font substitutions
% 8pt 
\font\eightrm=LilyJAZZText at 8pt
\let\eightbf\eightrm
\let\eightit\eightrm
%
% 9pt
\font\ninerm=LilyJAZZText at 9pt
\let\ninebf\ninerm
\let\nineit\ninerm
%
% 10pt
\font\tenrm=LilyJAZZText at 10pt
\let\tenbf\tenrm
\let\tenit\tenrm
%
% 12pt
\font\twelverm=LilyJAZZText scaled \magstep 1
\let\twelvebf\twelverm
\let\twelveit\twelverm
%
% 14pt
\font\frtrm=LilyJAZZText scaled \magstep2
%
% 17pt
\font\svtrm=LilyJAZZText scaled \magstep3
%
% 20pt
\font\twtyrm=LilyJAZZText scaled \magstep4
%
% 25pt
\font\twfvrm=LilyJAZZText scaled \magstep5
%
% Large fonts for titles
\let\bigfont=\frtrm
\let\Bigfont=\svtrm
\let\BIgfont=\twtyrm
\let\BIGfont=\twfvrm
%
%
\font\ppffsixteen=LilyJAZZText at 10pt
\font\ppfftwenty=LilyJAZZText scaled \magstep 1
\font\ppfftwentyfour=LilyJAZZText scaled \magstep2
\font\ppfftwentynine=LilyJAZZText scaled \magstep3
\font\tinyppff=LilyJAZZText at 8pt
\font\smallppff=LilyJAZZText at 10pt
\font\normppff=LilyJAZZText scaled \magstep 1
\font\medppff=LilyJAZZText scaled \magstep2
%
\def\f{{\ppff f}}
\def\ff{{\ppff ff}}
\def\fp{{\ppff fp}}
\def\fff{{\ppff fff}}
\def\ffff{{\ppff ffff}}
\def\mf{{\ppff mf}}
\def\p{{\ppff p}}
\def\pp{{\ppff pp}}
\def\ppp{{\ppff ppp}}
\def\pppp{{\ppff pppp}}
%
\edef\catcodeat{\the\catcode`\@}\catcode`\@=11
%
\def\smalldyn{\let\ppff\smallppff \let\p@@f\ppff}%
\def\normdyn{\let\ppff\normppff \let\p@@f\ppff}%
\def\meddyn{\let\ppff\medppff \let\p@@f\ppff}%
%
\def\sF{{\ppff s\p@kern f}}
\def\sfz{{\ppff s\p@kern f\f@kern z}}
\def\sfzp{{\ppff s\p@kern f\f@kern z\p@kern p}}
%
\def\mp@{{\ppff mp}}
\let\mezzopiano\mp@
\catcode`\@=\catcodeat
%
\def\smalltype{%
  \let\rm\eightrm
  \let\bf\eightrm
  \let\it\eightrm
  \rm}
\def\Smalltype{%
  \let\rm\ninerm
  \let\bf\ninerm
  \let\it\ninerm
  \rm}
\def\normtype{%
  \let\rm\tenrm
  \let\bf\tenrm
  \let\it\tenrm
  \rm}
\def\medtype{%
  \let\rm\twelverm
  \let\bf\twelverm
  \let\it\twelverm
  \rm}
\def\bigtype{%
  \let\rm\bigfont
  \let\bf\bigfont
  \let\it\bigfont
  \rm}
\def\Bigtype{%
  \let\rm\Bigfont
  \let\bf\Bigfont
  \let\it\Bigfont
  \rm}
\def\BIgtype{%
  \let\rm\BIgfont
  \let\bf\BIgfont
  \let\it\BIgfont
  \let\bi\Bigfont
  \let\sc\Bigfont
  \let\sl\Bigfont
  \rm}
\def\BIGtype{%
  \let\rm\BIGfont
  \let\bf\BIGfont
  \let\it\BIGfont
  \let\bi\BIGfont
  \let\sc\BIGfont
  \let\sl\BIGfont
  \rm}
\normtype
%
% End Bob Tennent's font substitutions
% Begin Don's jazz macros etc.
%
\font\jcfn LilyJAZZText scaled 1200% \twelverm
\font\bigjcfn LilyJAZZText scaled 1728% \Bigfont
\font\smalljazzchar musixJAZZ scaled 1200%
\font\jazzchar musixJAZZ scaled 1440%
\font\bigjazzchar musixJAZZ scaled 1728%
\font\Bigjazzchar musixJAZZ scaled 2074%
\newdimen\chup%
\def\smallchords{\let\cchar\jazzchar\let\ctext\twelverm\chup4pt}%
\def\medchords{\let\cchar\bigjazzchar\let\ctext\bigfont\chup4.8pt}%
\def\bigchords{\let\cchar\Bigjazzchar\let\ctext\Bigfont\chup5.8pt}%
\medchords%
%
\def\sh#1{\zcharnote{#1}{\kern-5pt\bigjazzchar\char35}}%
\let\bigsh\sh%
\def\fl#1{\zcharnote{#1}{\kern-5pt\bigjazzchar\char98}}%
\let\bigfl\fl%
\def\na#1{\zcharnote{#1}{\kern-5pt\bigjazzchar\char110}}%
\let\bigna\na%
\def\bassclef{\kern2pt\bigjazzchar\char63\kern-2pt}%
\def\trebleclef{\kern2pt\bigjazzchar\char38\kern-2pt}%
%
% mid-staff clefs
%
\def\smallbassclef{\jazzchar\char63}%
\def\smalltrebleclef{\jazzchar\char38}%
%
\let\tempo\twelvebf\let\dyn\tenbf%
\let\meterfont\twelvebf%
%
\def\sup#1{\raise\chup\hbox{#1}}%
\def\dsup#1#2{\raise.5\chup\hbox{\vbox{\hbox{#1}\hbox{#2}}}}%
\def\jc#1#2{\zcharnote{0}{\raise#1\internote\hbox{\ctext#2}}}%
\def\jsh{\raise.95\chup\hbox{\cchar\char35}}%
\def\jfl{\raise.7\chup\hbox{\cchar\char98}}%
\def\jna{\raise.7\chup\hbox{\cchar\char110}}%
%
\def\majs{\sup{maj7}}%
\def\jcheight{-10}%
\def\jcn#1{\jc{\jcheight}{#1}}%
\def\jcf#1{\loff{\jcn{#1}}}%
\def\rtux{\off{-\afterruleskip}\ccharnote0\duevolte%
  \ccharnote9{\meterfont\rtutxt}\off{\afterruleskip}}%
\def\rtu{\def\rtutxt{2}\rtux}\def\rtun{\def\rtutxt{\empty}\rtux}%
\makeatletter%
\def\mbrest#1#2#3{%
\CenterBar{%
  \def\vertpart{\hbox{\vrule width.6pt height1.5\internote depth1.5\internote}}%
     \raise\f@ur\internote\hbox{%
     \vertpart\hbox{%
     \vrule width0.7\y@ii height.5\internote depth.5\internote%
     \kern-0.35\y@ii\raise5\internote\lrlap{\meterfont #1}\kern0.35\y@ii}%
     \vertpart}%
}{#2}{#3}%
}%
%
% For key signatures
%
\def\C@sig#1{\n@iii#1%
\ifnum\a@s>0\n@v=35\else\n@v=98\fi% 
\advance\n@iii\ut@ref \advance\n@iii\ut@ref%
\ifnum\ut@ref=\si@ \advance\n@iii-\fourt@@n%
\else \ifnum\ut@ref>\z@ \advance\n@iii-\s@v@n \fi\fi%
\ifnum\n@iii<\@ne \global\advance\n@iii\s@v@n \fi%
\ifnum\n@iii<\@ne \global\advance\n@iii\s@v@n \fi%
\ifnum\n@iii>\@l@v@n \advance\n@iii-\s@v@n \fi%
\ifnum\n@iii>\@l@v@n \advance\n@iii-\s@v@n \fi%
\advance\n@iii-\tw@ \raise\n@iii\internote%
\hbox\@to2\internote{\hss\bigjazzchar\char\n@v\hss}}%
%
% Redefine some ornaments
%
\newdimen\jup\newdimen\jright%
\def\usf#1{\n@iv62\jup3\internote\jright3pt\uacc@Charj{#1}}%
\def\ust#1{\n@iv95\jup2\internote\jright3pt\uacc@Charj{#1}}%
\def\lst#1{\n@iv95\jup-4\internote\jright3pt\uacc@Charj{#1}}%
\def\usfz#1{\n@iv94\jup2\internote\jright3pt\uacc@Charj{#1}}%
\def\fermataup#1{\n@iv85\jup2\internote\jright3pt\uacc@Charj{#1}}%
\def\fermatadown#1{\n@iv117\jup-2\internote\jright3pt\uacc@Charj{#1}}%
\def\uacc@Charj#1{\check@staff%
\inhgetn@i#1\relax \relax%
\ifnum\n@i<\@ight \ifodd\n@i \else\advance\n@i\@ne \fi \fi%
\zchar\n@i\C@ChaRj%
\fi}%
\def\C@ChaRj{\kern\jright\raise\jup\hbox{\Bigjazzchar\char\n@iv}}%
%
% Redefine rests
%
\def\pause{\check@staff%
\adv@box{\raise\si@\internote\hbox{\bigjazzchar\char141}}\fi}%
\def\hpause{\check@staff%
\adv@box{\raise\f@ur\internote\hbox{\bigjazzchar\char140}}\fi}%
\def\qp{\adv@restbox{\check@staff\raise4\internote\hbox{\bigjazzchar\char142}\fi}}%
\let\soupir\qp%
\def\ds@oup{\adv@restbox{\check@staff\raise4\internote\hbox{\Bigjazzchar\char143}\fi}}%
\def\qs{\adv@restbox{\check@staff\raise4\internote\hbox{\Bigjazzchar\char144}\fi}}%
\def\hs{\adv@restbox{\check@staff\raise4\internote\hbox{\Bigjazzchar\char145}\fi}}%
\def\qqs{\adv@restbox{\check@staff\raise4\internote\hbox{\Bigjazzchar\char146}\fi}}%
%
\makeatother%
%
% Rehearsal marks
%
\font\boxfont musixJAZZ scaled 870% 
\def\rehp#1#2#3{\zcharnote{#2}{\kern#3pt\raise2.8\internote\hbox{\boxfont\char36}\kern-13pt\Bigfont#1}}%
\def\reh#1{\rehp{#1}{12}{-15}}%
%
\def\meterC{\raise4\internote\hbox{\kern2pt\Bigjazzchar\char100}}%
\def\coda#1#2{\zcharnote{#1}{\kern2\internote\raise2\internote\hbox{\kern#2\Internote\bigjazzchar\char222}}}%
\def\jcodap#1#2{\zcharnote{#1}{\hbox{\kern#2\Internote\bigjazzchar\char222}}}%
\def\jcoda{\jcodap{14}0}%
\def\jsegnop#1#2{\zcharnote{#1}{\hbox{\kern#2\Internote\bigjazzchar\char37}}}%
\def\jsegno{\jsegnop{14}0}%

