diff options
author | Karl Berry <karl@freefriends.org> | 2016-05-03 22:18:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-05-03 22:18:25 +0000 |
commit | c6bfcca248f6a0ceacc867b2e70068e760a40d86 (patch) | |
tree | 381e83c0c202d556281da2f9fb9a7a1eeca41f50 /Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex | |
parent | 229d2a84824108e60025d12c971370b90ee01578 (diff) |
gregoriotex (3may16)
git-svn-id: svn://tug.org/texlive/trunk@40872 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex')
-rw-r--r-- | Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex | 2468 |
1 files changed, 1187 insertions, 1281 deletions
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex index 3344a56edcf..2655ae1da1a 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex @@ -20,32 +20,51 @@ % this file contains definitions for lines, initial, fonts, etc. \ifluatex% - \ifnum\luatexversion<76% - \gre@error{Error: this document must be compiled with LuaTeX (lualatex) 0.76 or later}% - \fi% + \ifnum\luatexversion<76% + \gre@error{Error: this document must be compiled with LuaTeX (lualatex) 0.76 or later}% + \fi% \else% - \gre@error{Error: this document must be compiled with LuaTeX (lualatex)}% + \gre@error{Error: this document must be compiled with LuaTeX (lualatex)}% \fi% +%%%%%%%%% +%% Debugging +%%%%%%%%% + \def\gre@debugmsg#1#2{% - \IfStrEq{\gre@debug}{}{}% - %false - {\IfStrEq{#1}{all}% - %true - {\gre@error{Debug error: ‘all’ is not a permitted keyword}}% - %false - {\IfStrEq{\gre@debug}{all}% - %true - {\gre@typeout{GregorioTeX debug: (#1) #2}}% - %false - {\IfSubStr{\gre@debug}{#1}% - %true - {\gre@typeout{GregorioTeX debug: (#1) #2}}% - %false - {\relax}% - }% - }% - }% + \IfStrEq{\gre@debug}{}{}% + %false + {\IfStrEq{#1}{all}% + %true + {\gre@error{Debug error: ‘all’ is not a permitted keyword}}% + %false + {\IfStrEq{\gre@debug}{,all,}% + %true + {\gre@typeout{GregorioTeX debug: (#1) #2}}% + %false + {\IfSubStr{\gre@debug}{,#1,}% + %true + {\gre@typeout{GregorioTeX debug: (#1) #2}}% + %false + {\relax}% + }% + }% + }% +}% + +\AtBeginDocument{% + \IfStrEq{\gre@debug}{}% + {}% + {% + \directlua{gregoriotex.set_debug_string([[\gre@debug]])}% + \typeout{GregorioTeX is in debug mode}% + \typeout{\gre@debug\space messages will be printed to the log.}% + {% we're starting a group in order to localize \exploregroups + \exploregroups% + \StrRemoveBraces{\gre@debug}[\gre@debug]% + \xdef\gre@debug{,\gre@debug,}% + }% + }% }% \gre@debugmsg{general}{Loading gregoriotex-main.tex}% @@ -54,37 +73,66 @@ % #1 - the deprecated macro % #2 - the correct macro to use \def\gre@deprecated#1#2{% - \ifgre@allowdeprecated% - \gre@warning{#1\space is deprecated.\MessageBreak Use #2\space instead}% - \else% - \gre@error{#1\space is deprecated.\MessageBreak Use #2\space instead}% - \fi% - \relax% + \ifgre@allowdeprecated% + \gre@warning{#1\space is deprecated.\MessageBreak Use #2\space instead}% + \else% + \gre@error{#1\space is deprecated.\MessageBreak Use #2\space instead}% + \fi% + \relax% }% \def\gre@obsolete#1#2{% - \gre@error{#1\space is obsolete.\MessageBreak Use #2\space instead}% - \relax% + \gre@error{#1\space is obsolete.\MessageBreak Use #2\space instead}% + \relax% }% -\def\gre@nothing{} +\def\gre@nothing{}% -\AtBeginDocument{\IfStrEq{\gre@debug}{}{}{\directlua{gregoriotex.set_debug_string([[\gre@debug]])}\typeout{GregorioTeX is in debug mode}\typeout{\gre@debug\space messages will be printed to the log.}}}% - -% Depending on version of TeX / LaTeX, some primitives may or may not have a -% luatex prefix, so we need to check and handle either +%%%%%%%%%%%%%%% +%% Backwards Compatibility +%%%%%%%%%%%%%%% +% Depending on version of LuaTeX / LaTeX, some primitives have different names +% We define local aliases for this eventuality, using \ifdefined to determine which +% version of the primative is available. In all cases the 'true' branch should be the +% more recent version. \ifdefined\localleftbox% - \let\gre@localleftbox\localleftbox% + \let\gre@localleftbox\localleftbox% \else% - \let\gre@localleftbox\luatexlocalleftbox% + \let\gre@localleftbox\luatexlocalleftbox% \fi% \ifdefined\localrightbox% - \let\gre@localrightbox\localrightbox% + \let\gre@localrightbox\localrightbox% +\else% + \let\gre@localrightbox\luatexlocalrightbox% +\fi% +\ifdefined\pdfextension% + \def\gre@startlink{\pdfextension startlink }% + \def\gre@endlink{\pdfextension endlink\relax}% +\else% + \let\gre@startlink\pdfstartlink% + \let\gre@endlink\pdfendlink% +\fi% +\ifdefined\savepos% + \let\gre@savepos\savepos% +\else% + \let\gre@savepos\pdfsavepos% +\fi% +\ifdefined\lastxpos% + \let\gre@lastxpos\lastxpos% +\else% + \let\gre@lastxpos\pdflastxpos% +\fi% +\ifdefined\lastypos% + \let\gre@lastypos\lastypos% \else% - \let\gre@localrightbox\luatexlocalrightbox% + \let\gre@lastypos\pdflastypos% \fi% + +%%%%%%%%%%%%%%% + + % an attribute we put on the text nodes. % if it is 1, it means that there may be a dash here if this syllable is at the end of a line % if it is 2, it means that it's never useful to typeset a dash @@ -103,12 +151,12 @@ \newluatexcatcodetable\gre@atletter % \setluatexcatcodetable\gre@atletter{% - \catcode`\@=11 % + \catcode`\@=11 % }% % The version of gregorio. All gregoriotex*.tex files must have the same. % All gtex files must also have the same version. -\xdef\gre@gregorioversion{4.1.1}% GREGORIO_VERSION - VersionManager.py +\xdef\gre@gregorioversion{4.2.0-beta1}% GREGORIO_VERSION - VersionManager.py % first some macros to allow checks for version: % Tests that all gregoriotex files are of the same version. @@ -116,8 +164,8 @@ % #2 is the version \def\gre@declarefileversion#1#2{% - \IfStrEq*{#2}{\gre@gregorioversion}{}{%else - \gre@error{uncoherent file versions: gregoriotex-main.tex is in version \number\gre@gregorioversion \space\space while #1 is in version \number#2}}% + \IfStrEq*{#2}{\gre@gregorioversion}{}{%else + \gre@error{uncoherent file versions: gregoriotex-main.tex is in version \number\gre@gregorioversion \space\space while #1 is in version \number#2}}% }% % Macro called by scores. @@ -126,23 +174,23 @@ % #1 is the version of GregorioTeX the score is made for. \def\GregorioTeXAPIVersion#1{% - \StrBefore{\gre@gregorioversion}{.}[\gre@gregoriomajorversion]% - \IfBeginWith{#1}{\gre@gregoriomajorversion}{\relax}{%else - \gre@error{GregorioTeX is in version \gre@gregorioversion \space\space while a score you included requires version #1. Please recompile your scores}}% + \StrBefore{\gre@gregorioversion}{.}[\gre@gregoriomajorversion]% + \IfBeginWith{#1}{\gre@gregoriomajorversion}{\relax}{%else + \gre@error{GregorioTeX is in version \gre@gregorioversion \space\space while a score you included requires version #1. Please recompile your scores}}% }% \RequireLuaModule{gregoriotex}% \ifcsname greskipheightcomputation\endcsname % - \directlua{gregoriotex.init(arg, false)}% + \directlua{gregoriotex.init(arg, false)}% \else % - \directlua{gregoriotex.init(arg, true)}% + \directlua{gregoriotex.init(arg, true)}% \fi % \xdef\gre@gregoriotexluaversion{\directlua{tex.write(gregoriotex.get_gregorioversion())}}% % Test to make sure that gregoriotex.lua is of the same version. \IfStrEq*{\gre@gregoriotexluaversion}{\gre@gregorioversion}{}{%else - \gre@error{uncoherent file versions: gregoriotex-main.tex is in version \number\gre@gregorioversion \space\space while gregoriotex.lua is in version \gre@gregoriotexluaversion}}% + \gre@error{uncoherent file versions: gregoriotex-main.tex is in version \number\gre@gregorioversion \space\space while gregoriotex.lua is in version \gre@gregoriotexluaversion}}% %%%%%%%%%%%%%%%%%%%%%%%% @@ -152,20 +200,20 @@ % for now, we only use an aux file with LuaTeX \ifluatex% - \newwrite\gre@gaux% + \newwrite\gre@gaux% \fi% \def\gre@write@gaux#1{% - \write\gre@gaux{#1}% - \relax % + \write\gre@gaux{#1}% + \relax % }% \def\gre@open@gaux{% - \openout\gre@gaux \jobname .gaux\relax% + \openout\gre@gaux \jobname .gaux\relax% }% \def\gre@close@gaux{% - \closeout\gre@gaux % + \closeout\gre@gaux % }% @@ -197,6 +245,7 @@ \let\gre@pitch@overbraceglyph\gre@pitch@g % \let\gre@pitch@bar\gre@pitch@g % \let\gre@pitch@dummy\gre@pitch@g % +\let\gre@pitch@nominal\gre@pitch@e % % factor is the factor with which you open you font (the number after the at). It will decide almost everything (spaces, etc.), so it is particularly important. % it is set to the default value : 17 (the value that makes it look like a standard graduale) @@ -215,61 +264,61 @@ % macro called to go to the next line \def\GreNewLine{% - \gre@debugmsg{lineheight}{GreNewLine}% - \gre@newlinecommon{0}{0}% - \relax% + \gre@debugmsg{lineheight}{GreNewLine}% + \gre@newlinecommon{0}{0}% + \relax% }% % basically same as above, but this one does a \hfill, so the lines are not justified \def\GreNewParLine{% - \gre@debugmsg{lineheight}{GreNewParLine}% - \gre@newlinecommon{1}{0}% - \relax% + \gre@debugmsg{lineheight}{GreNewParLine}% + \gre@newlinecommon{1}{0}% + \relax% }% % the macro we call each time we force a changing of line, it automatically sets \gre@knownline, and adjusts left spaces % #1 is 0 in case of gabc z, 1 for Z % #2 is 0 in the normal case, 1 after a bar in the new spacing algorithm \def\gre@newlinecommon#1#2{% - \ifgre@blockeolcustos\ifnum\gre@insidediscretionary=0\relax % - \gre@localrightbox{}% - \fi\fi % - \ifgre@boxing\else% - \ifnum\gre@biginitial=1\relax % - \ifcase\gre@knownline % - % 0: should not happend... - \or % 1 - \gre@adjustsecondline % - \or %2 - \gre@adjustthirdline % - \fi % - \fi % - \global\advance\gre@knownline by 1\relax % - \global\gre@lastoflinecount=2\relax % - \ifnum#2=0\relax % - % we have to repeat the end of syllable shifts here because the manual line breaks will occur before we get to the regular shifting code in \GreSyllable - \ifdim\gre@dimen@enddifference <0pt\relax% - %% important, else we are not really at the end of the syllable - \kern -\gre@dimen@enddifference\relax% - \fi% - \ifgre@eolshiftsenabled% - \GreNoBreak% we want to make sure this shift doesn't get separated from the previous one if both occur - \gre@calculate@eolshift{\gre@dimen@enddifference}% - \gre@debugmsg{eolshift}{Manual end of line shift: \the\gre@dimen@eolshift}% - \kern -\gre@dimen@eolshift\relax% - \fi% - \fi % - \ifnum\gre@insidediscretionary=0\relax % - \gre@updateleftbox % - \fi % - \ifnum#1=1\relax % - \GreNoBreak % - \hfill % - \fi % - \gre@penalty{-10001}% - \fi % - \gre@adjustlineifnecessary\relax % - \gre@reseteolcustos\relax % + \ifgre@blockeolcustos\ifnum\gre@insidediscretionary=0\relax % + \gre@localrightbox{}% + \fi\fi % + \ifgre@boxing\else% + \ifnum\gre@biginitial=1\relax % + \ifcase\gre@knownline % + % 0: should not happend... + \or % 1 + \gre@adjustsecondline % + \or %2 + \gre@adjustthirdline % + \fi % + \fi % + \global\advance\gre@knownline by 1\relax % + \global\gre@lastoflinecount=2\relax % + \ifnum#2=0\relax % + % we have to repeat the end of syllable shifts here because the manual line breaks will occur before we get to the regular shifting code in \GreSyllable + \ifdim\gre@dimen@enddifference <0pt\relax% + %% important, else we are not really at the end of the syllable + \kern -\gre@dimen@enddifference\relax% + \fi% + \ifgre@eolshiftsenabled% + \GreNoBreak% we want to make sure this shift doesn't get separated from the previous one if both occur + \gre@calculate@eolshift{\gre@dimen@enddifference}% + \gre@debugmsg{eolshift}{Manual end of line shift: \the\gre@dimen@eolshift}% + \kern -\gre@dimen@eolshift\relax% + \fi% + \fi % + \ifnum\gre@insidediscretionary=0\relax % + \gre@updateleftbox % + \fi % + \ifnum#1=1\relax % + \GreNoBreak % + \hfill % + \fi % + \gre@penalty{-10001}% + \fi % + \gre@adjustlineifnecessary\relax % + \gre@reseteolcustos\relax % }% \def\gre@mark@translation{\directlua{gregoriotex.mark_translation()}}% @@ -284,9 +333,9 @@ \newbox\gre@box@temp@width% \def\gre@widthof#1{% - \setbox\gre@box@temp@width=\hbox{#1}% - \global\gre@dimen@temp@three=\wd\gre@box@temp@width% - \relax% + \setbox\gre@box@temp@width=\hbox{#1}% + \global\gre@dimen@temp@three=\wd\gre@box@temp@width% + \relax% }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -305,224 +354,210 @@ % macro to call before the call of \initial \def\gre@setbiginitial{% - \gre@debugmsg{general}{setting BIG initial}% - \global\gre@biginitial=1\relax % - \relax % + \gre@debugmsg{general}{setting BIG initial}% + \global\gre@biginitial=1\relax % + \relax % }% % macro to cancel before the call of \initial \def\gre@normalinitial{% - \gre@debugmsg{general}{setting normal initial}% - \global\gre@biginitial=0\relax % - \relax % + \gre@debugmsg{general}{setting normal initial}% + \global\gre@biginitial=0\relax % + \relax % }% % macro to call before the first syllable, but after setinitialclef \def\gre@adjustsecondline{% - \gre@dimen@additionalleftspace=\gre@dimen@initialwidth\relax% - \gre@updateleftbox % - \relax % + \gre@dimen@additionalleftspace=\gre@dimen@initialwidth\relax% + \gre@updateleftbox % + \relax % }% % macro to call during the second line \def\gre@adjustthirdline{% - \gre@dimen@additionalleftspace= 0 pt\relax% - \gre@updateleftbox % - \relax % + \gre@dimen@additionalleftspace= 0 pt\relax% + \gre@updateleftbox % + \relax % }% \newif\ifgre@thirdlineadjustmentnecessary % \def\gre@adjustlineifnecessary{% - \ifgre@thirdlineadjustmentnecessary % - \gre@adjustthirdline % - \gre@thirdlineadjustmentnecessaryfalse % - \fi % + \ifgre@thirdlineadjustmentnecessary % + \gre@adjustthirdline % + \gre@thirdlineadjustmentnecessaryfalse % + \fi % }% \def\gre@updateleftbox{% - \gre@updatelinewidth % - \gre@updatelinesclef % + \gre@updatelinewidth % + \gre@updatelinesclef % }% \def\gre@updatelinewidth{% - \gre@debugmsg{ifdim}{ additionalleftspace = 0pt}% - \ifdim\gre@dimen@additionalleftspace=0pt\relax% - \else % - \gre@dimen@temp@five=\gre@dimen@stafflinewidth\relax% - \global\advance\gre@dimen@stafflinewidth by -\gre@dimen@additionalleftspace\relax% - \gre@generatelines % - \global\gre@dimen@stafflinewidth=\gre@dimen@temp@five % - \fi % + \gre@debugmsg{ifdim}{ additionalleftspace = 0pt}% + \ifdim\gre@dimen@additionalleftspace=0pt\relax% + \else % + \gre@dimen@temp@five=\gre@dimen@stafflinewidth\relax% + \global\advance\gre@dimen@stafflinewidth by -\gre@dimen@additionalleftspace\relax% + \gre@generatelines % + \global\gre@dimen@stafflinewidth=\gre@dimen@temp@five % + \fi % }% \def\greillumination#1{% - \setbox\gre@box@initial=\hbox{#1}% + \setbox\gre@box@initial=\hbox{#1}% }% \def\gre@setinitial#1{% - % see comments on this function to see what it does - \gre@debugmsg{commentary}{Time to calculate the true raise.}% - \gre@calculate@commentarytrueraise% - % we start by printing the commentary - % when doing this we place it inside a box as which is linewidth wide with an \hfill before to get it to align to the right of the page - % we then place that box inside one of 0 width so that our cursor doesn't move when we place the commentary - \ifvoid\gre@box@commentary\else% - \gre@debugmsg{commentary}{I am printing a commentary box}% - \raise\gre@dimen@commentarytrueraise\hbox to 0pt{\hbox to \gre@dimen@linewidth{\hfill\box\gre@box@commentary}}% - \fi% - \gre@debugmsg{annotation}{Time to calculate the true raise.}% - \gre@calculate@annotationtrueraise % - % we print the initial always at the same place, and then we print the gre@box@annotation, centered - % first we print the initial - \gre@dimen@temp@five = \dimexpr(\gre@dimen@textlower+\gre@space@dimen@initialraise)\relax% - % if it is a big initial we print it on the second line - \ifnum\gre@biginitial=0\relax % - \ifvoid\gre@box@initial% - \gre@debugmsg{initial}{Fill initial box a}% - \setbox\gre@box@initial=\hbox{\gre@style@initial\gre@fixedtextformat{#1}\endgre@style@initial}% - \fi% - \ifx\gre@empty@initialformat\greinitialformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\greinitialformat}{\protect\grechangestyle{initial}}% OBSOLETE - \fi% OBSOLETE - \gre@debugmsg{ifdim}{ manualinitialwidth = 0pt}% - \ifdim\gre@space@dimen@manualinitialwidth=0 pt\relax% - \global\gre@dimen@initialwidth=\wd\gre@box@initial % - \else% - \gre@style@initial% - \global\gre@dimen@initialwidth=\gre@space@dimen@manualinitialwidth\relax% - \endgre@style@initial% - \ifx\gre@empty@initialformat\greinitialformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\greinitialformat}{\protect\grechangestyle{initial}}% OBSOLETE - \fi% OBSOLETE - \fi% - \gre@debugmsg{ifdim}{ wd(gre@box@annotation) > initialwidth}% - \ifdim\wd\gre@box@annotation>\gre@dimen@initialwidth\relax% - \global\gre@dimen@initialwidth=\wd\gre@box@annotation% - \fi% - \gre@debugmsg{annotation}{Width check completed.}% - \setbox\gre@box@initial=\hbox to \gre@dimen@initialwidth {\hss\raise \gre@dimen@temp@five\box\gre@box@initial\hss}% - \gre@debugmsg{annotation}{Initial set.}% - \gre@style@initial% - \global\gre@dimen@temp@four = \gre@space@dimen@beforeinitialshift\relax% - \endgre@style@initial% - \ifx\gre@empty@initialformat\greinitialformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\greinitialformat}{\protect\grechangestyle{initial}}% OBSOLETE - \fi% OBSOLETE - \else % - \ifgre@allowdeprecated%%% DEPRECATED for removal in 5.0 - \gre@warning{biginitial style is deprecated, but the old\MessageBreak behavior will be used since deprecated usage is\MessageBreak currently enabled. This behavior will disappear\MessageBreak in 5.0, so consider disabling deprecated usage\MessageBreak and switching to the initial style instead. (See\MessageBreak UPGRADE.md for more information)}%%% DEPRECATED for removal in 5.0 - \fi%%% DEPRECATED for removal in 5.0 - \advance\gre@dimen@temp@five by \dimexpr(-\gre@dimen@additionalbottomspace % - - \gre@space@dimen@spacebeneathtext % - - \gre@space@dimen@spacelinestext % - - 4\gre@dimen@interstafflinespace % - - 4\gre@dimen@stafflineheight % - - \gre@dimen@currenttranslationheight % - - \f@size pt % - + \gre@space@dimen@initialraise)\relax% - \ifvoid\gre@box@initial% - \gre@debugmsg{initial}{fill big initial box}% - \ifgre@allowdeprecated%%% DEPRECATED for removal in 5.0 - \setbox\gre@box@initial=\hbox{\gre@style@biginitial\gre@fixedtextformat{#1}\endgre@style@biginitial}% DEPRECATED for removal in 5.0 - \else%%% DEPRECATED for removal in 5.0 - \setbox\gre@box@initial=\hbox{\gre@style@initial\gre@fixedtextformat{#1}\endgre@style@initial}% keep this line - \fi%%% DEPRECATED for removal in 5.0 - \fi% - \ifx\gre@empty@biginitialformat\grebiginitialformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\grebiginitialformat}{\protect\grechangestyle{biginitial}}% OBSOLETE - \fi% OBSOLETE - \gre@debugmsg{ifdim}{ manualinitialwidth = 0pt}% - \ifdim\gre@space@dimen@manualinitialwidth=0 pt\relax% - \global\gre@dimen@initialwidth=\wd\gre@box@initial % - \else% - \ifgre@allowdeprecated%%% DEPRECATED for removal in 5.0 - \gre@style@biginitial%%% DEPRECATED for removal in 5.0 - \global\gre@dimen@initialwidth=\gre@space@dimen@manualinitialwidth\relax%%% DEPRECATED for removal in 5.0 - \endgre@style@biginitial%%% DEPRECATED for removal in 5.0 - \else%%% DEPRECATED for removal in 5.0 - \gre@style@initial% keep this line - \global\gre@dimen@initialwidth=\gre@space@dimen@manualinitialwidth\relax% keep this line - \endgre@style@initial% keep this line - \fi%%% DEPRECATED for removal in 5.0 - \ifx\gre@empty@biginitialformat\grebiginitialformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\grebiginitialformat}{\protect\grechangestyle{biginitial}}% OBSOLETE - \fi% OBSOLETE - \fi% - \gre@debugmsg{ifdim}{ wd(GreAboveinitialfirstbox) > initialwidth}% - \ifdim\wd\gre@box@annotation>\gre@dimen@initialwidth\relax% - \global\gre@dimen@initialwidth=\wd\gre@box@annotation% - \fi% - \setbox\gre@box@initial=\hbox{\vtop to 0pt{\hbox to \gre@dimen@initialwidth {\hss\raise \gre@dimen@temp@five\box\gre@box@initial\hss}\vss}}% - \ifgre@allowdeprecated%%% DEPRECATED for removal in 5.0 - \gre@style@biginitial%%% DEPRECATED for removal in 5.0 - \global\gre@dimen@temp@four = \gre@space@dimen@beforeinitialshift\relax%%% DEPRECATED for removal in 5.0 - \endgre@style@biginitial%%% DEPRECATED for removal in 5.0 - \else%%% DEPRECATED for removal in 5.0 - \gre@style@initial% keep this line - \global\gre@dimen@temp@four = \gre@space@dimen@beforeinitialshift\relax% keep this line - \endgre@style@initial% keep this line - \fi%%% DEPRECATED for removal in 5.0 - \ifx\gre@empty@biginitialformat\grebiginitialformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\grebiginitialformat}{\protect\grechangestyle{biginitial}}% OBSOLETE - \fi% OBSOLETE - \fi % - \hskip\gre@dimen@temp@four % - \global\advance\gre@dimen@initialwidth by \gre@dimen@temp@four % - \gre@debugmsg{annotation}{Ready to place initial.}% - \box\gre@box@initial% - \ifnum\gre@biginitial=0\relax% - \gre@style@initial% - \global\gre@dimen@temp@four = \gre@space@dimen@afterinitialshift\relax% - \endgre@style@initial% - \ifx\gre@empty@initialformat\greinitialformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\greinitialformat}{\protect\grechangestyle{initial}}% OBSOLETE - \fi% OBSOLETE - \else% - \ifgre@allowdeprecated%%% DEPRECATED for removal in 5.0 - \gre@style@biginitial%%% DEPRECATED for removal in 5.0 - \global\gre@dimen@temp@four = \gre@space@dimen@afterinitialshift\relax%%% DEPRECATED for removal in 5.0 - \endgre@style@biginitial%%% DEPRECATED for removal in 5.0 - \else%%% DEPRECATED for removal in 5.0 - \gre@style@initial% keep this line - \global\gre@dimen@temp@four = \gre@space@dimen@afterinitialshift\relax% keep this line - \endgre@style@initial% keep this line - \fi%%% DEPRECATED for removal in 5.0 - \ifx\gre@empty@biginitialformat\grebiginitialformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\grebiginitialformat}{\protect\grechangestyle{biginitial}}% OBSOLETE - \fi% OBSOLETE - \fi% - \hskip\gre@dimen@temp@four % - \global\advance\gre@dimen@initialwidth by \gre@dimen@temp@four% - % then we center the annotation box above the initial, if there is one - \gre@debugmsg{annotation}{Time to set the annotation.}% - \ifvoid\gre@box@annotation\relax% - \gre@debugmsg{annotation}{There is no annotation.}% - \else % - \gre@debugmsg{annotation}{Calculate horizontal position.}% - \gre@dimen@temp@five=\dimexpr((\gre@dimen@initialwidth - \wd\gre@box@annotation) / 2)\relax % - \gre@skip@temp@four = -\gre@dimen@initialwidth\relax% - \hskip\gre@skip@temp@four % - \kern\gre@dimen@temp@five % - \gre@debugmsg{annotation}{And place the annotation.}% - \raise\gre@dimen@annotationtrueraise\box\gre@box@annotation% - \gre@debugmsg{annotation}{Move to beginning of staff.}% - \kern\gre@dimen@temp@five % - \fi % - \relax % + % see comments on this function to see what it does + \gre@debugmsg{commentary}{Time to calculate the true raise.}% + \gre@calculate@commentarytrueraise% + % we start by printing the commentary + % when doing this we place it inside a box as which is linewidth wide with an \hfill before to get it to align to the right of the page + % we then place that box inside one of 0 width so that our cursor doesn't move when we place the commentary + \ifvoid\gre@box@commentary\else% + \gre@debugmsg{commentary}{I am printing a commentary box}% + \raise\gre@dimen@commentarytrueraise\hbox to 0pt{\hbox to \gre@dimen@linewidth{\hfill\box\gre@box@commentary}}% + \fi% + \gre@debugmsg{annotation}{Time to calculate the true raise.}% + \gre@calculate@annotationtrueraise % + % we print the initial always at the same place, and then we print the gre@box@annotation, centered + % first we print the initial + \gre@dimen@temp@five = \dimexpr(\gre@dimen@textlower+\gre@space@dimen@initialraise)\relax% + % if it is a big initial we print it on the second line + \ifnum\gre@biginitial=0\relax % + \ifvoid\gre@box@initial% + \gre@debugmsg{initial}{Fill initial box a}% + \setbox\gre@box@initial=\hbox{\gre@style@initial\gre@fixedtextformat{#1}\endgre@style@initial}% + \fi% + \gre@debugmsg{ifdim}{ manualinitialwidth = 0pt}% + \ifdim\gre@space@dimen@manualinitialwidth=0 pt\relax% + \global\gre@dimen@initialwidth=\wd\gre@box@initial % + \else% + \gre@style@initial% + \global\gre@dimen@initialwidth=\gre@space@dimen@manualinitialwidth\relax% + \endgre@style@initial% + \fi% + \gre@debugmsg{ifdim}{ wd(gre@box@annotation) > initialwidth}% + \ifdim\wd\gre@box@annotation>\gre@dimen@initialwidth\relax% + \global\gre@dimen@initialwidth=\wd\gre@box@annotation% + \fi% + \gre@debugmsg{annotation}{Width check completed.}% + \setbox\gre@box@initial=\hbox to \gre@dimen@initialwidth {\hss\raise \gre@dimen@temp@five\box\gre@box@initial\hss}% + \gre@debugmsg{annotation}{Initial set.}% + \gre@style@initial% + \global\gre@dimen@temp@four = \gre@space@dimen@beforeinitialshift\relax% + \endgre@style@initial% + \else % + \ifgre@allowdeprecated%%% DEPRECATED for removal in 5.0 + \gre@warning{% + biginitial style is deprecated, but since you are\MessageBreak % + allowing deprecated usage, Gregorio will continue\MessageBreak % + to use your biginitial style as it did before.\MessageBreak % + However, in upcoming version 5.0, Gregorio will\MessageBreak % + only support one initial style for both big and\MessageBreak % + small initials. Consider disabling deprecated\MessageBreak % + usage by passing the [allowdeprecated=false]\MessageBreak % + package option, which will then require you to\MessageBreak % + set the initial style before the appropriate\MessageBreak % + scores to style all initials: set the initial\MessageBreak % + style for a big initial before a score with a big\MessageBreak % + initial and back for a small initial afterwards.\MessageBreak % + (See UPGRADE.md for more information)\MessageBreak % + ...}%%% DEPRECATED for removal in 5.0 + \fi%%% DEPRECATED for removal in 5.0 + \advance\gre@dimen@temp@five by \dimexpr(-\gre@dimen@additionalbottomspace % + - \gre@space@dimen@spacebeneathtext % + - \gre@space@dimen@spacelinestext % + - 4\gre@dimen@interstafflinespace % + - 4\gre@dimen@stafflineheight % + - \gre@dimen@currenttranslationheight % + - \f@size pt % + + \gre@space@dimen@initialraise)\relax% + \ifvoid\gre@box@initial% + \gre@debugmsg{initial}{fill big initial box}% + \ifgre@allowdeprecated%%% DEPRECATED for removal in 5.0 + \setbox\gre@box@initial=\hbox{\gre@style@biginitial\gre@fixedtextformat{#1}\endgre@style@biginitial}% DEPRECATED for removal in 5.0 + \else%%% DEPRECATED for removal in 5.0 + \setbox\gre@box@initial=\hbox{\gre@style@initial\gre@fixedtextformat{#1}\endgre@style@initial}% keep this line + \fi%%% DEPRECATED for removal in 5.0 + \fi% + \gre@debugmsg{ifdim}{ manualinitialwidth = 0pt}% + \ifdim\gre@space@dimen@manualinitialwidth=0 pt\relax% + \global\gre@dimen@initialwidth=\wd\gre@box@initial % + \else% + \ifgre@allowdeprecated%%% DEPRECATED for removal in 5.0 + \gre@style@biginitial%%% DEPRECATED for removal in 5.0 + \global\gre@dimen@initialwidth=\gre@space@dimen@manualinitialwidth\relax%%% DEPRECATED for removal in 5.0 + \endgre@style@biginitial%%% DEPRECATED for removal in 5.0 + \else%%% DEPRECATED for removal in 5.0 + \gre@style@initial% keep this line + \global\gre@dimen@initialwidth=\gre@space@dimen@manualinitialwidth\relax% keep this line + \endgre@style@initial% keep this line + \fi%%% DEPRECATED for removal in 5.0 + \fi% + \gre@debugmsg{ifdim}{ wd(GreAboveinitialfirstbox) > initialwidth}% + \ifdim\wd\gre@box@annotation>\gre@dimen@initialwidth\relax% + \global\gre@dimen@initialwidth=\wd\gre@box@annotation% + \fi% + \setbox\gre@box@initial=\hbox{\vtop to 0pt{\hbox to \gre@dimen@initialwidth {\hss\raise \gre@dimen@temp@five\box\gre@box@initial\hss}\vss}}% + \ifgre@allowdeprecated%%% DEPRECATED for removal in 5.0 + \gre@style@biginitial%%% DEPRECATED for removal in 5.0 + \global\gre@dimen@temp@four = \gre@space@dimen@beforeinitialshift\relax%%% DEPRECATED for removal in 5.0 + \endgre@style@biginitial%%% DEPRECATED for removal in 5.0 + \else%%% DEPRECATED for removal in 5.0 + \gre@style@initial% keep this line + \global\gre@dimen@temp@four = \gre@space@dimen@beforeinitialshift\relax% keep this line + \endgre@style@initial% keep this line + \fi%%% DEPRECATED for removal in 5.0 + \fi % + \hskip\gre@dimen@temp@four % + \global\advance\gre@dimen@initialwidth by \gre@dimen@temp@four % + \gre@debugmsg{annotation}{Ready to place initial.}% + \ifgre@showlyrics% + \box\gre@box@initial% + \else% + \kern\wd\gre@box@initial% + \fi% + \ifnum\gre@biginitial=0\relax% + \gre@style@initial% + \global\gre@dimen@temp@four = \gre@space@dimen@afterinitialshift\relax% + \endgre@style@initial% + \else% + \ifgre@allowdeprecated%%% DEPRECATED for removal in 5.0 + \gre@style@biginitial%%% DEPRECATED for removal in 5.0 + \global\gre@dimen@temp@four = \gre@space@dimen@afterinitialshift\relax%%% DEPRECATED for removal in 5.0 + \endgre@style@biginitial%%% DEPRECATED for removal in 5.0 + \else%%% DEPRECATED for removal in 5.0 + \gre@style@initial% keep this line + \global\gre@dimen@temp@four = \gre@space@dimen@afterinitialshift\relax% keep this line + \endgre@style@initial% keep this line + \fi%%% DEPRECATED for removal in 5.0 + \fi% + \hskip\gre@dimen@temp@four % + \global\advance\gre@dimen@initialwidth by \gre@dimen@temp@four% + % then we center the annotation box above the initial, if there is one + \gre@debugmsg{annotation}{Time to set the annotation.}% + \ifvoid\gre@box@annotation\relax% + \gre@debugmsg{annotation}{There is no annotation.}% + \else % + \gre@debugmsg{annotation}{Calculate horizontal position.}% + \gre@dimen@temp@five=\dimexpr((\gre@dimen@initialwidth - \wd\gre@box@annotation) / 2)\relax % + \gre@skip@temp@four = -\gre@dimen@initialwidth\relax% + \hskip\gre@skip@temp@four % + \kern\gre@dimen@temp@five % + \gre@debugmsg{annotation}{And place the annotation.}% + \raise\gre@dimen@annotationtrueraise\box\gre@box@annotation% + \gre@debugmsg{annotation}{Move to beginning of staff.}% + \kern\gre@dimen@temp@five % + \fi % + \relax % }% \def\gre@noinitial{% - \setbox\gre@box@initial=\box\voidb@x% - \global\gre@dimen@initialwidth=0pt\relax% - \relax % + \setbox\gre@box@initial=\box\voidb@x% + \global\gre@dimen@initialwidth=0pt\relax% + \relax % }% @@ -538,14 +573,14 @@ \gre@annotationbottomlinefalse% \def\gresetannotationby#1{% - \IfStrEqCase{#1}{% - {topline}% - {\gre@annotationbottomlinefalse}% - {bottomline}% - {\gre@annotationbottomlinetrue}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetannotationby\MessageBreak Possible options are: 'topline' and 'bottomline'}% - ]% + \IfStrEqCase{#1}{% + {topline}% + {\gre@annotationbottomlinefalse}% + {bottomline}% + {\gre@annotationbottomlinetrue}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetannotationby\MessageBreak Possible options are: 'topline' and 'bottomline'}% + ]% }% % This flag controls whether the top (0), baseline (1), or bottom (2) of the control line is aligned with the top line of the staff before applying annotationraise. @@ -553,117 +588,88 @@ \gre@count@annotationvalign=1% \def\gresetannotationvalign#1{% - \IfStrEqCase{#1}{% - {top}% - {\gre@count@annotationvalign=0}% - {baseline}% - {\gre@count@annotationvalign=1}% - {bottom}% - {\gre@count@annotationvalign=2}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetannotationvalign\MessageBreak Possible options are: 'top', 'baseline' and 'bottom'}% - ]% + \IfStrEqCase{#1}{% + {top}% + {\gre@count@annotationvalign=0}% + {baseline}% + {\gre@count@annotationvalign=1}% + {bottom}% + {\gre@count@annotationvalign=2}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetannotationvalign\MessageBreak Possible options are: 'top', 'baseline' and 'bottom'}% + ]% }% \def\gre@annotation[#1]#2{% - \ifx l#1\relax% - \let\gre@rightfill\hfil% - \let\gre@leftfill\relax% - \else\ifx r#1\relax% - \let\gre@rightfill\relax% - \let\gre@leftfill\hfil% - \else\ifx c#1\relax% - \let\gre@rightfill\hfil% - \let\gre@leftfill\hfil% - \else% - \gre@error{Unrecognzied alignment option for \protect\greannotation}% - \fi\fi\fi% - % first we determine the widest box - \gre@widthof{\gre@style@annotation#2\endgre@style@annotation}% - \ifdim\gre@dimen@temp@three < \wd\gre@box@annotation\relax% - \gre@dimen@temp@three = \wd\gre@box@annotation\relax% - \fi% - \ifvoid\gre@box@annotation% - \gre@debugmsg{annotation}{We're on the first line of the annotation.}% - \setbox\gre@box@annotation = \hbox to \gre@dimen@temp@three{\gre@leftfill\gre@style@annotation#2\endgre@style@annotation\gre@rightfill}% - % We set the initial value for annotationtrueraise based on the annotationvalign setting. We always do this because if there is only one line in the annotation, then the topline is the bottomline. - \gre@debugmsg{annnotation}{Initial set point.}% - \ifcase\gre@count@annotationvalign\relax% - %case 0 = top of first line - \global\gre@dimen@annotationtrueraise=-\ht\gre@box@annotation\relax% - \gre@debugmsg{annotation}{Aligning to top of first line: \the\gre@dimen@annotationtrueraise}% - \or %case 1 = baseline of first line - \global\gre@dimen@annotationtrueraise= 0pt\relax% - \gre@debugmsg{annotation}{Aligning to baseline of first line: \the\gre@dimen@annotationtrueraise}% - \or %case 2 = bottom of first line - \global\gre@dimen@annotationtrueraise=\dp\gre@box@annotation\relax% - \gre@debugmsg{annotation}{Aligning to bottom of first line: \the\gre@dimen@annotationtrueraise}% - \else% Bug - \gre@bug{Invalid value for \protect\gre@count@annotationvalign}% - \fi% - \else% - \gre@debugmsg{annotation}{We're not on the first line of the annotation.}% - \setbox\gre@box@old = \hbox to \gre@dimen@temp@three{\gre@leftfill\box\gre@box@annotation\gre@rightfill}% - \setbox\gre@box@add = \hbox to \gre@dimen@temp@three{\gre@leftfill\gre@style@annotation#2\endgre@style@annotation\gre@rightfill}% - % if the user has asked for the bottom line to be the controlling line, then we need to change the value of the annotationtrueraise appropriately - \gre@style@annotation% to make sure that an annotationseparation in font relative units translates correctly - \ifgre@annotationbottomline% - \ifcase\gre@count@annotationvalign\relax% - %case 0 = top of first line - \global\gre@dimen@annotationtrueraise=\dimexpr\ht\gre@box@old+\dp\gre@box@old+\gre@space@dimen@annotationseparation-\ht\gre@box@add\relax% - \gre@debugmsg{annotation}{Aligning to top of last line: \the\gre@dimen@annotationtrueraise}% - \or %case 1 = baseline of first line - \global\gre@dimen@annotationtrueraise=\dimexpr\ht\gre@box@old+\dp\gre@box@old+\gre@space@dimen@annotationseparation\relax% - \gre@debugmsg{annotation}{Aligning to baseline of last line: \the\gre@dimen@annotationtrueraise}% - \or %case 2 = bottom of first line - \global\gre@dimen@annotationtrueraise=\dimexpr\ht\gre@box@old+\dp\gre@box@old+\gre@space@dimen@annotationseparation+\dp\gre@box@add\relax% - \gre@debugmsg{annotation}{Aligning to bottom of last line: \the\gre@dimen@annotationtrueraise}% - \else% Bug - \gre@bug{Invalid value for \protect\gre@count@annotationvalign}% - \fi% - \fi% - \endgre@style@annotation% - \setbox\gre@box@annotation = \vtop spread \gre@space@dimen@annotationseparation\relax {\offinterlineskip\box\gre@box@old\vss\box\gre@box@add}% - \fi% -}% - - -\def\gresetfirstlineaboveinitial#1#2{%OBSOLETE - \gre@obsolete{\protect\gresetfirstlineaboveinitial}{\protect\greannotation}% -}% - -\def\gresetfirstannotation#1{%OBSOLETE - \gre@obsolete{\protect\gresetfirstannotation}{\protect\greannotation}% -}% - -\let\setfirstannotation\gresetfirstannotation%OBSOLETE - -\def\gresetsecondannotation#1{%OBSOLETE - \gre@obsolete{\protect\gresetsecondannotation}{\protect\greannotation}% -}% - -\let\setsecondannotation\gresetsecondannotation%OBSOLETE + \ifx l#1\relax% + \let\gre@rightfill\hfil% + \let\gre@leftfill\relax% + \else\ifx r#1\relax% + \let\gre@rightfill\relax% + \let\gre@leftfill\hfil% + \else\ifx c#1\relax% + \let\gre@rightfill\hfil% + \let\gre@leftfill\hfil% + \else% + \gre@error{Unrecognzied alignment option for \protect\greannotation}% + \fi\fi\fi% + % first we determine the widest box + \gre@widthof{\gre@style@annotation#2\endgre@style@annotation}% + \ifdim\gre@dimen@temp@three < \wd\gre@box@annotation\relax% + \gre@dimen@temp@three = \wd\gre@box@annotation\relax% + \fi% + \ifvoid\gre@box@annotation% + \gre@debugmsg{annotation}{We're on the first line of the annotation.}% + \setbox\gre@box@annotation = \hbox to \gre@dimen@temp@three{\gre@leftfill\gre@style@annotation#2\endgre@style@annotation\gre@rightfill}% + % We set the initial value for annotationtrueraise based on the annotationvalign setting. We always do this because if there is only one line in the annotation, then the topline is the bottomline. + \gre@debugmsg{annnotation}{Initial set point.}% + \ifcase\gre@count@annotationvalign\relax% + %case 0 = top of first line + \global\gre@dimen@annotationtrueraise=-\ht\gre@box@annotation\relax% + \gre@debugmsg{annotation}{Aligning to top of first line: \the\gre@dimen@annotationtrueraise}% + \or %case 1 = baseline of first line + \global\gre@dimen@annotationtrueraise= 0pt\relax% + \gre@debugmsg{annotation}{Aligning to baseline of first line: \the\gre@dimen@annotationtrueraise}% + \or %case 2 = bottom of first line + \global\gre@dimen@annotationtrueraise=\dp\gre@box@annotation\relax% + \gre@debugmsg{annotation}{Aligning to bottom of first line: \the\gre@dimen@annotationtrueraise}% + \else% Bug + \gre@bug{Invalid value for \protect\gre@count@annotationvalign}% + \fi% + \else% + \gre@debugmsg{annotation}{We're not on the first line of the annotation.}% + \setbox\gre@box@old = \hbox to \gre@dimen@temp@three{\gre@leftfill\box\gre@box@annotation\gre@rightfill}% + \setbox\gre@box@add = \hbox to \gre@dimen@temp@three{\gre@leftfill\gre@style@annotation#2\endgre@style@annotation\gre@rightfill}% + % if the user has asked for the bottom line to be the controlling line, then we need to change the value of the annotationtrueraise appropriately + \gre@style@annotation% to make sure that an annotationseparation in font relative units translates correctly + \ifgre@annotationbottomline% + \ifcase\gre@count@annotationvalign\relax% + %case 0 = top of first line + \global\gre@dimen@annotationtrueraise=\dimexpr\ht\gre@box@old+\dp\gre@box@old+\gre@space@dimen@annotationseparation-\ht\gre@box@add\relax% + \gre@debugmsg{annotation}{Aligning to top of last line: \the\gre@dimen@annotationtrueraise}% + \or %case 1 = baseline of first line + \global\gre@dimen@annotationtrueraise=\dimexpr\ht\gre@box@old+\dp\gre@box@old+\gre@space@dimen@annotationseparation\relax% + \gre@debugmsg{annotation}{Aligning to baseline of last line: \the\gre@dimen@annotationtrueraise}% + \or %case 2 = bottom of first line + \global\gre@dimen@annotationtrueraise=\dimexpr\ht\gre@box@old+\dp\gre@box@old+\gre@space@dimen@annotationseparation+\dp\gre@box@add\relax% + \gre@debugmsg{annotation}{Aligning to bottom of last line: \the\gre@dimen@annotationtrueraise}% + \else% Bug + \gre@bug{Invalid value for \protect\gre@count@annotationvalign}% + \fi% + \fi% + \endgre@style@annotation% + \setbox\gre@box@annotation = \vtop spread \gre@space@dimen@annotationseparation\relax {\offinterlineskip\box\gre@box@old\vss\box\gre@box@add}% + \fi% +}% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% macros for the score reference (unused) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\grescorereference#1{% DEPRECATED by 4.1 - \ifgre@allowdeprecated% - \gre@warning{\protect\grescorereference\space is deprecated.\MessageBreak It does nothing; stop using it.}% - \else% - \gre@error{\protect\grescorereference\space is deprecated.\MessageBreak It does nothing; stop using it.}% - \fi% - \relax % -}% - -\def\GreScoreReference#1{%OBSOLETE - \gre@error{\protect\GreScoreReference\space is obsolete.\MessageBreak It does nothing; stop using it.}% - \relax% -}% - -\def\scorereference#1{%OBSOLETE - \gre@error{\protect\scorereference\space is obsolete.\MessageBreak It does nothing; stop using it.}% +\def\grescorereference#1{% OBSOLETE + \gre@error{\protect\grescorereference\space is obsolete.\MessageBreak It does nothing; stop using it.}% + \relax % }% @@ -672,111 +678,97 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\gre@writemode#1#2#3{% - \greannotation{% - \gre@style@modeline #1\endgre@style@modeline % - \gre@style@modemodifier \directlua{gregoriotex.mode_part("\luatexluaescapestring{#2}")}\endgre@style@modemodifier % - \gre@style@modedifferentia \directlua{gregoriotex.mode_part("\luatexluaescapestring{#3}")}\endgre@style@modedifferentia % - \relax % - }% - \relax % + \greannotation{% + \gre@style@modeline #1\endgre@style@modeline % + \gre@style@modemodifier \directlua{gregoriotex.mode_part("\luatexluaescapestring{#2}")}\endgre@style@modemodifier % + \gre@style@modedifferentia \directlua{gregoriotex.mode_part("\luatexluaescapestring{#3}")}\endgre@style@modedifferentia % + \relax % + }% + \relax % }% \def\GreMode#1#2#3{% - \ifvoid\gre@box@annotation% - \gre@writemode{#1}{#2}{#3}% - \fi% - \relax% + \ifvoid\gre@box@annotation% + \gre@writemode{#1}{#2}{#3}% + \fi% + \relax% }% \def\gre@romannumeral@majuscule#1{\uppercase\expandafter{\romannumeral#1\relax}}% \def\gre@romannumeral@minuscule#1{\romannumeral#1\relax}% \def\gresetmodenumbersystem#1{% - \IfStrEqCase{#1}{% - {roman-majuscule}% - {\let\GreModeNumber\gre@romannumeral@majuscule}% - {roman-minuscule}% - {\let\GreModeNumber\gre@romannumeral@minuscule}% - {arabic}% - {\let\GreModeNumber\relax}% - }[% all other cases - \gre@error{Unrecognized option "#1" in \protect\gresetmodenumbersystem\MessageBreak Possible options are: 'roman-majuscule', 'roman-minuscule', and 'arabic'}% - ]% + \IfStrEqCase{#1}{% + {roman-majuscule}% + {\let\GreModeNumber\gre@romannumeral@majuscule}% + {roman-minuscule}% + {\let\GreModeNumber\gre@romannumeral@minuscule}% + {arabic}% + {\let\GreModeNumber\relax}% + }[% all other cases + \gre@error{Unrecognized option "#1" in \protect\gresetmodenumbersystem\MessageBreak Possible options are: 'roman-majuscule', 'roman-minuscule', and 'arabic'}% + ]% }% \gresetmodenumbersystem{roman-minuscule}% \def\GreAnnotationLines#1#2{% - \ifvoid\gre@box@annotation% - \greannotation{#1}% - \greannotation{#2}% - \fi% - \relax% + \ifvoid\gre@box@annotation% + \greannotation{#1}% + \greannotation{#2}% + \fi% + \relax% }% %% macro that draws the lines : starts by the first and then draws the lines of every line. %% has to be called before drawing the key, after drawing the initial \def\gre@beginnotes{% - \gre@drawfirstlines % - %%localeleftbox is a primitive of Omega, it draws the same box at the beginning of new lines (here after the first) - \gre@localleftbox{% - \copy\gre@box@lines % - }% - \relax % + \gre@drawfirstlines % + %%localeleftbox is a primitive of Omega, it draws the same box at the beginning of new lines (here after the first) + \gre@localleftbox{% + \copy\gre@box@lines % + }% + \relax % }% \newbox\gre@box@commentary -\def\grecommentary{\@ifnextchar[{\gre@commentary}{\gre@commentary[0pt]}} +\def\grecommentary{\@ifnextchar[{\gre@commentary}{\gre@commentary[0pt]}}% \def\gre@commentary[#1]#2{% - % we initialize commentarytrueraise here, but will only calculate it's final value just before placing the commentary so that we make sure we have the correct values for the distances which go into it - \gre@style@commentary% to make sure font relative units on the argument translate correctly - \global\gre@dimen@commentarytrueraise=#1\relax% - \endgre@style@commentary% - \ifvoid\gre@box@commentary% - \setbox\gre@box@commentary = \hbox{\gre@style@commentary#2\endgre@style@commentary}% - \else% - \gre@widthof{\gre@style@commentary#2\endgre@style@commentary}% - \ifdim\gre@dimen@temp@three < \wd\gre@box@commentary\relax% - \gre@dimen@temp@three = \wd\gre@box@commentary% - \fi% - \setbox\gre@box@old = \hbox to \gre@dimen@temp@three{\hfill\box\gre@box@commentary}% - \setbox\gre@box@add = \hbox to \gre@dimen@temp@three{\hfill\gre@style@commentary#2\endgre@style@commentary}% - \setbox\gre@box@commentary = \vbox spread \gre@space@dimen@commentaryseparation{\offinterlineskip\box\gre@box@old\vss\box\gre@box@add}% - \fi% + % we initialize commentarytrueraise here, but will only calculate it's final value just before placing the commentary so that we make sure we have the correct values for the distances which go into it + \gre@style@commentary% to make sure font relative units on the argument translate correctly + \global\gre@dimen@commentarytrueraise=#1\relax% + \endgre@style@commentary% + \ifvoid\gre@box@commentary% + \setbox\gre@box@commentary = \hbox{\gre@style@commentary#2\endgre@style@commentary}% + \else% + \gre@widthof{\gre@style@commentary#2\endgre@style@commentary}% + \ifdim\gre@dimen@temp@three < \wd\gre@box@commentary\relax% + \gre@dimen@temp@three = \wd\gre@box@commentary% + \fi% + \setbox\gre@box@old = \hbox to \gre@dimen@temp@three{\hfill\box\gre@box@commentary}% + \setbox\gre@box@add = \hbox to \gre@dimen@temp@three{\hfill\gre@style@commentary#2\endgre@style@commentary}% + \setbox\gre@box@commentary = \vbox spread \gre@space@dimen@commentaryseparation{\offinterlineskip\box\gre@box@old\vss\box\gre@box@add}% + \fi% } -\def\commentary#1{%OBSOLETE - \gre@obsolete{\protect\commentary}{\protect\grecommentary}% -}% - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% macro for putting text above lines for annotations and the like %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% format for text above the lines -\def\greabovelinestextstyle#1{% OBSOLETE - \relax % -}% -\let\gre@empty@abovelinestextstyle\greabovelinestextstyle% - % set space above the text lines - almost the same as for the translation \def\gre@addspaceabove{% - \gre@style@abovelinestext% - \global\gre@dimen@currentabovelinestextheight=\gre@space@dimen@abovelinestextheight\relax% - \gre@generatelines % - \endgre@style@abovelinestext% - \ifx\gre@empty@abovelinestextstyle\greabovelinestextstyle% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\greabovelinestextstyle}{\protect\grechangestyle{abovelinestext}}% OBSOLETE - \fi% OBSOLETE - \relax % + \gre@style@abovelinestext% + \global\gre@dimen@currentabovelinestextheight=\gre@space@dimen@abovelinestextheight\relax% + \gre@generatelines % + \endgre@style@abovelinestext% + \relax % }% % we don't need space above any more \def\gre@removespaceabove{% - \global\gre@dimen@currentabovelinestextheight=0 sp% - \gre@generatelines % - \relax % + \global\gre@dimen@currentabovelinestextheight=0 sp% + \gre@generatelines % + \relax % }% % the code is a bit strange here: we always execute \gre@space@skip@spaceabovelines at the beginning of a glyph. This will: @@ -786,38 +778,30 @@ \xdef\gre@currenttextabovelines{}% \def\GreSetTextAboveLines#1{% - \gdef\gre@currenttextabovelines{% - \gre@typesettextabovelines{#1}% - \gdef\gre@currenttextabovelines{}% - \relax % - }% + \gdef\gre@currenttextabovelines{% + \gre@typesettextabovelines{#1}% + \gdef\gre@currenttextabovelines{}% + \relax % + }% }% % typesets the text above the line \def\gre@typesettextabovelines#1{% - \gre@style@abovelinestext% - \gre@debugmsg{spacing}{Raise alt text: \gre@space@dimen@abovelinestextraise}% - \endgre@style@abovelinestext% - \ifx\gre@empty@abovelinestextstyle\greabovelinestextstyle% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\greabovelinestextstyle}{\protect\grechangestyle{abovelinestext}}% OBSOLETE - \fi% OBSOLETE - \gre@dimen@temp@five=\dimexpr(4\gre@dimen@stafflineheight % - + 4\gre@dimen@interstafflinespace % - + \gre@space@dimen@spacebeneathtext % - + \gre@dimen@currenttranslationheight % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@additionalbottomspace % - + \gre@dimen@additionaltopspacealt % - + \gre@space@dimen@abovelinestextraise)\relax% - \gre@mark@abovelinestext % - \gre@debugmsg{spacing}{Raise alt text: \the\gre@dimen@temp@five}% - \leavevmode\raise\gre@dimen@temp@five\hbox to 0pt{\gre@style@abovelinestext#1\endgre@style@abovelinestext\hss}% - \ifx\gre@empty@abovelinestextstyle\greabovelinestextstyle% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\greabovelinestextstyle}{\protect\grechangestyle{abovelinestext}}% OBSOLETE - \fi% OBSOLETE - \relax % + \gre@style@abovelinestext% + \gre@debugmsg{spacing}{Raise alt text: \gre@space@dimen@abovelinestextraise}% + \endgre@style@abovelinestext% + \gre@dimen@temp@five=\dimexpr(4\gre@dimen@stafflineheight % + + 4\gre@dimen@interstafflinespace % + + \gre@space@dimen@spacebeneathtext % + + \gre@dimen@currenttranslationheight % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@additionalbottomspace % + + \gre@dimen@additionaltopspacealt % + + \gre@space@dimen@abovelinestextraise)\relax% + \gre@mark@abovelinestext % + \gre@debugmsg{spacing}{Raise alt text: \the\gre@dimen@temp@five}% + \leavevmode\raise\gre@dimen@temp@five\hbox to 0pt{\gre@style@abovelinestext#1\endgre@style@abovelinestext\hss}% + \relax % }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -829,87 +813,75 @@ \gre@showlinestrue \def\gresetlines#1{% - \IfStrEqCase{#1}{% - {visible}% - {\gre@showlinestrue}% - {invisible}% - {\gre@showlinesfalse}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetlines\MessageBreak Possible options are: 'visible' and 'invisible'}% - ]% + \IfStrEqCase{#1}{% + {visible}% + {\gre@showlinestrue}% + {invisible}% + {\gre@showlinesfalse}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetlines\MessageBreak Possible options are: 'visible' and 'invisible'}% + ]% } -\def\greremovelines{%OBSOLETE - \gre@obsolete{\protect\greremovelines}{\protect\gresetlines{invisible}}% -}% - -\def\gredonotremovelines{%OBSOLETE - \gre@obsolete{\protect\gredonotremovelines}{\protect\gresetlines{visible}}% -}% - %% macro that draws the stafflines on the first line, it is different from others due to the initial that can take some place, without lines \def\gre@drawfirstlines{% - \advance\gre@dimen@stafflinewidth by -\gre@dimen@initialwidth\relax% - %\advance\gre@dimen@stafflinewidth by -\gre@space@dimen@minimalspaceatlinebeginning - %\gre@dimen@initialwidth=0pt - \hbox to 0pt{% - \vbox{% - \gre@style@normalstafflines% - \ifx\gre@empty@normalstafflinesformat\grenormalstafflinesformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\grenormalstafflinesformat}{\protect\grechangestyle{normalstafflines}}% OBSOLETE - \fi% OBSOLETE - \vskip\gre@dimen@currentabovelinestextheight\relax% - \vskip\gre@dimen@additionaltopspace\relax% - \ifgre@showlines % - \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% - \else % - \vskip\gre@dimen@stafflineheight\relax% - \fi % - \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% - \kern\gre@skip@temp@four % - \ifgre@showlines % - \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% - \else % - \vskip\gre@dimen@stafflineheight\relax% - \fi % - \ifgre@haslinethree % - \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% - \kern\gre@skip@temp@four % - \ifgre@showlines % - \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% - \else % - \vskip\gre@dimen@stafflineheight\relax% - \fi % - \fi % - \ifgre@haslinefour % - \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% - \kern\gre@skip@temp@four % - \ifgre@showlines % - \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% - \else % - \vskip\gre@dimen@stafflineheight\relax% - \fi % - \fi % - \ifgre@haslinefive % - \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% - \kern\gre@skip@temp@four % - \ifgre@showlines % - \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% - \else % - \vskip\gre@dimen@stafflineheight\relax% - \fi % - \fi % - \vskip\gre@space@dimen@spacelinestext\relax% - \vskip\gre@space@dimen@spacebeneathtext\relax% - \vskip\gre@dimen@currenttranslationheight\relax% - \vskip\gre@dimen@additionalbottomspace\relax% - \endgre@style@normalstafflines% - }% - \hss% - }% - \gre@dimen@stafflinewidth=\gre@dimen@linewidth\relax% - \relax% + \advance\gre@dimen@stafflinewidth by -\gre@dimen@initialwidth\relax% + %\advance\gre@dimen@stafflinewidth by -\gre@space@dimen@minimalspaceatlinebeginning + %\gre@dimen@initialwidth=0pt + \hbox to 0pt{% + \vbox{% + \gre@style@normalstafflines% + \vskip\gre@dimen@currentabovelinestextheight\relax% + \vskip\gre@dimen@additionaltopspace\relax% + \ifgre@showlines % + \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% + \else % + \vskip\gre@dimen@stafflineheight\relax% + \fi % + \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% + \kern\gre@skip@temp@four % + \ifgre@showlines % + \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% + \else % + \vskip\gre@dimen@stafflineheight\relax% + \fi % + \ifgre@haslinethree % + \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% + \kern\gre@skip@temp@four % + \ifgre@showlines % + \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% + \else % + \vskip\gre@dimen@stafflineheight\relax% + \fi % + \fi % + \ifgre@haslinefour % + \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% + \kern\gre@skip@temp@four % + \ifgre@showlines % + \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% + \else % + \vskip\gre@dimen@stafflineheight\relax% + \fi % + \fi % + \ifgre@haslinefive % + \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% + \kern\gre@skip@temp@four % + \ifgre@showlines % + \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% + \else % + \vskip\gre@dimen@stafflineheight\relax% + \fi % + \fi % + \vskip\gre@space@dimen@spacelinestext\relax% + \vskip\gre@space@dimen@spacebeneathtext\relax% + \vskip\gre@dimen@currenttranslationheight\relax% + \vskip\gre@dimen@additionalbottomspace\relax% + \endgre@style@normalstafflines% + }% + \hss% + }% + \gre@dimen@stafflinewidth=\gre@dimen@linewidth\relax% + \relax% }% %% box containing the stafflines for other lines than the first @@ -917,64 +889,60 @@ % macro that must be called at each change of linewidth and gre@factor \def\gre@generatelines{% - \setbox\gre@box@lines=\hbox to 0pt{% - \vbox{% - \gre@style@normalstafflines% - \ifx\gre@empty@normalstafflinesformat\grenormalstafflinesformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\grenormalstafflinesformat}{\protect\grechangestyle{normalstafflines}}% OBSOLETE - \fi% OBSOLETE - \vskip\glueexpr(\gre@dimen@additionaltopspace+\gre@space@skip@spaceabovelines+\gre@dimen@currentabovelinestextheight)\relax% - \ifgre@showlines % - \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% - \else % - \vskip\gre@dimen@stafflineheight\relax% - \fi % - \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% - \kern\gre@skip@temp@four % - \ifgre@showlines % - \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% - \else % - \vskip\gre@dimen@stafflineheight\relax% - \fi % - \ifgre@haslinethree % - \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% - \kern\gre@skip@temp@four % - \ifgre@showlines % - \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% - \else % - \vskip\gre@dimen@stafflineheight\relax% - \fi % - \fi % - \ifgre@haslinefour % - \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% - \kern\gre@skip@temp@four % - \ifgre@showlines % - \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% - \else % - \vskip\gre@dimen@stafflineheight\relax% - \fi % - \fi % - \ifgre@haslinefive % - \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% - \kern\gre@skip@temp@four % - \ifgre@showlines % - \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% - \else % - \vskip\gre@dimen@stafflineheight\relax% - \fi % - \fi % - \kern\dimexpr(\gre@space@dimen@spacelinestext+\gre@dimen@additionalbottomspace+\gre@space@dimen@spacebeneathtext+\gre@dimen@currenttranslationheight)\relax% - \endgre@style@normalstafflines % - }% - \hss% - }% - \relax % + \setbox\gre@box@lines=\hbox to 0pt{% + \vbox{% + \gre@style@normalstafflines% + \vskip\glueexpr(\gre@dimen@additionaltopspace+\gre@space@skip@spaceabovelines+\gre@dimen@currentabovelinestextheight)\relax% + \ifgre@showlines % + \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% + \else % + \vskip\gre@dimen@stafflineheight\relax% + \fi % + \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% + \kern\gre@skip@temp@four % + \ifgre@showlines % + \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% + \else % + \vskip\gre@dimen@stafflineheight\relax% + \fi % + \ifgre@haslinethree % + \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% + \kern\gre@skip@temp@four % + \ifgre@showlines % + \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% + \else % + \vskip\gre@dimen@stafflineheight\relax% + \fi % + \fi % + \ifgre@haslinefour % + \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% + \kern\gre@skip@temp@four % + \ifgre@showlines % + \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% + \else % + \vskip\gre@dimen@stafflineheight\relax% + \fi % + \fi % + \ifgre@haslinefive % + \gre@skip@temp@four = \gre@dimen@interstafflinespace\relax% + \kern\gre@skip@temp@four % + \ifgre@showlines % + \hrule height \gre@dimen@stafflineheight width \gre@dimen@stafflinewidth\relax% + \else % + \vskip\gre@dimen@stafflineheight\relax% + \fi % + \fi % + \kern\dimexpr(\gre@space@dimen@spacelinestext+\gre@dimen@additionalbottomspace+\gre@space@dimen@spacebeneathtext+\gre@dimen@currenttranslationheight)\relax% + \endgre@style@normalstafflines % + }% + \hss% + }% + \relax % }% % Macro for fusion of larger neumes \def\GreFuseTwo#1#2{% - #1\GreNoBreak #2\relax % + #1\GreNoBreak #2\relax % }% \def\GreFuse{\GreNoBreak}% @@ -986,19 +954,19 @@ % #2 = font name % #3 = glyph name, glyph variant name (preceded by .), or code point \def\grechangeglyph#1#2#3{% - \directlua{gregoriotex.init_variant_font([[#2]], true, [[\the\gre@factor]])}% - \directlua{gregoriotex.change_score_glyph([[#1]],[[#2]],[[#3]])}% + \directlua{gregoriotex.init_variant_font([[#2]], true, [[\the\gre@factor]])}% + \directlua{gregoriotex.change_score_glyph([[#1]],[[#2]],[[#3]])}% }% % Resets a gregorio code point to its default setting % #1 = the name of the gregorio code point \def\greresetglyph#1{% - \directlua{gregoriotex.reset_score_glyph([[#1]])}% + \directlua{gregoriotex.reset_score_glyph([[#1]])}% }% {% - \directlua{gregoriotex.init_variant_font('greciliae', true, [[\the\gre@factor]])}% - \directlua{gregoriotex.map_font('greciliae', 'CP')}% + \directlua{gregoriotex.init_variant_font('greciliae', true, [[\the\gre@factor]])}% + \directlua{gregoriotex.map_font('greciliae', 'CP')}% }% \input gregoriotex-chars.tex% @@ -1015,18 +983,14 @@ \gre@translationcenteringfalse \def\gresettranslationcentering#1{% - \IfStrEqCase{#1}{% - {left}% - {\gre@translationcenteringfalse}% - {center}% - {\gre@translationcenteringtrue}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresettranslationcentering\MessageBreak Possible options are: 'left' and 'center'}% - ]% -}% - -\def\setgretranslationcenteringscheme#1{%OBSOLETE - \gre@obsolete{\protect\setgretranslationcenteringscheme}{\protect\gresettranslationcentering}% + \IfStrEqCase{#1}{% + {left}% + {\gre@translationcenteringfalse}% + {center}% + {\gre@translationcenteringtrue}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresettranslationcentering\MessageBreak Possible options are: 'left' and 'center'}% + ]% }% @@ -1034,73 +998,57 @@ \gre@breakintranslationfalse% \def\gresetbreakintranslation#1{% - \IfStrEqCase{#1}{% - {allow}% - {\gre@breakintranslationtrue}% - {prohibit}% - {\gre@breakintranslationfalse}% - }[% all other cases - \gre@error{Unrecognized option "#1" in \protect\gresetbreakintranslation\MessageBreak Possible options are: 'allow' and 'prohibit'}% - ]% -}% - -\def\gresetnlbintranslation#1{%OBSOLETE - \gre@obsolete{\protect\gresetnlbintranslation}{\protect\gresetbreakintranslation}% + \IfStrEqCase{#1}{% + {allow}% + {\gre@breakintranslationtrue}% + {prohibit}% + {\gre@breakintranslationfalse}% + }[% all other cases + \gre@error{Unrecognized option "#1" in \protect\gresetbreakintranslation\MessageBreak Possible options are: 'allow' and 'prohibit'}% + ]% }% \def\GreWriteTranslation#1{% - \ifgre@translationcentering % - \setbox\gre@box@temp@width=\hbox{#1}% - \gre@dimen@temp@five=\dimexpr((\wd\gre@box@syllabletext - \wd\gre@box@temp@width) / 2)\relax% - \gre@mark@translation % - \kern\gre@dimen@temp@five % - \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}% - \ifx\gre@empty@translationformat\gretranslationformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\gretranslationformat}{\protect\grechangestyle{translation}}% OBSOLETE - \fi% OBSOLETE - \kern-\gre@dimen@temp@five % - \else % - \gre@mark@translation % - \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}% - \ifx\gre@empty@translationformat\gretranslationformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\gretranslationformat}{\protect\grechangestyle{translation}}% OBSOLETE - \fi% OBSOLETE - \fi % + \ifgre@translationcentering % + \setbox\gre@box@temp@width=\hbox{#1}% + \gre@dimen@temp@five=\dimexpr((\wd\gre@box@syllabletext - \wd\gre@box@temp@width) / 2)\relax% + \gre@mark@translation % + \kern\gre@dimen@temp@five % + \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}% + \kern-\gre@dimen@temp@five % + \else % + \gre@mark@translation % + \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}% + \fi % }% \def\GreWriteTranslationWithCenterBeginning#1{% - \ifgre@breakintranslation\else% - \GreBeginNLBArea{0}{1}% - \fi % - \gre@attr@center=1\relax % - \gre@mark@translation % - \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\kern 0pt\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}\kern 0pt}% - \ifx\gre@empty@translationformat\gretranslationformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\gretranslationformat}{\protect\grechangestyle{translation}}% OBSOLETE - \fi% OBSOLETE - \unsetluatexattribute{\gre@attr@center}% - \relax % + \ifgre@breakintranslation\else% + \GreBeginNLBArea{0}{1}% + \fi % + \gre@attr@center=1\relax % + \gre@mark@translation % + \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\kern 0pt\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}\kern 0pt}% + \unsetluatexattribute{\gre@attr@center}% + \relax % }% \newif\ifgre@mustdotranslationcenterend% \gre@mustdotranslationcenterendfalse% \def\GreTranslationCenterEnd{% - \gre@mustdotranslationcenterendtrue% - \relax % + \gre@mustdotranslationcenterendtrue% + \relax % }% \def\gre@dotranslationcenterend{% - \ifgre@breakintranslation\else% - \GreEndNLBArea{0}{1}% - \fi % - \gre@attr@center=2\relax % - \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{}% - \unsetluatexattribute{\gre@attr@center}% - \relax % + \ifgre@breakintranslation\else% + \GreEndNLBArea{0}{1}% + \fi % + \gre@attr@center=2\relax % + \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{}% + \unsetluatexattribute{\gre@attr@center}% + \relax % }% @@ -1112,27 +1060,27 @@ \gre@justifylastlinefalse% \def\gresetlastline#1{% - \IfStrEqCase{#1}{% - {justified}% - {\gre@justifylastlinetrue}% - {ragged}% - {\gre@justifylastlinefalse}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetlastline\MessageBreak Possible options are: 'justified' and 'ragged'}% - ]% + \IfStrEqCase{#1}{% + {justified}% + {\gre@justifylastlinetrue}% + {ragged}% + {\gre@justifylastlinefalse}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetlastline\MessageBreak Possible options are: 'justified' and 'ragged'}% + ]% }% % make this a count so that it can be read more easily in Lua \newcount\gre@variableheightexpansion\gre@variableheightexpansion=1\relax % \def\gresetlineheightexpansion#1{% - \IfStrEqCase{#1}{% - {uniform}% - {\gre@variableheightexpansion=0\relax }% - {variable}% - {\gre@variableheightexpansion=1\relax }% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetlineheightexpansion\MessageBreak Possible options are: 'uniform' and 'variable'}% - ]% + \IfStrEqCase{#1}{% + {uniform}% + {\gre@variableheightexpansion=0\relax }% + {variable}% + {\gre@variableheightexpansion=1\relax }% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetlineheightexpansion\MessageBreak Possible options are: 'uniform' and 'variable'}% + ]% }% % gre@attr@dash (see its definition in gregorio-syllable) is 0 when we are in a score, and unset when we are not @@ -1143,58 +1091,58 @@ \newif\ifgre@haslinefive% \def\gre@setstafflines#1{% - \def\gre@stafflines{#1}% - \ifcase#1% 0 - \gre@error{Invalid number of staff lines}% - \or % 1 - \gre@error{Invalid number of staff lines}% - \or % 2 - \let\gre@pitch@adjust@top\gre@pitch@f % - \let\gre@pitch@abovestaff\gre@pitch@g % - \let\gre@pitch@ledger@above\gre@pitch@h % - \let\gre@pitch@raresign\gre@pitch@g % - \let\gre@pitch@overbrace\gre@pitch@i % - \grechangeglyph{Virgula}{*}{.2}% - \grechangeglyph{Divisio*}{*}{.2}% - \gre@haslinethreefalse % - \gre@haslinefourfalse % - \gre@haslinefivefalse % - \or % 3 - \let\gre@pitch@adjust@top\gre@pitch@h % - \let\gre@pitch@abovestaff\gre@pitch@i % - \let\gre@pitch@ledger@above\gre@pitch@j % - \let\gre@pitch@raresign\gre@pitch@i % - \let\gre@pitch@overbrace\gre@pitch@k % - \grechangeglyph{Virgula}{*}{.3}% - \grechangeglyph{Divisio*}{*}{.3}% - \gre@haslinethreetrue % - \gre@haslinefourfalse % - \gre@haslinefivefalse % - \or % 4 - \let\gre@pitch@adjust@top\gre@pitch@j % - \let\gre@pitch@abovestaff\gre@pitch@k % - \let\gre@pitch@ledger@above\gre@pitch@l % - \let\gre@pitch@raresign\gre@pitch@k % - \let\gre@pitch@overbrace\gre@pitch@m % - \greresetglyph{Virgula}% - \greresetglyph{Divisio*}% - \gre@haslinethreetrue % - \gre@haslinefourtrue % - \gre@haslinefivefalse % - \or % 5 - \let\gre@pitch@adjust@top\gre@pitch@l % - \let\gre@pitch@abovestaff\gre@pitch@m % - \let\gre@pitch@ledger@above\gre@pitch@n % - \let\gre@pitch@raresign\gre@pitch@m % - \let\gre@pitch@overbrace\gre@pitch@p % - \grechangeglyph{Virgula}{*}{.5}% - \grechangeglyph{Divisio*}{*}{.5}% - \gre@haslinethreetrue % - \gre@haslinefourtrue % - \gre@haslinefivetrue % - \else % - \gre@error{Invalid number of staff lines}% - \fi % + \def\gre@stafflines{#1}% + \ifcase#1% 0 + \gre@error{Invalid number of staff lines}% + \or % 1 + \gre@error{Invalid number of staff lines}% + \or % 2 + \let\gre@pitch@adjust@top\gre@pitch@f % + \let\gre@pitch@abovestaff\gre@pitch@g % + \let\gre@pitch@ledger@above\gre@pitch@h % + \let\gre@pitch@raresign\gre@pitch@g % + \let\gre@pitch@overbrace\gre@pitch@i % + \grechangeglyph{Virgula}{*}{.2}% + \grechangeglyph{Divisio*}{*}{.2}% + \gre@haslinethreefalse % + \gre@haslinefourfalse % + \gre@haslinefivefalse % + \or % 3 + \let\gre@pitch@adjust@top\gre@pitch@h % + \let\gre@pitch@abovestaff\gre@pitch@i % + \let\gre@pitch@ledger@above\gre@pitch@j % + \let\gre@pitch@raresign\gre@pitch@i % + \let\gre@pitch@overbrace\gre@pitch@k % + \grechangeglyph{Virgula}{*}{.3}% + \grechangeglyph{Divisio*}{*}{.3}% + \gre@haslinethreetrue % + \gre@haslinefourfalse % + \gre@haslinefivefalse % + \or % 4 + \let\gre@pitch@adjust@top\gre@pitch@j % + \let\gre@pitch@abovestaff\gre@pitch@k % + \let\gre@pitch@ledger@above\gre@pitch@l % + \let\gre@pitch@raresign\gre@pitch@k % + \let\gre@pitch@overbrace\gre@pitch@m % + \greresetglyph{Virgula}% + \greresetglyph{Divisio*}% + \gre@haslinethreetrue % + \gre@haslinefourtrue % + \gre@haslinefivefalse % + \or % 5 + \let\gre@pitch@adjust@top\gre@pitch@l % + \let\gre@pitch@abovestaff\gre@pitch@m % + \let\gre@pitch@ledger@above\gre@pitch@n % + \let\gre@pitch@raresign\gre@pitch@m % + \let\gre@pitch@overbrace\gre@pitch@p % + \grechangeglyph{Virgula}{*}{.5}% + \grechangeglyph{Divisio*}{*}{.5}% + \gre@haslinethreetrue % + \gre@haslinefourtrue % + \gre@haslinefivetrue % + \else % + \gre@error{Invalid number of staff lines}% + \fi % }% %macro called at the beginning of a score @@ -1206,130 +1154,128 @@ % #6 is the point-and-click filename % #7 is the number of staff lines \def\GreBeginScore#1#2#3#4#5#6#7{% - % scores must be new paragraphs! - \ifhmode\par\fi % - \gre@beginningofscoretrue% - \global\gre@dimen@morawidth=0pt\relax % - \gre@reseteolcustos% - \gre@resetledgerlineheuristics% - \global\setluatexattribute\gre@attr@glyph@id{0}% - \xdef\gre@gabcname{#6}% - \gre@setstafflines{#7}% - \global\let\gre@save@englishcentering\gre@lyriccentering\relax % OBSOLETE - \global\let\gre@opening@initialstyle\gre@initiallines\relax % DEPRECATED by 4.1 - \ifgre@justifylastline% - \xdef\gre@save@parfillskip{\the\parfillskip}% - \parfillskip=0pt plus 0pt minus 0pt\relax% - \fi % - \ifgre@usestylefont% - \gre@setstylefont % - \fi % - \gre@computespaces% - \gre@cancelpenalties % - \gre@attr@dash=0\relax % - \xdef\gre@exhyphencharsave{\the\exhyphenchar}% - \exhyphenchar=-1\relax % - \gre@generatelines % - \noindent% - \gre@calculate@additionalspaces{#2}{#3}{#4}{#5}% - \directlua{ - gregoriotex.atScoreBeginning([[#1]], #2, #3, #4, #5, - \gre@pitch@adjust@top, \gre@pitch@adjust@bottom) - gregoriotex.adjust_line_height(1) - }% - %TODO do something like LaTeX's AtBeginDocument - \ifdefined\optgabcAtScoreBeginning % - \optgabcAtScoreBeginning % - \fi % - \global\gre@knownline=1\relax % - \global\gre@lastoflinecount=2\relax % - \global\gre@endofscorefalse % - \relax% + % scores must be new paragraphs! + \ifhmode\par\fi % + \gre@beginningofscoretrue% + \global\gre@dimen@morawidth=0pt\relax % + \gre@reseteolcustos% + \gre@resetledgerlineheuristics% + \global\setluatexattribute\gre@attr@glyph@id{0}% + \xdef\gre@gabcname{#6}% + \gre@setstafflines{#7}% + \global\let\gre@opening@initialstyle\gre@initiallines\relax % DEPRECATED for removal in 5.0 + \ifgre@justifylastline% + \xdef\gre@save@parfillskip{\the\parfillskip}% + \parfillskip=0pt plus 0pt minus 0pt\relax% + \fi % + \ifgre@usestylefont% + \gre@setstylefont % + \fi % + \gre@computespaces% + \gre@cancelpenalties % + \gre@attr@dash=0\relax % + \xdef\gre@exhyphencharsave{\the\exhyphenchar}% + \exhyphenchar=-1\relax % + \gre@generatelines % + \noindent% + \gre@calculate@additionalspaces{#2}{#3}{#4}{#5}% + \directlua{ + gregoriotex.atScoreBeginning([[#1]], #2, #3, #4, #5, + \gre@pitch@adjust@top, \gre@pitch@adjust@bottom) + gregoriotex.adjust_line_height(1) + }% + %TODO do something like LaTeX's AtBeginDocument + \ifdefined\optgabcAtScoreBeginning % + \optgabcAtScoreBeginning % + \fi % + \global\gre@knownline=1\relax % + \global\gre@lastoflinecount=2\relax % + \global\gre@endofscorefalse % + \relax% }% %macro called at the end of a score \def\GreEndScore{% - \ifnum\gre@biginitial=1\relax% - \ifnum\gre@knownline<3\relax% - \gre@error{Score ended before finding the end\MessageBreak of the second line of a 2-line initial. Make sure\MessageBreak you have at least two manual line breaks in \MessageBreak your gabc}% - \fi% - \fi% - \global\gre@lastoflinecount=0\relax % - \gre@useautoeolcustos% - \GreEndEUOUAE{}% - \ifnum\gre@nlbstate=0\else % - \GreEndNLBArea{2}{0}% - \fi % - \gre@localleftbox{}% - \ifgre@keeprightbox\else % - \gre@localrightbox{}% - \fi % - \hfil % - \par % - \ifgre@keeprightbox% - \global\gre@keeprightboxfalse% - \fi% - % with some versions of LuaTeX, the \localrightbox and \localleftbox must be set empty in an environment with the good attributes set - \gre@localleftbox{}% - \gre@localrightbox{}% - \gre@calculate@additionalspaces{\gre@pitch@dummy}{\gre@pitch@dummy}{0}{0}% - \global\gre@dimen@currentabovelinestextheight=0 sp% - \gre@removetranslationspace % - \gre@normalinitial % - \gre@restorepenalties % - \exhyphenchar=\gre@exhyphencharsave % - \gre@dimen@temp@one=0pt\relax% - \gre@dimen@temp@two=0pt\relax% - \gre@dimen@temp@three=0pt\relax% - \gre@dimen@temp@four=0pt\relax% - \gre@dimen@temp@five=0pt\relax% - \gre@skip@temp@one=0pt\relax% - \gre@skip@temp@two=0pt\relax% - \gre@skip@temp@three=0pt\relax% - \gre@skip@temp@four=0pt\relax% - \setbox\gre@box@annotation=\box\voidb@x% - \setbox\gre@box@commentary=\box\voidb@x% - \directlua{gregoriotex.atScoreEnd()}% - \unsetluatexattribute{\gre@attr@glyph@id}% - \unsetluatexattribute{\gre@attr@glyph@top}% - \unsetluatexattribute{\gre@attr@glyph@bottom}% - \unsetluatexattribute{\gre@attr@dash}% - \ifgre@justifylastline% - \parfillskip=\gre@save@parfillskip\relax% - \fi % - \global\let\gre@lyriccentering\gre@save@englishcentering\relax % OBSOLETE - \global\setluatexattribute\gre@attr@glyph@id{0}% - \relax% + \ifnum\gre@biginitial=1\relax% + \ifnum\gre@knownline<3\relax% + \gre@error{Score ended before finding the end\MessageBreak of the second line of a 2-line initial. Make sure\MessageBreak you have at least two manual line breaks in \MessageBreak your gabc}% + \fi% + \fi% + \global\gre@lastoflinecount=0\relax % + \gre@useautoeolcustos% + \GreEndEUOUAE{}% + \ifnum\gre@nlbstate=0\else % + \GreEndNLBArea{2}{0}% + \fi % + \gre@localleftbox{}% + \ifgre@keeprightbox\else % + \gre@localrightbox{}% + \fi % + \hfil % + \par % + \ifgre@keeprightbox% + \global\gre@keeprightboxfalse% + \fi% + % with some versions of LuaTeX, the \localrightbox and \localleftbox must be set empty in an environment with the good attributes set + \gre@localleftbox{}% + \gre@localrightbox{}% + \gre@calculate@additionalspaces{\gre@pitch@dummy}{\gre@pitch@dummy}{0}{0}% + \global\gre@dimen@currentabovelinestextheight=0 sp% + \gre@removetranslationspace % + \gre@normalinitial % + \gre@restorepenalties % + \exhyphenchar=\gre@exhyphencharsave % + \gre@dimen@temp@one=0pt\relax% + \gre@dimen@temp@two=0pt\relax% + \gre@dimen@temp@three=0pt\relax% + \gre@dimen@temp@four=0pt\relax% + \gre@dimen@temp@five=0pt\relax% + \gre@skip@temp@one=0pt\relax% + \gre@skip@temp@two=0pt\relax% + \gre@skip@temp@three=0pt\relax% + \gre@skip@temp@four=0pt\relax% + \setbox\gre@box@annotation=\box\voidb@x% + \setbox\gre@box@commentary=\box\voidb@x% + \directlua{gregoriotex.atScoreEnd()}% + \unsetluatexattribute{\gre@attr@glyph@id}% + \unsetluatexattribute{\gre@attr@glyph@top}% + \unsetluatexattribute{\gre@attr@glyph@bottom}% + \unsetluatexattribute{\gre@attr@dash}% + \ifgre@justifylastline% + \parfillskip=\gre@save@parfillskip\relax% + \fi % + \global\setluatexattribute\gre@attr@glyph@id{0}% + \relax% }% % macro called at the end of a bar (old bar spacing algorithm only). \def\gre@endafterbar#1{% - \gre@penalty{\greendafterbarpenalty }\relax % - \ifnum#1=1\relax % - \gre@debugmsg{ifdim}{ enddifference > 0pt}% - \ifdim\gre@dimen@enddifference > 0 pt\relax% - \gre@debugmsg{ifdim}{ nextbegindifference > 0pt}% - \ifdim\gre@skip@nextbegindifference > 0 pt\relax% - \gre@skip@temp@four = \gre@space@skip@notebarspace\relax% - \gre@hskip\gre@skip@temp@four % - \else % (next begin difference >0pt) - \gre@skip@temp@four = \gre@space@skip@textbartextspace\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \else%(enddifference < 0pt) - \gre@debugmsg{ifdim}{ nextbegindifference < 0pt}% - \ifdim\gre@skip@nextbegindifference < 0 pt\relax% - \gre@skip@temp@four = \gre@space@skip@textbartextspace\relax% - \gre@hskip\gre@skip@temp@four % - \else %(next begin difference < 0 pt) - \gre@skip@temp@four = \gre@space@skip@interwordspacetext\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \fi % - \fi % - %\gre@penalty{\greendafterbarpenalty }\relax - %\global\gre@dimen@enddifference=0pt - \relax % + \gre@penalty{\the\gre@space@count@endafterbarpenalty }\relax % + \ifnum#1=1\relax % + \gre@debugmsg{ifdim}{ enddifference > 0pt}% + \ifdim\gre@dimen@enddifference > 0 pt\relax% + \gre@debugmsg{ifdim}{ nextbegindifference > 0pt}% + \ifdim\gre@skip@nextbegindifference > 0 pt\relax% + \gre@skip@temp@four = \gre@space@skip@notebarspace\relax% + \gre@hskip\gre@skip@temp@four % + \else % (next begin difference >0pt) + \gre@skip@temp@four = \gre@space@skip@textbartextspace\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \else%(enddifference < 0pt) + \gre@debugmsg{ifdim}{ nextbegindifference < 0pt}% + \ifdim\gre@skip@nextbegindifference < 0 pt\relax% + \gre@skip@temp@four = \gre@space@skip@textbartextspace\relax% + \gre@hskip\gre@skip@temp@four % + \else %(next begin difference < 0 pt) + \gre@skip@temp@four = \gre@space@skip@interwordspacetext\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \fi % + \fi % + %\gre@penalty{\the\gre@space@count@endafterbarpenalty }\relax + %\global\gre@dimen@enddifference=0pt + \relax % }% \newcount\gre@lastoflinecount% @@ -1339,9 +1285,9 @@ % 1 if the syllable is the last of the line % 2 after it has finished the syllable, so when it is two it means that the syllable is the first of a line \def\GreLastOfLine{% - \global\gre@lastoflinecount=1\relax% - \gre@debugmsg{eolshift}{set lastoflinecount to 1}% - \relax% + \global\gre@lastoflinecount=1\relax% + \gre@debugmsg{eolshift}{set lastoflinecount to 1}% + \relax% }% % Flag to mark the last syllable of the score @@ -1350,13 +1296,13 @@ % called at element level, before the final element \def\GreLastOfScore{% - %\gre@localleftbox{}% For an unknown reason, if I uncomment this line, the - %blank line removing algorithm (in lua) will let some blank space after the - %last line... (see bug #20953) - \global\gre@endofscoretrue % - \gre@usemanualeolcustos% - \gre@debugmsg{eolshift}{set lastoflinecount to 1}% - \relax% + %\gre@localleftbox{}% For an unknown reason, if I uncomment this line, the + %blank line removing algorithm (in lua) will let some blank space after the + %last line... (see bug #20953) + \global\gre@endofscoretrue % + \gre@usemanualeolcustos% + \gre@debugmsg{eolshift}{set lastoflinecount to 1}% + \relax% }% % a flag to disable (or reenable) the left shift for first syllables of lines @@ -1365,14 +1311,14 @@ \gre@bolshiftsenabledtrue \def\gresetbolshifts#1{% - \IfStrEqCase{#1}{% - {enable}% - {\gre@bolshiftsenabledtrue}% - {disable}% - {\gre@bolshiftsenabledfalse}% - }[% all other cases - \gre@error{Unrecognized option "#1" in \protect\gresetbolshifts\MessageBreak Possible options are: 'enable' and 'disable'}% - ]% + \IfStrEqCase{#1}{% + {enable}% + {\gre@bolshiftsenabledtrue}% + {disable}% + {\gre@bolshiftsenabledfalse}% + }[% all other cases + \gre@error{Unrecognized option "#1" in \protect\gresetbolshifts\MessageBreak Possible options are: 'enable' and 'disable'}% + ]% }% % a flag to disable (or reenable) the shift for last syllables of lines @@ -1382,82 +1328,71 @@ \gre@eolshiftsenabledtrue \def\greseteolshifts#1{% - \IfStrEqCase{#1}{% - {enable}% - {\gre@eolshiftsenabledtrue}% - {disable}% - {\gre@eolshiftsenabledfalse}% - }[% all other cases - \gre@error{Unrecognized option "#1" in \protect\greseteolshifts\MessageBreak Possible options are: 'enable' and 'diable'}% - ]% + \IfStrEqCase{#1}{% + {enable}% + {\gre@eolshiftsenabledtrue}% + {disable}% + {\gre@eolshiftsenabledfalse}% + }[% all other cases + \gre@error{Unrecognized option "#1" in \protect\greseteolshifts\MessageBreak Possible options are: 'enable' and 'diable'}% + ]% }% -\def\gredisableeolshifts{%OBSOLETE - \gre@obsolete{\protect\gredisableeolshifts}{\protect\greseteolshifts{disable}}% -}% - -\def\greenableeolshifts{%OBSOLETE - \gre@obsolete{\protect\greenableeolshifts}{\protect\greseteolshifts{enable}}% -}% % Flag indicating if we block the custos. We just block custos at the end of a score, to prevent a bug. \newif\ifgre@blockeolcustos% \def\gre@usemanualeolcustos{% - \gre@blockeolcustostrue% - \gre@localrightbox{}% + \gre@blockeolcustostrue% + \gre@localrightbox{}% }% \def\gre@useautoeolcustos{% - \gre@blockeolcustosfalse% + \gre@blockeolcustosfalse% }% \def\greseteolcustos#1{% - \IfStrEqCase{#1}{% - {manual}% - {\global\let\gre@reseteolcustos\gre@usemanualeolcustos\relax}% - {auto}% - {\global\let\gre@reseteolcustos\gre@useautoeolcustos\relax}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\greseteolcustos\MessageBreak Possible options are: 'manual' and 'auto'}% - ]% + \IfStrEqCase{#1}{% + {manual}% + {\global\let\gre@reseteolcustos\gre@usemanualeolcustos\relax}% + {auto}% + {\global\let\gre@reseteolcustos\gre@useautoeolcustos\relax}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\greseteolcustos\MessageBreak Possible options are: 'manual' and 'auto'}% + ]% }% \greseteolcustos{auto}% \newif\ifgre@blockeolcustosbeforeeuouae% \def\greseteolcustosbeforeeuouae#1{% - \IfStrEqCase{#1}{% - {suppressed}% - {\gre@blockeolcustosbeforeeuouaetrue\relax}% - {auto}% - {\gre@blockeolcustosbeforeeuouaefalse\relax}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\greseteolcustosbeforeeuouae\MessageBreak Possible options are: 'suppressed' and 'auto'}% - ]% + \IfStrEqCase{#1}{% + {suppressed}% + {\gre@blockeolcustosbeforeeuouaetrue\relax}% + {auto}% + {\gre@blockeolcustosbeforeeuouaefalse\relax}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\greseteolcustosbeforeeuouae\MessageBreak Possible options are: 'suppressed' and 'auto'}% + ]% }% \greseteolcustosbeforeeuouae{suppressed}% \newif\ifgre@raggedbreakbeforeeuouae% \def\gresetbreakbeforeeuouae#1{% - \IfStrEqCase{#1}{% - {ragged}% - {\gre@raggedbreakbeforeeuouaetrue\relax}% - {justified}% - {\gre@raggedbreakbeforeeuouaefalse\relax}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\greseteolcustosbeforeeuouae\MessageBreak Possible options are: 'ragged' and 'justified'}% - ]% + \IfStrEqCase{#1}{% + {ragged}% + {\gre@raggedbreakbeforeeuouaetrue\relax}% + {justified}% + {\gre@raggedbreakbeforeeuouaefalse\relax}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\greseteolcustosbeforeeuouae\MessageBreak Possible options are: 'ragged' and 'justified'}% + ]% }% \gresetbreakbeforeeuouae{justified}% -% macro to suppress the custos -\def\greblockcustos{%OBSOLETE - \gre@obsolete{\protect\greblockcustos}{\protect\greseteolcustos{manual}}% -}% - -\def\GreAdHocSpaceEndOfElement#1#2{% - \gre@skip@temp@four = \gre@space@skip@interelementspace\relax % - \directlua{gregoriotex.scale_space(#1)}% - \GreEndOfElement{4}{#2}% +\def\GreAdHocSpaceEndOfElement#1#2#3{% + \gre@skip@temp@four = \gre@space@skip@interelementspace\relax % + \directlua{gregoriotex.scale_space(#1)}% + \GreEndOfElement{4}{#2}{#3}% }% +\newif\ifgre@unbreakableendofelement % % macro to end elements, #1 is the type of space, it can be : %% 0: default space %% 1: larger space @@ -1465,30 +1400,49 @@ %% 3: zero-width space %% 4: custom space % #2 is if the space is unbreakable (1) or not (0) -\def\GreEndOfElement#1#2{% - \ifnum #2=0\relax % - \gre@penalty{\greendofelementpenalty}% - \else % - \GreNoBreak % - \fi % - \ifcase#1% - \gre@skip@temp@four = \gre@space@skip@interelementspace\relax% - \gre@hskip\gre@skip@temp@four % - \or% case 1 - \gre@skip@temp@four = \gre@space@skip@largerspace\relax% - \gre@hskip\gre@skip@temp@four % - \or% case 2 - \gre@skip@temp@four = \gre@space@skip@glyphspace\relax% - \gre@hskip\gre@skip@temp@four % - \or% case 3 - \gre@skip@temp@four = \gre@space@skip@zerowidthspace\relax% - \gre@hskip\gre@skip@temp@four % - \or% case 4 - \gre@hskip\gre@skip@temp@four % - \fi% - \ifnum #2=1\relax % - \GreNoBreak % - \fi % +% #3 is the number of notes emitted in this syllable before this macro +\def\GreEndOfElement#1#2#3{% + \ifnum\gre@count@syllablenotes<\gre@count@unbreakabletotalnotes\relax % + \gre@unbreakableendofelementtrue % + \else % + \ifnum#3<\gre@count@unbreakableinitialnotes\relax % + \gre@unbreakableendofelementtrue % + \else % + \ifnum\numexpr\gre@count@syllablenotes-#3\relax<% + \gre@count@unbreakablefinalnotes\relax % + \gre@unbreakableendofelementtrue % + \else % + \ifnum#2=1\relax % + \gre@unbreakableendofelementtrue % + \else % + \gre@unbreakableendofelementfalse % + \fi % + \fi % + \fi % + \fi % + \ifgre@unbreakableendofelement % + \GreNoBreak % + \else % + \gre@penalty{\the\gre@space@count@endofelementpenalty}% + \fi % + \ifcase#1% + \gre@skip@temp@four = \gre@space@skip@interelementspace\relax% + \gre@hskip\gre@skip@temp@four % + \or% case 1 + \gre@skip@temp@four = \gre@space@skip@largerspace\relax% + \gre@hskip\gre@skip@temp@four % + \or% case 2 + \gre@skip@temp@four = \gre@space@skip@glyphspace\relax% + \gre@hskip\gre@skip@temp@four % + \or% case 3 + \gre@skip@temp@four = \gre@space@skip@zerowidthspace\relax% + \gre@hskip\gre@skip@temp@four % + \or% case 4 + \gre@hskip\gre@skip@temp@four % + \fi% + \ifgre@unbreakableendofelement % + \GreNoBreak % + \fi % \relax% }% @@ -1519,63 +1473,67 @@ %% 21: space between a punctum inclinatum and a "no-bar" glyph three or four pitches above %% 22: half-space \def\gre@get@spaceskip#1{% - \ifcase#1% - \gre@skip@temp@four = \gre@space@skip@interglyphspace\relax% - \or% case 1 - \gre@skip@temp@four = \gre@space@dimen@zerowidthspace\relax% - \or% case 2 - \gre@skip@temp@four = \gre@space@dimen@alterationspace\relax% - \or% case 3 - \gre@skip@temp@four = \gre@space@skip@punctuminclinatumshift\relax% - \or% case 4 - \gre@skip@temp@four = \gre@space@skip@bitrivirspace\relax% - \or% case 5 - \gre@skip@temp@four = \gre@space@skip@bitristrospace\relax% - \or% case 6 - \gre@skip@temp@four = \gre@space@skip@spaceaftersigns\relax% - \or% case 7 - \gre@skip@temp@four = \gre@space@skip@punctuminclinatumanddebilisshift\relax% - \or% case 8 - \gre@skip@temp@four = \gre@space@skip@punctuminclinatumdebilisshift\relax% - \or% case 9 - \gre@skip@temp@four = \gre@space@skip@beforepunctainclinatashift\relax% - \or% case 10 - \gre@skip@temp@four = \gre@space@skip@punctuminclinatumbigshift\relax% - \or% case 11 - \gre@skip@temp@four = \gre@space@skip@punctuminclinatummaxshift\relax% - \or% case 12 (ascending version of 3) - \gre@skip@temp@four = \gre@space@skip@ascendingpunctuminclinatumshift\relax% - \or% case 13 (ascending version of 7) - \gre@skip@temp@four = \gre@space@skip@ascendingpunctuminclinatumanddebilisshift\relax% - \or% case 14 (ascending version of 10) - \gre@skip@temp@four = \gre@space@skip@ascendingpunctuminclinatumbigshift\relax% - \or% case 15 (ascending version of 11) - \gre@skip@temp@four = \gre@space@skip@ascendingpunctuminclinatummaxshift\relax% - \or% case 16 - \gre@skip@temp@four = \gre@space@skip@descendinginclinatumtonobarshift\relax% - \or% case 17 - \gre@skip@temp@four = \gre@space@skip@descendinginclinatumtonobarbigshift\relax% - \or% case 18 - \gre@skip@temp@four = \gre@space@skip@descendinginclinatumtonobarmaxshift\relax% - \or% case 19 - \gre@skip@temp@four = \gre@space@skip@ascendinginclinatumtonobarshift\relax% - \or% case 20 - \gre@skip@temp@four = \gre@space@skip@ascendinginclinatumtonobarbigshift\relax% - \or% case 21 - \gre@skip@temp@four = \gre@space@skip@ascendinginclinatumtonobarmaxshift\relax% - \or% case 22 - \gre@skip@temp@four = \gre@space@skip@halfspace\relax% - \fi% + \ifcase#1% + \gre@skip@temp@four = \gre@space@skip@interglyphspace\relax% + \or% case 1 + \gre@skip@temp@four = \gre@space@dimen@zerowidthspace\relax% + \or% case 2 + \gre@skip@temp@four = \gre@space@dimen@alterationspace\relax% + \or% case 3 + \gre@skip@temp@four = \gre@space@skip@punctuminclinatumshift\relax% + \or% case 4 + \gre@skip@temp@four = \gre@space@skip@bitrivirspace\relax% + \or% case 5 + \gre@skip@temp@four = \gre@space@skip@bitristrospace\relax% + \or% case 6 + \gre@skip@temp@four = \gre@space@skip@spaceaftersigns\relax% + \or% case 7 + \gre@skip@temp@four = \gre@space@skip@punctuminclinatumanddebilisshift\relax% + \or% case 8 + \gre@skip@temp@four = \gre@space@skip@punctuminclinatumdebilisshift\relax% + \or% case 9 + \gre@skip@temp@four = \gre@space@skip@beforepunctainclinatashift\relax% + \or% case 10 + \gre@skip@temp@four = \gre@space@skip@punctuminclinatumbigshift\relax% + \or% case 11 + \gre@skip@temp@four = \gre@space@skip@punctuminclinatummaxshift\relax% + \or% case 12 (ascending version of 3) + \gre@skip@temp@four = \gre@space@skip@ascendingpunctuminclinatumshift\relax% + \or% case 13 (ascending version of 7) + \gre@skip@temp@four = \gre@space@skip@ascendingpunctuminclinatumanddebilisshift\relax% + \or% case 14 (ascending version of 10) + \gre@skip@temp@four = \gre@space@skip@ascendingpunctuminclinatumbigshift\relax% + \or% case 15 (ascending version of 11) + \gre@skip@temp@four = \gre@space@skip@ascendingpunctuminclinatummaxshift\relax% + \or% case 16 + \gre@skip@temp@four = \gre@space@skip@descendinginclinatumtonobarshift\relax% + \or% case 17 + \gre@skip@temp@four = \gre@space@skip@descendinginclinatumtonobarbigshift\relax% + \or% case 18 + \gre@skip@temp@four = \gre@space@skip@descendinginclinatumtonobarmaxshift\relax% + \or% case 19 + \gre@skip@temp@four = \gre@space@skip@ascendinginclinatumtonobarshift\relax% + \or% case 20 + \gre@skip@temp@four = \gre@space@skip@ascendinginclinatumtonobarbigshift\relax% + \or% case 21 + \gre@skip@temp@four = \gre@space@skip@ascendinginclinatumtonobarmaxshift\relax% + \or% case 22 + \gre@skip@temp@four = \gre@space@skip@halfspace\relax% + \or% case 23 + \gre@skip@temp@four = \gre@space@skip@punctuminclinatumunisonshift\relax% + \else% + \gre@error{Unrecognized spaceskip #1}% + \fi% }% % macro to end a glyph without ending the element % see \gre@get@glyphskip for the valus of the argument \def\GreEndOfGlyph#1{% - \GreNoBreak % - \gre@get@spaceskip{#1}% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \relax% + \GreNoBreak % + \gre@get@spaceskip{#1}% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \relax% }% % The different states of line break areas: @@ -1584,87 +1542,95 @@ % 2: no line break area due to <nlba> tag \xdef\gre@nlbstate{0}% +\newcount\gre@nobreakpenaltysave% +\newcount\gre@endofwordpenaltysave% +\newcount\gre@endofsyllablepenaltysave% +\newcount\gre@endafterbarpenaltysave% +\newcount\gre@endafterbaraltpenaltysave% +\newcount\gre@endofelementpenaltysave% +%\newcount\gre@hyphenpenaltysave% in gregoriotex-spaces.tex % first argument is if if the nlba is starting in neumes or not % second argument is if it is called from translation centering or not \def\GreBeginNLBArea#1#2{% - \xdef\gre@nlbinitialstate{\gre@nlbstate}% - \ifnum#2=0\relax % - \xdef\gre@nlbstate{2}% - \else % - \ifcase\gre@nlbstate % - \xdef\gre@nlbstate{1}% - \or % - \xdef\gre@nlbstate{1}% - \or % - \xdef\gre@nlbstate{2}% - \fi % - \fi % - \ifnum\gre@nlbinitialstate=0\relax % - \xdef\gre@nobreakpenaltysave{\grenobreakpenalty }% - \xdef\grenobreakpenalty{10001}% - \xdef\gre@endofwordpenaltysave{\greendofwordpenalty }% - \xdef\greendofwordpenalty{10001}% - \xdef\gre@endofsyllablepenaltysave{\greendofsyllablepenalty }% - \xdef\greendofsyllablepenalty{10001}% - \xdef\gre@endafterbarpenaltysave{\greendafterbarpenalty }% - \xdef\greendafterbarpenalty{10001}% - \xdef\gre@endafterbaraltpenaltysave{\greendafterbaraltpenalty }% - \xdef\greendafterbaraltpenalty{10001}% - \xdef\gre@endofelementpenaltysave{\greendofelementpenalty }% - \xdef\greendofelementpenalty{10001}% - \xdef\gre@hyphenpenaltysave{\grehyphenpenalty }% - \xdef\grehyphenpenalty{10001}% - \fi % + \xdef\gre@nlbinitialstate{\gre@nlbstate}% + \ifnum#2=0\relax % + \xdef\gre@nlbstate{2}% + \else % + \ifcase\gre@nlbstate % + \xdef\gre@nlbstate{1}% + \or % + \xdef\gre@nlbstate{1}% + \or % + \xdef\gre@nlbstate{2}% + \fi % + \fi % + \ifnum\gre@nlbinitialstate=0\relax % + \global\gre@nobreakpenaltysave=\gre@space@count@nobreakpenalty\relax % + \global\gre@endofwordpenaltysave=\gre@space@count@endofwordpenalty\relax % + \global\gre@endofsyllablepenaltysave=\gre@space@count@endofsyllablepenalty\relax % + \global\gre@endafterbarpenaltysave=\gre@space@count@endafterbarpenalty\relax % + \global\gre@endafterbaraltpenaltysave=\gre@space@count@endafterbaraltpenalty\relax % + \global\gre@endofelementpenaltysave=\gre@space@count@endofelementpenalty\relax % + \global\gre@hyphenpenaltysave=\gre@space@count@hyphenpenalty\relax % + % + \global\gre@space@count@nobreakpenalty=10001\relax % + \global\gre@space@count@endofwordpenalty=10001\relax % + \global\gre@space@count@endofsyllablepenalty=10001\relax % + \global\gre@space@count@endafterbarpenalty=10001\relax % + \global\gre@space@count@endafterbaraltpenalty=10001\relax % + \global\gre@space@count@endofelementpenalty=10001\relax % + \global\gre@space@count@hyphenpenalty=10001\relax % + \fi % }% \def\GreEndNLBArea#1#2{% - \xdef\gre@nlbinitialstate{\gre@nlbstate}% - \ifnum#2=0\relax % - \xdef\gre@nlbstate{0}% - \else % - \ifcase\gre@nlbstate % - \xdef\gre@nlbstate{0}% - \or % - \xdef\gre@nlbstate{0}% - \or % - \xdef\gre@nlbstate{2}% - \fi % - \fi % - % if gre@nlbstate is not 0, then nothing should happend - \ifnum\gre@nlbstate=0\relax % - \ifnum\gre@nlbinitialstate=0\else % - \xdef\grenobreakpenalty{\gre@nobreakpenaltysave }% - \xdef\greendofwordpenalty{\gre@endofwordpenaltysave}% - \xdef\greendofsyllablepenalty{\gre@endofsyllablepenaltysave}% - \xdef\greendafterbarpenalty{\gre@endafterbarpenaltysave}% - \xdef\greendafterbaraltpenalty{\gre@endafterbaraltpenaltysave}% - \xdef\greendofelementpenalty{\gre@endofelementpenaltysave}% - \xdef\grehyphenpenalty{\gre@hyphenpenaltysave}% - \ifcase #1\relax % 0 - \gre@penalty{\greendofelementpenalty}% - \or % 1 - \gre@penalty{\greendofsyllablepenalty}% - \or % 2 - % end of score, no penalty needs to be added - \or % 3 - % before bar, no penalty should to be added - \fi % - \fi % - \fi % + \xdef\gre@nlbinitialstate{\gre@nlbstate}% + \ifnum#2=0\relax % + \xdef\gre@nlbstate{0}% + \else % + \ifcase\gre@nlbstate % + \xdef\gre@nlbstate{0}% + \or % + \xdef\gre@nlbstate{0}% + \or % + \xdef\gre@nlbstate{2}% + \fi % + \fi % + % if gre@nlbstate is not 0, then nothing should happend + \ifnum\gre@nlbstate=0\relax % + \ifnum\gre@nlbinitialstate=0\else % + \global\gre@space@count@nobreakpenalty=\gre@nobreakpenaltysave\relax % + \global\gre@space@count@endofwordpenalty=\gre@endofwordpenaltysave\relax % + \global\gre@space@count@endofsyllablepenalty=\gre@endofsyllablepenaltysave\relax % + \global\gre@space@count@endafterbarpenalty=\gre@endafterbarpenaltysave\relax % + \global\gre@space@count@endafterbaraltpenalty=\gre@endafterbaraltpenaltysave\relax % + \global\gre@space@count@endofelementpenalty=\gre@endofelementpenaltysave\relax % + \global\gre@space@count@hyphenpenalty=\gre@hyphenpenaltysave\relax % + \ifcase #1\relax % 0 + \gre@penalty{\the\gre@space@count@endofelementpenalty}% + \or % 1 + \gre@penalty{\the\gre@space@count@endofsyllablepenalty}% + \or % 2 + % end of score, no penalty needs to be added + \or % 3 + % before bar, no penalty should to be added + \fi % + \fi % + \fi % }% \newif\ifgre@euouae@implies@nlba \gre@euouae@implies@nlbatrue \def\gresetbreakineuouae#1{% - \IfStrEqCase{#1}{% - {allow}% - {\gre@euouae@implies@nlbafalse}% - {prohibit}% - {\gre@euouae@implies@nlbatrue}% - }[% all other cases - \gre@error{Unrecognized option "#1" in \protect\gresetbreakineuouae\MessageBreak Possible options are: 'allow' and 'prohibit'}% - ]% + \IfStrEqCase{#1}{% + {allow}% + {\gre@euouae@implies@nlbafalse}% + {prohibit}% + {\gre@euouae@implies@nlbatrue}% + }[% all other cases + \gre@error{Unrecognized option "#1" in \protect\gresetbreakineuouae\MessageBreak Possible options are: 'allow' and 'prohibit'}% + ]% }% @@ -1677,25 +1643,25 @@ \gre@lasteuouaeindex=0 \def\GreBeginEUOUAE#1{% - \ifgre@euouae@implies@nlba % - \GreBeginNLBArea{0}{0}% - \fi % - \ifgre@raggedbreakbeforeeuouae % - \gre@lasteuouaeindex=#1\relax % - \gre@firstin@euouaetrue % - \fi % - \gre@in@euouaetrue % - % as soon as the EUOUAE starts, we stop blocking the EOL custos that might - % have been blocked on the prior syllable. - \gre@reseteolcustos % + \ifgre@euouae@implies@nlba % + \GreBeginNLBArea{0}{0}% + \fi % + \ifgre@raggedbreakbeforeeuouae % + \gre@lasteuouaeindex=#1\relax % + \gre@firstin@euouaetrue % + \fi % + \gre@in@euouaetrue % + % as soon as the EUOUAE starts, we stop blocking the EOL custos that might + % have been blocked on the prior syllable. + \gre@reseteolcustos % } \def\GreEndEUOUAE#1{% - \ifgre@euouae@implies@nlba % - \GreEndNLBArea{#1}{0}% - \fi % - \gre@in@euouaefalse % - \gre@firstin@euouaefalse % + \ifgre@euouae@implies@nlba % + \GreEndNLBArea{#1}{0}% + \fi % + \gre@in@euouaefalse % + \gre@firstin@euouaefalse % } \input gregoriotex-symbols.tex% @@ -1705,8 +1671,8 @@ %%%%%%%%% \def\gretilde{% - \ensuremath{\sim}% - \relax % + \ensuremath{\sim}% + \relax % }% @@ -1714,33 +1680,38 @@ \def\gresetgregoriofontscaled{\@ifnextchar[{\gre@setgregoriofontscaled}{\gre@setgregoriofontscaled[]}}% \def\gre@setgregoriofont[#1]#2{% - \gre@setgregoriofontscaled[#1]{#2}{100000}% - \relax % + \gre@setgregoriofontscaled[#1]{#2}{100000}% + \relax % }% \def\gre@setgregoriofontscaled[#1]#2#3{% - \if\relax\detokenize{#1}\relax % - \xdef\gre@gregoriofontname{#2}% - \expandafter\xdef\csname gre@fontfactor@#2\endcsname{#3}% - \gre@loadgregoriofont% - \gdef\GreCPVirgaReversaAscendensOnDLine##1{##1}% - \else % - \xdef\gre@gregoriofontname{#2-#1}% - \expandafter\xdef\csname gre@fontfactor@#2-#1\endcsname{#3}% - \gre@loadgregoriofont% - \gdef\GreCPVirgaReversaAscendensOnDLine##1{\GreCPVirgaReversaLongqueueAscendens}% - \fi % - \relax % + \IfStrEq{#2}{parmesan}{%%% DEPRECATED for removal in 5.0 + \gre@deprecated{'parmesan' font}{'granapadano' font}%%% DEPRECATED for removal in 5.0 + \gre@setgregoriofontscaled[#1]{granapadano}{#3}%%% DEPRECATED for removal in 5.0 + }{%%% DEPRECATED for removal in 5.0 + \if\relax\detokenize{#1}\relax % + \xdef\gre@gregoriofontname{#2}% + \expandafter\xdef\csname gre@fontfactor@#2\endcsname{#3}% + \gre@loadgregoriofont% + \gdef\GreCPVirgaReversaAscendensOnDLine##1{##1}% + \else % + \xdef\gre@gregoriofontname{#2-#1}% + \expandafter\xdef\csname gre@fontfactor@#2-#1\endcsname{#3}% + \gre@loadgregoriofont% + \gdef\GreCPVirgaReversaAscendensOnDLine##1{\GreCPVirgaReversaLongqueueAscendens}% + \fi % + }%%% DEPRECATED for removal in 5.0 + \relax % }% \def\gre@loadgregoriofont{% - \gre@count@temp@three = \the\gre@factor % - \gre@count@temp@two = \expandafter\csname gre@fontfactor@\gre@gregoriofontname\endcsname\relax % - \directlua{gregoriotex.set_font_factor([[\gre@gregoriofontname]], [[\the\gre@count@temp@two]])}% - \multiply\gre@count@temp@three by \gre@count@temp@two % - \global\font\gre@font@music={name:\gre@gregoriofontname} at \the\gre@count@temp@three sp\relax % - {\gre@font@music\directlua{gregoriotex.check_font_version() gregoriotex.scale_score_fonts([[\the\gre@count@temp@three]], [[\the\gre@factor]])}}% - \relax% + \gre@count@temp@three = \the\gre@factor % + \gre@count@temp@two = \expandafter\csname gre@fontfactor@\gre@gregoriofontname\endcsname\relax % + \directlua{gregoriotex.set_font_factor([[\gre@gregoriofontname]], [[\the\gre@count@temp@two]])}% + \multiply\gre@count@temp@three by \gre@count@temp@two % + \global\font\gre@font@music={name:\gre@gregoriofontname} at \the\gre@count@temp@three sp\relax % + {\gre@font@music\directlua{gregoriotex.check_font_version() gregoriotex.scale_score_fonts([[\the\gre@count@temp@three]], [[\the\gre@factor]])}}% + \relax% }% % the default gregorio font @@ -1751,52 +1722,20 @@ % gregoriostylefont is the font used for additional glyphs \def\gre@setstylefont{% - \gre@count@temp@three = \numexpr(\gre@factor * 100000)\relax % - \global\font\gre@font@style={name:greextra} at \the\gre@count@temp@three sp% - {\gre@font@music\directlua{gregoriotex.check_font_version() gregoriotex.scale_score_fonts([[\the\gre@count@temp@three]], [[\the\gre@factor]])}}% - \relax% -}% - -%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% The following style functions are defined for backwards compatibility. They will eventually be removed. -\def\greinitialformat#1{% OBSOLETE - \relax % -} -\let\gre@empty@initialformat\greinitialformat - -\def\grebiginitialformat#1{% OBSOLETE - \relax % -} -\let\gre@empty@biginitialformat\grebiginitialformat - -\def\gretranslationformat#1{% OBSOLETE - \relax % + \gre@count@temp@three = \numexpr(\gre@factor * 100000)\relax % + \global\font\gre@font@style={name:greextra} at \the\gre@count@temp@three sp% + {\gre@font@music\directlua{gregoriotex.check_font_version() gregoriotex.scale_score_fonts([[\the\gre@count@temp@three]], [[\the\gre@factor]])}}% + \relax% }% -\let\gre@empty@translationformat\gretranslationformat -\def\grenormalstafflinesformat{% OBSOLETE - \relax % -}% -\let\gre@empty@normalstafflinesformat\grenormalstafflinesformat - -\def\greadditionalstafflinesformat{% OBSOLETE - \relax % -}% -\let\gre@empty@additionalstafflinesformat\greadditionalstafflinesformat - -%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\def\GreSetStaffLinesFormat#1{%OBSOLETE - \gre@obsolete{\protect\GreSetStaffLinesFormat}{\protect\grechangestyle{normalstafflines}}% -}% %%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Master function for changing element formats %%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\grechangestyle#1#2{% - \IfStrEq{#1}{biginitial}{\gre@deprecated{biginitial style}{initial style}}{}%%% DEPRECATED for removal in 5.0 - \@ifnextchar[{\gre@changestyle{#1}{#2}}{\gre@changestyle{#1}{#2}[\relax]}% + \IfStrEq{#1}{biginitial}{\gre@deprecated{biginitial style}{initial style}}{}%%% DEPRECATED for removal in 5.0 + \@ifnextchar[{\gre@changestyle{#1}{#2}}{\gre@changestyle{#1}{#2}[\relax]}% }% % because the mechanism for the defining the formats differs under LaTeX and PlainTeX the underlying function which does the work is defined in gregoriotex.sty or gregoriotex.tex respectively. @@ -1807,29 +1746,25 @@ %%%%%%%%%%%%%%%%%%% \def\grechangestaffsize#1{% - \ifnum#1<0\relax% - \gre@error{Staff size must be a positive integer.}% - \else% - \gre@changedimenfactor{\gre@factor}{#1}% - \global\gre@factor=#1\relax % - \fi% - \gre@loadgregoriofont% - \relax % -}% - -\def\setgrefactor#1{%OBSOLETE - \gre@obsolete{\protect\setgrefactor}{\protect\grechangestaffsize}% + \ifnum#1<0\relax% + \gre@error{Staff size must be a positive integer.}% + \else% + \gre@changedimenfactor{\gre@factor}{#1}% + \global\gre@factor=#1\relax % + \fi% + \gre@loadgregoriofont% + \relax % }% %%%%%%%%%%%%%%%%%%% %% headers %%%%%%%%%%%%%%%%%%% \def\gresetheadercapture#1#2#3{% - \directlua{gregoriotex.set_header_capture("#1","#2","#3")}% + \directlua{gregoriotex.set_header_capture("#1","#2","#3")}% }% \def\GreHeader#1#2{% - \directlua{gregoriotex.capture_header("#1","#2")}% + \directlua{gregoriotex.capture_header("#1","#2")}% }% %%%%%%%%%%%%%%%%%%% @@ -1840,37 +1775,20 @@ % 0 = never compile (default) % 1 = auto compile (compile outdated scores and those lacking a compiled version) % 2 = compile all scores -\def\gre@compilegabc{0} +\def\gre@compilegabc{0}% % User macro to change compilation behavior \def\gresetcompilegabc#1{% - \IfStrEqCase{#1}{% - {force}{\gdef\gre@compilegabc{2}}% - {auto}{\gdef\gre@compilegabc{1}}% - {never}{\gdef\gre@compilegabc{0}}% - }[% all other cases - \gre@error{Unrecognized argument for \protect\gresetcompilegabc.}% - ]% + \IfStrEqCase{#1}{% + {force}{\gdef\gre@compilegabc{2}}% + {auto}{\gdef\gre@compilegabc{1}}% + {never}{\gdef\gre@compilegabc{0}}% + }[% all other cases + \gre@error{Unrecognized argument for \protect\gresetcompilegabc.}% + ]% }% - -% User macro to force gregriotex to recompile gabc files. Useful for when there -% are changes to gregoriotex but the GREGORIOTEX API VERSION is not changed. -\def\forcecompilegabc{%OBSOLETE - \gre@obsolete{\protect\forcecompilegabc}{\protect\gresetcompilegabc{force}}% -}% - -% User macro to let gregoriotex auto recompile gabc files as necessary. -% Intended to be used in the main tex file to revert the previous macro. -\def\autocompilegabc{%OBSOLETE - \gre@obsolete{\protect\autocompilegabc}{\protect\gresetcompilegabc{auto}}% -}% - -% User macro to force score inclusion without compilation. -\def\nevercompilegabc{%OBSOLETE - \gre@obsolete{\protect\nevercompilegabc}{\protect\gresetcompilegabc{never}}% -} - +\def\gre@allowdeprecated@asboolean{\ifgre@allowdeprecated true\else false\fi}% % Internal marco which includes a score when \gregorioscore is called without the optional argument. Behavior is determined by the value of \gre@compilegabc flag. % @@ -1886,17 +1804,17 @@ % This forces gregoriotex to recompile the gabc file. \def\gre@gregorioscore#1{% - \ifcase\gre@compilegabc% case 0, never compile - \gre@debugmsg{compile}{Refusing to compile #1}% - \input #1% - \or% case 1, auto compile - \gre@debugmsg{compile}{Auto compile #1}% - \directlua{gregoriotex.include_score([[#1]], nil)}% - \or% case 2, force compile - \gre@debugmsg{compile}{Forced to compile #1}% - \directlua{gregoriotex.include_score([[#1]], true)}% - \fi% - \relax% + \ifcase\gre@compilegabc% case 0, never compile + \gre@debugmsg{compile}{Refusing to compile #1}% + \input #1% + \or% case 1, auto compile + \gre@debugmsg{compile}{Auto compile #1}% + \directlua{gregoriotex.include_score([[#1]], nil, \gre@allowdeprecated@asboolean)}% + \or% case 2, force compile + \gre@debugmsg{compile}{Forced to compile #1}% + \directlua{gregoriotex.include_score([[#1]], true, \gre@allowdeprecated@asboolean)}% + \fi% + \relax% }% % The internal macro called when \gregorioscore is called with the optional argument. Behavior is determined by the value of the argument: @@ -1904,33 +1822,29 @@ % a - perform the checks to see if the score needs to be recompiled and do so only if necessary % f - force the compilation of the score before including it \def\gre@gregorioscore@option[#1]#2{% - \ifx #1n\relax% - \gre@debugmsg{compile}{Override not compiling #2}% - \input #2% - \else% - \ifx #1f\relax% - \gre@debugmsg{compile}{Override force compiling #2}% - \directlua{gregoriotex.include_score([[#2]], true)}% - \else% - \ifx #1a\relax% - \gre@debugmsg{compile}{Override auto compiling #2}% - \directlua{gregoriotex.include_score([[#2]], nil)}% - \else% - \gre@error{Unrecognized option "#1" for \protect\includescore\MessageBreak Possible options are: 'f', 'a', and 'n'}% - \fi% - \fi% - \fi% - \relax% + \ifx #1n\relax% + \gre@debugmsg{compile}{Override not compiling #2}% + \input #2% + \else% + \ifx #1f\relax% + \gre@debugmsg{compile}{Override force compiling #2}% + \directlua{gregoriotex.include_score([[#2]], true, \gre@allowdeprecated@asboolean)}% + \else% + \ifx #1a\relax% + \gre@debugmsg{compile}{Override auto compiling #2}% + \directlua{gregoriotex.include_score([[#2]], nil, \gre@allowdeprecated@asboolean)}% + \else% + \gre@error{Unrecognized option "#1" for \protect\includescore\MessageBreak Possible options are: 'f', 'a', and 'n'}% + \fi% + \fi% + \fi% + \relax% }% % The main macro used by the user to input scores into the document. -\def\includescore{%OBSOLETE - \gre@obsolete{\protect\includescore}{\protect\gregorioscore}% -}% - \def\gregorioscore{\@ifnextchar[{\gre@gregorioscore@option}% - {\gre@gregorioscore}% + {\gre@gregorioscore}% }% % If called without the optional argument: '\gregorioscore{Antiphon}' @@ -1950,16 +1864,16 @@ % Macros for compiling short snippets of GABC directly expressed in TeX -\long\def\gre@gabcsnippet@option[#1]#2{%%% DEPRECATED by 4.1 - \gre@deprecated{\protect\gabcsnippet with initial-style argument}{\protect\gresetinitiallines}% - \directlua{gregoriotex.direct_gabc("\luatexluaescapestring{\unexpanded\expandafter{#2}}", "initial-style: #1;")}% +\long\def\gre@gabcsnippet@option[#1]#2{%%% DEPRECATED for removal in 5.0 + \gre@deprecated{\protect\gabcsnippet with initial-style argument}{\protect\gresetinitiallines}% + \directlua{gregoriotex.direct_gabc("\luatexluaescapestring{\unexpanded\expandafter{#2}}", "initial-style: #1;", \gre@allowdeprecated@asboolean)}% }% \long\def\gre@gabcsnippet#1{% - \directlua{gregoriotex.direct_gabc("\luatexluaescapestring{\unexpanded\expandafter{#1}}")}% + \directlua{gregoriotex.direct_gabc("\luatexluaescapestring{\unexpanded\expandafter{#1}}", nil, \gre@allowdeprecated@asboolean)}% }% -%%% \gre@gabcsnipper@option is DEPRECATED by 4.1 +%%% \gre@gabcsnipper@option is DEPRECATED for removal in 5.0 \def\gabcsnippet{\@ifnextchar[{\gre@gabcsnippet@option}{\gre@gabcsnippet}}% %%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1968,16 +1882,16 @@ % a zero-width hyphen, useful for fine tuning line endings. To input in gabc verb for example. \def\gre@char@zerohyph{% - \hbox to 0pt{% - \char\the\hyphenchar\font % - \hss % - }% + \hbox to 0pt{% + \char\the\hyphenchar\font % + \hss % + }% }% % a normal hyphen \def\gre@char@normalhyphen{% - %- - \char\the\hyphenchar\font % + %- + \char\the\hyphenchar\font % }% % the definition that will be always used for end of lines hyphens in gregorio, except if one of the two before is explicitely used @@ -1985,35 +1899,27 @@ % macro to change the definition of the hyphen: \def\greseteolhyphen#1{% - \IfStrEqCase{#1}{% - {normal}% - {\global\let\GreHyph\gre@char@normalhyphen}% - {zero}% - {\global\let\GreHyph\gre@char@zerohyph}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\greseteolhyphen\MessageBreak Possible options are: 'normal' and 'zero'}% - ]% -}% - -\def\GreUseNormalHyphen{%OBSOLETE - \gre@obsolete{\protect\GreUseNormalHyphen}{\protect\greseteolhyphen{normal}}% -}% - -\def\GreUseZeroHyphen{%OBSOLETE - \gre@obsolete{\protect\GreUseZeroHyphen}{\protect\greseteolhyphen{zero}}% + \IfStrEqCase{#1}{% + {normal}% + {\global\let\GreHyph\gre@char@normalhyphen}% + {zero}% + {\global\let\GreHyph\gre@char@zerohyph}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\greseteolhyphen\MessageBreak Possible options are: 'normal' and 'zero'}% + ]% }% % macro to force hyphenation of all syllables. \newif\ifgre@forcehyphen\gre@forcehyphenfalse% \def\gresethyphen#1{% - \IfStrEqCase{#1}{% - {force}% - {\gre@forcehyphentrue}% - {auto}% - {\gre@forcehyphenfalse}% - }[% all other cases - \gre@error{Unrecognized option "#1" in \protect\gresethyphen\MessageBreak Possible options are: 'force' and 'auto'}% - ]% + \IfStrEqCase{#1}{% + {force}% + {\gre@forcehyphentrue}% + {auto}% + {\gre@forcehyphenfalse}% + }[% all other cases + \gre@error{Unrecognized option "#1" in \protect\gresethyphen\MessageBreak Possible options are: 'force' and 'auto'}% + ]% }% % macro called before the headers of a given inclusion |