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 | |
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')
13 files changed, 5688 insertions, 5616 deletions
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-chars.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-chars.tex index 25bbe59a204..5303a304c01 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-chars.tex +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-chars.tex @@ -18,7 +18,7 @@ % along with Gregorio. If not, see <http://www.gnu.org/licenses/>. \gre@debugmsg{general}{Loading gregoriotex-chars.tex}% -\gre@declarefileversion{gregoriotex-chars.tex}{4.1.1}% GREGORIO_VERSION +\gre@declarefileversion{gregoriotex-chars.tex}{4.2.0-beta1}% GREGORIO_VERSION \def\gre@char@fuse@punctum@one{\GreFuseTwo{\GreCPLeadingPunctumOne}{\GreCPPunctum}}% \def\gre@char@fuse@quilisma@one{\GreFuseTwo{\GreCPLeadingQuilismaOne}{\GreCPPunctum}}% @@ -31,28 +31,28 @@ % horizontal episema \newbox\gre@box@hep% \def\gre@def@char@he#1#2{% - \expandafter\def\csname gre@char@he@#1\endcsname##1{% - \ifx##1f\csname GreCPHEpisema#2\endcsname% - \else% - \setbox\gre@box@hep\hbox{\csname GreCPHEpisema#2\endcsname}% - \hbox to \wd\gre@box@hep{% - \ifx##1l\else\hfil\fi% - \csname GreCPHEpisema#2Reduced\endcsname% - \ifx##1r\else\hfil\fi% - }% - \fi% - }% + \expandafter\def\csname gre@char@he@#1\endcsname##1{% + \ifx##1f\csname GreCPHEpisema#2\endcsname% + \else% + \setbox\gre@box@hep\hbox{\csname GreCPHEpisema#2\endcsname}% + \hbox to \wd\gre@box@hep{% + \ifx##1l\else\hfil\fi% + \csname GreCPHEpisema#2Reduced\endcsname% + \ifx##1r\else\hfil\fi% + }% + \fi% + }% }% \def\gre@def@char@he@porr#1#2{% - \expandafter\def\csname gre@char@he@#1\endcsname##1##2{% - \ifcase##1\gre@char@he@punctum{##2}% - \or\csname GreCPHEpisema#2One\endcsname% - \or\csname GreCPHEpisema#2Two\endcsname% - \or\csname GreCPHEpisema#2Three\endcsname% - \or\csname GreCPHEpisema#2Four\endcsname% - \or\csname GreCPHEpisema#2Five\endcsname% - \fi% - }% + \expandafter\def\csname gre@char@he@#1\endcsname##1##2{% + \ifcase##1\gre@char@he@punctum{##2}% + \or\csname GreCPHEpisema#2One\endcsname% + \or\csname GreCPHEpisema#2Two\endcsname% + \or\csname GreCPHEpisema#2Three\endcsname% + \or\csname GreCPHEpisema#2Four\endcsname% + \or\csname GreCPHEpisema#2Five\endcsname% + \fi% + }% }% \gre@def@char@he{punctum}{Punctum}% \gre@def@char@he{punctum@line@br}{PunctumLineBR}% @@ -61,7 +61,7 @@ \gre@def@char@he{punctum@line@bl}{PunctumLineBL}% \gre@def@char@he{punctum@line@blbr}{PunctumLineBLBR}% \gre@def@char@he{punctumauctus@line@bl}{PunctumAuctusLineBL}% -\gre@def@char@he{salicus@oriscus}{SalicusOriscus}% +\gre@def@char@he{salicus@oriscus}{AscendensOriscusLineBLTR}% \gre@def@char@he{flexus}{FlexusDeminutus}% \gre@def@char@he{initio}{Debilis}% \gre@def@char@he{virga}{Virga}% @@ -74,8 +74,8 @@ \gre@def@char@he@porr{porrectusfl}{PorrectusFlexus}% \gre@def@char@he{quilisma}{Quilisma}% \gre@def@char@he{quilisma@line@tr}{QuilismaLineTR}% -\gre@def@char@he{oriscus}{Oriscus}% -\gre@def@char@he{oriscus@line@tr}{OriscusLineTR}% +\gre@def@char@he{oriscus}{AscendensOriscus}% +\gre@def@char@he{oriscus@line@tr}{AscendensOriscusLineTR}% \gre@def@char@he{smallpunctum}{HighPes}% "smallpunctum" is the top punctum in a pes \gre@def@char@he{flat}{Flat}% \gre@def@char@he{sharp}{Sharp}% @@ -107,95 +107,79 @@ %%%%%%%%%%%%%%%%% \def\gresetglyphstyle#1{% - \IfStrEqCase{#1}{% - {default}% - {% - \greresetglyph{Flat}% - \greresetglyph{FlatHole}% - \greresetglyph{Natural}% - \greresetglyph{NaturalHole}% - \greresetglyph{Sharp}% - \greresetglyph{SharpHole}% - \greresetglyph{CClef}% - \greresetglyph{FClef}% - \greresetglyph{CClefChange}% - \greresetglyph{FClefChange}% - \greresetglyph{AuctumMora}% - \greresetglyph{VEpisema}% - \greresetglyph{CustosUpLong}% - \greresetglyph{CustosUpShort}% - \greresetglyph{CustosUpMedium}% - \greresetglyph{CustosDownLong}% - \greresetglyph{CustosDownShort}% - \greresetglyph{CustosDownMedium}% - \greresetglyph{BarBrace}% - \greresetglyph{Punctum}% - \relax % - }% - {medicaea}% - {% - \gresetglyphstyle{default}\gre@usestylecommon % - \grechangeglyph{CustosUpLong}{greextra}{MedicaeaCustosUpLong}% - \grechangeglyph{CustosUpShort}{greextra}{MedicaeaCustosUpShort}% - \grechangeglyph{CustosUpMedium}{greextra}{MedicaeaCustosUpMedium}% - \grechangeglyph{CustosDownLong}{greextra}{MedicaeaCustosDownLong}% - \grechangeglyph{CustosDownShort}{greextra}{MedicaeaCustosDownShort}% - \grechangeglyph{CustosDownMedium}{greextra}{MedicaeaCustosDownMedium}% - \grechangeglyph{CClef}{greextra}{MedicaeaCClef}% - \grechangeglyph{FClef}{greextra}{MedicaeaFClef}% - \grechangeglyph{CClefChange}{greextra}{MedicaeaCClefChange}% - \grechangeglyph{FClefChange}{greextra}{MedicaeaFClefChange}% - \grechangeglyph{Flat}{greextra}{MedicaeaFlat}% - \grechangeglyph{FlatHole}{greextra}{MedicaeaFlatHole}% - \relax % - }% - {hufnagel}% - {% - \gresetglyphstyle{default}\gre@usestylecommon % - \grechangeglyph{CustosUpLong}{greextra}{HufnagelCustosUpLong}% - \grechangeglyph{CustosUpShort}{greextra}{HufnagelCustosUpShort}% - \grechangeglyph{CustosUpMedium}{greextra}{HufnagelCustosUpMedium}% - \grechangeglyph{CustosDownLong}{greextra}{HufnagelCustosDownLong}% - \grechangeglyph{CustosDownShort}{greextra}{HufnagelCustosDownShort}% - \grechangeglyph{CustosDownMedium}{greextra}{HufnagelCustosDownMedium}% - \grechangeglyph{CClef}{greextra}{HufnagelCClef}% - \grechangeglyph{FClef}{greextra}{HufnagelFClef}% - \grechangeglyph{CClefChange}{greextra}{HufnagelCClefChange}% - \grechangeglyph{FClefChange}{greextra}{HufnagelFClefChange}% - \grechangeglyph{Flat}{greextra}{HufnagelFlat}% - \grechangeglyph{FlatHole}{greextra}{HufnagelFlatHole}% - \relax % - }% - {mensural}% - {% - \gresetglyphstyle{default}\gre@usestylecommon % - \grechangeglyph{CustosUpLong}{greextra}{MensuralCustosUpLong}% - \grechangeglyph{CustosUpShort}{greextra}{MensuralCustosUpShort}% - \grechangeglyph{CustosUpMedium}{greextra}{MensuralCustosUpMedium}% - \grechangeglyph{CustosDownLong}{greextra}{MensuralCustosDownLong}% - \grechangeglyph{CustosDownShort}{greextra}{MensuralCustosDownShort}% - \grechangeglyph{CustosDownMedium}{greextra}{MensuralCustosDownMedium}% - \grechangeglyph{Flat}{greextra}{MensuralFlat}% - \grechangeglyph{FlatHole}{greextra}{MensuralFlatHole}% - \relax % - }% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetglyphstyle\MessageBreak Possible options are: 'default', 'medicaea', 'hufnagel' and 'mensural'}% - ]% -}% - -\def\greusedefaultstyle{%OBSOLETE - \gre@obsolete{\protect\greusedefaultstyle}{\protect\gresetglyphstyle{default}}% -}% - -\def\greusemedicaeastyle{%OBSOLETE - \gre@obsolete{\protect\greusemedicaeastyle}{\protect\gresetglyphstyle{medicaea}}% -}% - -\def\greusehufnagelstyle{%OBSOLETE - \gre@obsolete{\protect\greusehufnagelstyle}{\protect\gresetglyphstyle{hufnagel}}% -}% - -\def\greusemensuralstyle{%OBSOLETE - \gre@obsolete{\protect\greusemensuralstyle}{\protect\gresetglyphstyle{mensural}}% + \IfStrEqCase{#1}{% + {default}% + {% + \greresetglyph{Flat}% + \greresetglyph{FlatHole}% + \greresetglyph{Natural}% + \greresetglyph{NaturalHole}% + \greresetglyph{Sharp}% + \greresetglyph{SharpHole}% + \greresetglyph{CClef}% + \greresetglyph{FClef}% + \greresetglyph{CClefChange}% + \greresetglyph{FClefChange}% + \greresetglyph{AuctumMora}% + \greresetglyph{VEpisema}% + \greresetglyph{CustosUpLong}% + \greresetglyph{CustosUpShort}% + \greresetglyph{CustosUpMedium}% + \greresetglyph{CustosDownLong}% + \greresetglyph{CustosDownShort}% + \greresetglyph{CustosDownMedium}% + \greresetglyph{BarBrace}% + \greresetglyph{Punctum}% + \relax % + }% + {medicaea}% + {% + \gresetglyphstyle{default}\gre@usestylecommon % + \grechangeglyph{CustosUpLong}{greextra}{MedicaeaCustosUpLong}% + \grechangeglyph{CustosUpShort}{greextra}{MedicaeaCustosUpShort}% + \grechangeglyph{CustosUpMedium}{greextra}{MedicaeaCustosUpMedium}% + \grechangeglyph{CustosDownLong}{greextra}{MedicaeaCustosDownLong}% + \grechangeglyph{CustosDownShort}{greextra}{MedicaeaCustosDownShort}% + \grechangeglyph{CustosDownMedium}{greextra}{MedicaeaCustosDownMedium}% + \grechangeglyph{CClef}{greextra}{MedicaeaCClef}% + \grechangeglyph{FClef}{greextra}{MedicaeaFClef}% + \grechangeglyph{CClefChange}{greextra}{MedicaeaCClefChange}% + \grechangeglyph{FClefChange}{greextra}{MedicaeaFClefChange}% + \grechangeglyph{Flat}{greextra}{MedicaeaFlat}% + \grechangeglyph{FlatHole}{greextra}{MedicaeaFlatHole}% + \relax % + }% + {hufnagel}% + {% + \gresetglyphstyle{default}\gre@usestylecommon % + \grechangeglyph{CustosUpLong}{greextra}{HufnagelCustosUpLong}% + \grechangeglyph{CustosUpShort}{greextra}{HufnagelCustosUpShort}% + \grechangeglyph{CustosUpMedium}{greextra}{HufnagelCustosUpMedium}% + \grechangeglyph{CustosDownLong}{greextra}{HufnagelCustosDownLong}% + \grechangeglyph{CustosDownShort}{greextra}{HufnagelCustosDownShort}% + \grechangeglyph{CustosDownMedium}{greextra}{HufnagelCustosDownMedium}% + \grechangeglyph{CClef}{greextra}{HufnagelCClef}% + \grechangeglyph{FClef}{greextra}{HufnagelFClef}% + \grechangeglyph{CClefChange}{greextra}{HufnagelCClefChange}% + \grechangeglyph{FClefChange}{greextra}{HufnagelFClefChange}% + \grechangeglyph{Flat}{greextra}{HufnagelFlat}% + \grechangeglyph{FlatHole}{greextra}{HufnagelFlatHole}% + \relax % + }% + {mensural}% + {% + \gresetglyphstyle{default}\gre@usestylecommon % + \grechangeglyph{CustosUpLong}{greextra}{MensuralCustosUpLong}% + \grechangeglyph{CustosUpShort}{greextra}{MensuralCustosUpShort}% + \grechangeglyph{CustosUpMedium}{greextra}{MensuralCustosUpMedium}% + \grechangeglyph{CustosDownLong}{greextra}{MensuralCustosDownLong}% + \grechangeglyph{CustosDownShort}{greextra}{MensuralCustosDownShort}% + \grechangeglyph{CustosDownMedium}{greextra}{MensuralCustosDownMedium}% + \grechangeglyph{Flat}{greextra}{MensuralFlat}% + \grechangeglyph{FlatHole}{greextra}{MensuralFlatHole}% + \relax % + }% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetglyphstyle\MessageBreak Possible options are: 'default', 'medicaea', 'hufnagel' and 'mensural'}% + ]% }% 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 diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.lua b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.lua index 659502e7d63..125acc458b4 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.lua +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.lua @@ -20,7 +20,7 @@ -- this file contains lua functions used by GregorioTeX St. Gall ancient -- neume support when called with LuaTeX. --- GREGORIO_VERSION 4.1.1 +-- GREGORIO_VERSION 4.2.0-beta1 local catcode_at_letter = luatexbase.catcodetables['gre@atletter'] diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.tex index 25ebe0b847c..15d18920417 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.tex +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.tex @@ -20,45 +20,45 @@ % this file contains macros for St. Gall ancient neume support \gre@debugmsg{general}{Loading gregoriotex-nabc.tex}% -\gre@declarefileversion{gregoriotex-nabc.tex}{4.1.1}% GREGORIO_VERSION +\gre@declarefileversion{gregoriotex-nabc.tex}{4.2.0-beta1}% GREGORIO_VERSION -\xdef\gre@nabcfontname{gregall} -\xdef\gre@nabcfontsize{8} +\xdef\gre@nabcfontname{gregall}% +\xdef\gre@nabcfontsize{8}% \def\gresetnabcfont#1#2{% - \xdef\gre@nabcfontname{#1}% - \xdef\gre@nabcfontsize{#2}% - \global\font\gre@font@nabc={name:#1} at #2 pt\relax % - {% - \gre@font@nabc % - \directlua{gregoriotex.init_nabc_font("\luatexluaescapestring{#1}")}% - }% - \gre@nabcfontloadedtrue% + \xdef\gre@nabcfontname{#1}% + \xdef\gre@nabcfontsize{#2}% + \global\font\gre@font@nabc={name:#1} at #2 pt\relax % + {% + \gre@font@nabc % + \directlua{gregoriotex.init_nabc_font("\luatexluaescapestring{#1}")}% + }% + \gre@nabcfontloadedtrue% } \def\grenabccharno#1#2#3{{\directlua{ - gregoriotex.print_nabc(gregoriotex.parse_nabc("#1", "\luatexluaescapestring{#2}", #3)) + gregoriotex.print_nabc(gregoriotex.parse_nabc("#1", "\luatexluaescapestring{#2}", #3)) }}} \def\GreNABCChar#1{{% - %\catcode`\~=12{}% - %\catcode`\@=11{}% - \gre@font@nabc % - \gre@style@nabc % - \grenabccharno{#1}{\gre@nabcfontname}{1}% - \endgre@style@nabc% + %\catcode`\~=12{}% + %\catcode`\@=11{}% + \gre@font@nabc % + \gre@style@nabc % + \grenabccharno{#1}{\gre@nabcfontname}{1}% + \endgre@style@nabc% }} \def\GreNABCNeumes#1#2{% - \GreSetTextAboveLines{\GreNABCChar{#2}}% + \GreSetTextAboveLines{\GreNABCChar{#2}}% } \newif\ifgre@nabcfontloaded% \gre@nabcfontloadedfalse% \def\GreScoreNABCLines#1{% - \ifgre@nabcfontloaded\else% - \gresetnabcfont{\gre@nabcfontname}{\gre@nabcfontsize}% - \fi % + \ifgre@nabcfontloaded\else% + \gresetnabcfont{\gre@nabcfontname}{\gre@nabcfontsize}% + \fi % } diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.lua b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.lua index 0acb9789e75..17879fe855b 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.lua +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.lua @@ -19,7 +19,7 @@ -- this file contains lua functions to support signs used by GregorioTeX. --- GREGORIO_VERSION 4.1.1 +-- GREGORIO_VERSION 4.2.0-beta1 local err = gregoriotex.module.err local warn = gregoriotex.module.warn @@ -135,8 +135,8 @@ local offset_cases = { -- oriscus as last note { case = 'FinalOriscus', - v = [[\gre@vepisemaorrareaux{0}{\GreCPOriscus}{0}{0}{#2}{#3}{#4}]], - h = [[\gre@hepisorlineaux{\GreCPOriscus}{\gre@char@he@oriscus{#4}}{2}{#3}]], + v = [[\gre@vepisemaorrareaux{0}{\GreCPAscendensOriscus}{0}{0}{#2}{#3}{#4}]], + h = [[\gre@hepisorlineaux{\GreCPAscendensOriscus}{\gre@char@he@oriscus{#4}}{2}{#3}]], }, -- second-to-last note, with a second ambitus of one, when last note is a -- standard punctum (like the second note of ghg) @@ -155,7 +155,7 @@ local offset_cases = { -- oriscus as first note, disconnected from next note { case = 'InitialOriscus', - v = [[\gre@vepisemaorrareaux{0}{\GreCPOriscusReversus}{0}{0}{#2}{#3}{#4}]], + v = [[\gre@vepisemaorrareaux{0}{\GreCPDescendensOriscus}{0}{0}{#2}{#3}{#4}]], h = [[\gre@hepisorlineaux{0}{\gre@char@he@oriscus{#4}}{0}{#3}]], }, -- quilisma as first note, disconnected from next note @@ -370,7 +370,7 @@ local offset_cases = { -- oriscus as first note, connected to next higher note { case = 'InitialConnectedOriscus', - v = [[\gre@vepisemaorrareaux{0}{\GreCPOriscusLineTR}{0}{0}{#2}{#3}{#4}]], + v = [[\gre@vepisemaorrareaux{0}{\GreCPAscendensOriscusLineTR}{0}{0}{#2}{#3}{#4}]], h = [[\gre@hepisorlineaux{0}{\gre@char@he@oriscus@line@tr{#4}}{0}{#3}]], }, -- punctum as last note, connected to prior higher note @@ -407,13 +407,13 @@ local offset_cases = { -- least two { case = 'SalicusOriscusWide', - v = [[\gre@vepisemaorrareaux{\GreCPVirgaStrataThreeNothing}{\GreCPSalicusOriscus}{3}{0}{#2}{#3}{#4}]], + v = [[\gre@vepisemaorrareaux{\GreCPVirgaStrataThreeNothing}{\GreCPAscendensOriscusLineBLTR}{3}{0}{#2}{#3}{#4}]], h = [[\gre@hepisorlineaux{\GreCPVirgaStrataThreeNothing}{\gre@char@he@salicus@oriscus{#4}}{4}{#3}]], }, -- "oriscus" as the middle note of a salicus with a second ambitus of one { case = 'SalicusOriscusOne', - v = [[\gre@vepisemaorrareaux{\GreCPVirgaStrataOneNothing}{\GreCPOriscus}{3}{0}{#2}{#3}{#4}]], + v = [[\gre@vepisemaorrareaux{\GreCPVirgaStrataOneNothing}{\GreCPAscendensOriscus}{3}{0}{#2}{#3}{#4}]], h = [[\gre@hepisorlineaux{\GreCPVirgaStrataOneNothing}{\gre@char@he@salicus@oriscus{#4}}{4}{#3}]], }, -- punctum fused to the next note @@ -431,8 +431,8 @@ local offset_cases = { -- oriscus fused to the next note { case = 'LeadingOriscus', - v = [[\gre@vepisemaorrareaux{0}{\GreCPOriscus}{0}{0}{#2}{#3}{#4}]], - h = [[\gre@hepisorlineaux{\GreCPOriscusTwoUp}{\gre@char@he@oriscus{#4}}{2}{#3}]], + v = [[\gre@vepisemaorrareaux{0}{\GreCPAscendensOriscus}{0}{0}{#2}{#3}{#4}]], + h = [[\gre@hepisorlineaux{\GreCPAscendensOriscusTwoUp}{\gre@char@he@oriscus{#4}}{2}{#3}]], }, -- flat { diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.tex index 36ffb0a23ac..b008290faa0 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.tex +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.tex @@ -23,14 +23,14 @@ \def\grebarbracewidth{.58879}% \gre@debugmsg{general}{Loading gregoriotex-signs.tex}% -\gre@declarefileversion{gregoriotex-signs.tex}{4.1.1}% GREGORIO_VERSION +\gre@declarefileversion{gregoriotex-signs.tex}{4.2.0-beta1}% GREGORIO_VERSION \def\gre@usestylecommon{% - \ifgre@usestylefont\else % - \gre@usestylefonttrue% - \gre@setstylefont % - \fi % - \relax % + \ifgre@usestylefont\else % + \gre@usestylefonttrue% + \gre@setstylefont % + \fi % + \relax % }% \gresetglyphstyle{default}% @@ -44,40 +44,40 @@ \gre@disablemorafalse \def\greprintsigns#1#2{% - \IfStrEqCase{#2}{% - {enable}% - {% - \IfStrEqCase{#1}{% - {vepisema}% - {\global\gre@disablevepisemafalse}% - {hepisema}% - {\global\gre@disablehepisemafalse}% - {mora}% - {\global\gre@disablemorafalse}% - {all}% - {\global\gre@disablemorafalse\global\gre@disablevepisemafalse\global\gre@disablehepisemafalse}% - }[% all other cases - \gre@error{Unrecognized first argument for \protect\greprintsigns}% - ]% - }% - {disable}% - {% - \IfStrEqCase{#1}{% - {vepisema}% - {\global\gre@disablevepisematrue}% - {hepisema}% - {\global\gre@disablehepisematrue}% - {mora}% - {\global\gre@disablemoratrue}% - {all}% - {\global\gre@disablemoratrue\global\gre@disablevepisematrue\global\gre@disablehepisematrue}% - }[% all other cases - \gre@error{Unrecognized first argument for \protect\greprintsigns}% - ]% - }% - }[% all other cases - \gre@error{Unrecognized second argument for \protect\greprintsigns}% - ]% + \IfStrEqCase{#2}{% + {enable}% + {% + \IfStrEqCase{#1}{% + {vepisema}% + {\global\gre@disablevepisemafalse}% + {hepisema}% + {\global\gre@disablehepisemafalse}% + {mora}% + {\global\gre@disablemorafalse}% + {all}% + {\global\gre@disablemorafalse\global\gre@disablevepisemafalse\global\gre@disablehepisemafalse}% + }[% all other cases + \gre@error{Unrecognized first argument for \protect\greprintsigns}% + ]% + }% + {disable}% + {% + \IfStrEqCase{#1}{% + {vepisema}% + {\global\gre@disablevepisematrue}% + {hepisema}% + {\global\gre@disablehepisematrue}% + {mora}% + {\global\gre@disablemoratrue}% + {all}% + {\global\gre@disablemoratrue\global\gre@disablevepisematrue\global\gre@disablehepisematrue}% + }[% all other cases + \gre@error{Unrecognized first argument for \protect\greprintsigns}% + ]% + }% + }[% all other cases + \gre@error{Unrecognized second argument for \protect\greprintsigns}% + ]% }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -103,24 +103,24 @@ % #1 is the type of discretionary, for penalty assignment. Recognized types: % - 0: clef change \def\GreDiscretionary#1#2#3{% - \global\let\gre@hskip\kern % - \global\let\gre@penalty\gre@falsepenalty % - \global\xdef\gre@insidediscretionary{\number 1}% - \discretionary{% - \global\gre@lastoflinecount=1\relax % (a good magic trick) - \gre@debugmsg{bolshift}{discretionary pre lastoflinecount: \the\gre@lastoflinecount}% - #2% - }{% - \global\gre@lastoflinecount=2\relax % (a good magic trick) - \gre@debugmsg{bolshift}{discretionary post lastoflinecount: \the\gre@lastoflinecount}% - }{% - \gre@debugmsg{bolshift}{discretionary no lastoflinecount: \the\gre@lastoflinecount}% - #3% - }% - \global\xdef\gre@insidediscretionary{\number 0}% - \global\let\gre@hskip\hskip % - \global\let\gre@penalty\gre@truepenalty % - \relax % + \global\let\gre@hskip\kern % + \global\let\gre@penalty\gre@falsepenalty % + \global\xdef\gre@insidediscretionary{\number 1}% + \discretionary{% + \global\gre@lastoflinecount=1\relax % (a good magic trick) + \gre@debugmsg{bolshift}{discretionary pre lastoflinecount: \the\gre@lastoflinecount}% + #2% + }{% + \global\gre@lastoflinecount=2\relax % (a good magic trick) + \gre@debugmsg{bolshift}{discretionary post lastoflinecount: \the\gre@lastoflinecount}% + }{% + \gre@debugmsg{bolshift}{discretionary no lastoflinecount: \the\gre@lastoflinecount}% + #3% + }% + \global\xdef\gre@insidediscretionary{\number 0}% + \global\let\gre@hskip\hskip % + \global\let\gre@penalty\gre@truepenalty % + \relax % }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -132,61 +132,53 @@ \gre@showcleftrue \def\gresetclef#1{% - \IfStrEqCase{#1}{% - {visible}% - {\gre@showcleftrue}% - {invisible}% - {\gre@showcleffalse}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetclef\MessageBreak Possible options are: 'visible' and 'invisible'}% - ]% + \IfStrEqCase{#1}{% + {visible}% + {\gre@showcleftrue}% + {invisible}% + {\gre@showcleffalse}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetclef\MessageBreak Possible options are: 'visible' and 'invisible'}% + ]% }% -\def\greremoveclef{% OBSOLETE - \gre@obsolete{\protect\greremoveclef}{\protect\gresetclef{invisible}}% -}% - -\def\grenormalclef{% OBSOLETE - \gre@obsolete{\protect\grenormalclef}{\protect\gresetclef{visible}}% -}% - %% marcro to define the clef that will appear at the beginning of the lines % the first argument is the type : f or c, and the second is the height % the third argument is whether we must type a space after or not (0 if not, 1 if yes) % if the fourth argument is 3, it means that we must not put a flat after the key, otherwise it's the height of the flat \def\GreSetLinesClef#1#2#3#4#5#6#7{% - \gre@localleftbox{% - \gre@skip@temp@four = \gre@dimen@additionalleftspace\relax% - \kern\gre@skip@temp@four % - \copy\gre@box@lines% draws the lines - \unkern % - \ifgre@showclef% - \gre@skip@temp@four = \gre@space@skip@afterclefnospace\relax% - \hbox{\gre@typeclef{#1}{#2}{0}{#3}{#4}{#5}{#6}{#7}\hskip\gre@skip@temp@four}% - \else % - \gre@skip@temp@four = \gre@space@dimen@noclefspace\relax% - \hbox{\kern\gre@skip@temp@four}% - \fi % - }% - \xdef\gre@clefflatheight{#4}% - \xdef\gre@cleftwoflatheight{#7}% - \relax% + \gre@localleftbox{% + \gre@skip@temp@four = \gre@dimen@additionalleftspace\relax% + \kern\gre@skip@temp@four % + \copy\gre@box@lines% draws the lines + \unkern % + \ifgre@showclef% + \gre@skip@temp@four = \gre@space@skip@afterclefnospace\relax% + \hbox{\gre@typeclef{#1}{#2}{0}{#3}{#4}{#5}{#6}{#7}\hskip\gre@skip@temp@four}% + \else % + \gre@skip@temp@four = \gre@space@dimen@noclefspace\relax% + \hbox{\kern\gre@skip@temp@four}% + \fi % + }% + \xdef\gre@clefflatheight{#4}% + \xdef\gre@cleftwoflatheight{#7}% + \relax% }% \def\gre@save@clef#1#2#3#4#5#6{% - \global\let\gre@clef=#1\relax% - \xdef\gre@clefheight{#2}% - \xdef\gre@clefflatheight{#3}% - \global\let\gre@cleftwo=#4\relax% - \xdef\gre@cleftwoheight{#5}% - \xdef\gre@cleftwoflatheight{#6}% + \global\let\gre@clef=#1\relax% + \xdef\gre@clefheight{#2}% + \xdef\gre@clefflatheight{#3}% + \global\let\gre@cleftwo=#4\relax% + \xdef\gre@cleftwoheight{#5}% + \xdef\gre@cleftwoflatheight{#6}% }% %% macro redrawing a key from clefnum, useful for vertical space changes \def\gre@updatelinesclef{% - \GreSetLinesClef{\gre@clef}{\gre@clefheight}{1}{\gre@clefflatheight}% - {\gre@cleftwo}{\gre@cleftwoheight}{\gre@cleftwoflatheight}\relax % + \GreSetLinesClef{\gre@clef}{\gre@clefheight}{1}{\gre@clefflatheight}% + {\gre@cleftwo}{\gre@cleftwoheight}{\gre@cleftwoflatheight}\relax % }% \newbox\gre@box@temp@clef% @@ -202,35 +194,35 @@ %% #7: the line of the secondary clef (1 is the lowest) %% #8: if 3, it means that we must not put a flat after the secondary clef, otherwise it's the height of the flat \def\gre@typeclef#1#2#3#4#5#6#7#8{% - \setbox\gre@box@temp@width=\hbox{% - \ifcase#7% - \gre@typesingleclef{#1}{#2}{#3}{#5}% - \else % - \ifnum\numexpr (#7 - #2) * (#7 - #2) > 1 \relax % - \setbox\gre@box@temp@clef=\hbox{\gre@typesingleclef{#1}{#2}{#3}{#5}}% - \setbox\gre@box@temp@cleftwo=\hbox{\gre@typesingleclef{#6}{#7}{#3}{#8}}% - \ifdim\wd\gre@box@temp@clef>\wd\gre@box@temp@cleftwo% - \hbox to 0pt{\copy\gre@box@temp@cleftwo}\copy\gre@box@temp@clef% - \else % - \hbox to 0pt{\copy\gre@box@temp@clef}\copy\gre@box@temp@cleftwo% - \fi % - \else % - \gre@typesingleclef{#1}{#2}{#3}{#5}% - \gre@skip@temp@two=\gre@space@skip@clefflatspace\relax% - \gre@hskip\gre@skip@temp@two % - \gre@typesingleclef{#6}{#7}{#3}{#8}% - \fi % - \fi % - }% - \ifcase#3% - \global\gre@dimen@clefwidth=\wd\gre@box@temp@width % - \fi % - \copy\gre@box@temp@width % - \gre@skip@temp@two=\gre@space@skip@spaceafterlineclef\relax% - \ifnum#4=0\relax % - \gre@skip@temp@two=\gre@space@skip@afterclefnospace\relax% - \fi % - \gre@hskip\gre@skip@temp@two % + \setbox\gre@box@temp@width=\hbox{% + \ifcase#7% + \gre@typesingleclef{#1}{#2}{#3}{#5}% + \else % + \ifnum\numexpr (#7 - #2) * (#7 - #2) > 1 \relax % + \setbox\gre@box@temp@clef=\hbox{\gre@typesingleclef{#1}{#2}{#3}{#5}}% + \setbox\gre@box@temp@cleftwo=\hbox{\gre@typesingleclef{#6}{#7}{#3}{#8}}% + \ifdim\wd\gre@box@temp@clef>\wd\gre@box@temp@cleftwo% + \hbox to 0pt{\copy\gre@box@temp@cleftwo}\copy\gre@box@temp@clef% + \else % + \hbox to 0pt{\copy\gre@box@temp@clef}\copy\gre@box@temp@cleftwo% + \fi % + \else % + \gre@typesingleclef{#1}{#2}{#3}{#5}% + \gre@skip@temp@two=\gre@space@skip@clefflatspace\relax% + \gre@hskip\gre@skip@temp@two % + \gre@typesingleclef{#6}{#7}{#3}{#8}% + \fi % + \fi % + }% + \ifcase#3% + \global\gre@dimen@clefwidth=\wd\gre@box@temp@width % + \fi % + \copy\gre@box@temp@width % + \gre@skip@temp@two=\gre@space@skip@spaceafterlineclef\relax% + \ifnum#4=0\relax % + \gre@skip@temp@two=\gre@space@skip@afterclefnospace\relax% + \fi % + \gre@hskip\gre@skip@temp@two % }% % macro that typesets one clef @@ -240,58 +232,58 @@ %% #3: if we must use small key characters (inside a line) or not 0: if not inside, 1 if inside %% #4: if 3, it means that we must not put a flat after the key, otherwise it's the height of the flat \def\gre@typesingleclef#1#2#3#4{% - \ifcase#2 % - \or% - \gre@calculate@glyphraisevalue{\gre@pitch@c}{0}{}% - \or% - \gre@calculate@glyphraisevalue{\gre@pitch@e}{0}{}% - \or% - \gre@calculate@glyphraisevalue{\gre@pitch@g}{0}{}% - \or% - \gre@calculate@glyphraisevalue{\gre@pitch@i}{0}{}% - \or% - \gre@calculate@glyphraisevalue{\gre@pitch@k}{0}{}% - \fi% - \ifx c#1% we check if it is a c key - \ifcase#3% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@cclef}{}{}% - \or% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@incclef}{}{}% - \fi% - \else % we consider that it is a f key - \ifcase#3% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@fclef}{}{}% - \or% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@infclef}{}{}% - \fi% - \fi% - \ifnum#4=3% - \else % - \gre@skip@temp@four = \gre@space@skip@clefflatspace\relax% - \gre@hskip\gre@skip@temp@four % - \GreFlat{#4}{1}{}{}{}% - \fi % - \relax % + \ifcase#2 % + \or% + \gre@calculate@glyphraisevalue{\gre@pitch@c}{0}{}% + \or% + \gre@calculate@glyphraisevalue{\gre@pitch@e}{0}{}% + \or% + \gre@calculate@glyphraisevalue{\gre@pitch@g}{0}{}% + \or% + \gre@calculate@glyphraisevalue{\gre@pitch@i}{0}{}% + \or% + \gre@calculate@glyphraisevalue{\gre@pitch@k}{0}{}% + \fi% + \ifx c#1% we check if it is a c key + \ifcase#3% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@cclef}{}{}% + \or% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@incclef}{}{}% + \fi% + \else % we consider that it is a f key + \ifcase#3% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@fclef}{}{}% + \or% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@infclef}{}{}% + \fi% + \fi% + \ifnum#4=3% + \else % + \gre@skip@temp@four = \gre@space@skip@clefflatspace\relax% + \gre@hskip\gre@skip@temp@four % + \GreFlat{#4}{1}{}{}{}% + \fi % + \relax % }% % macro that writes the initial key, and sets the next keys to the same value % if #3 is 3, it means that we must not put a flat after the key, otherwise it's the height % of the flat \def\GreSetInitialClef#1#2#3#4#5#6{% - \gre@save@clef{#1}{#2}{#3}{#4}{#5}{#6}% - \ifgre@showclef% - \gre@typeclef{#1}{#2}{0}{1}{#3}{#4}{#5}{#6}% - \else% - \gre@skip@temp@four = \gre@space@dimen@noclefspace\relax% - \hbox{\kern\gre@skip@temp@four}% - \fi % - \GreSetLinesClef{#1}{#2}{1}{#3}{#4}{#5}{#6}% - % if the initial is big, then we adjust the second line - \ifnum\gre@biginitial=0\relax % - \else % - \gre@adjustsecondline % - \fi % - \relax% + \gre@save@clef{#1}{#2}{#3}{#4}{#5}{#6}% + \ifgre@showclef% + \gre@typeclef{#1}{#2}{0}{1}{#3}{#4}{#5}{#6}% + \else% + \gre@skip@temp@four = \gre@space@dimen@noclefspace\relax% + \hbox{\kern\gre@skip@temp@four}% + \fi % + \GreSetLinesClef{#1}{#2}{1}{#3}{#4}{#5}{#6}% + % if the initial is big, then we adjust the second line + \ifnum\gre@biginitial=0\relax % + \else % + \gre@adjustsecondline % + \fi % + \relax% }% % macro called when the key changes @@ -300,272 +292,314 @@ % if #4 is 3, it means that we must not put a flat after the key, otherwise it's the height % of the flat \def\GreChangeClef#1#2#3#4#5#6#7{% - % it makes no sense to change the clef when there is no clef... - \gresetclef{visible}% - \gre@save@clef{#1}{#2}{#4}{#5}{#6}{#7}% - \ifnum\gre@insidediscretionary=0\relax % - \GreSetLinesClef{#1}{#2}{1}{#4}{#5}{#6}{#7}% - \fi % - \ifnum#3=1\relax % - \gre@skip@temp@four = \gre@space@skip@clefchangespace\relax% - \gre@hskip\gre@skip@temp@four % - \else % - % here it means that there is a bar before the clef, so we skip the difference between the normal space and the space around bars with clef changes - \gre@skip@temp@four = -\gre@space@skip@spacearoundclefbars\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \gre@typeclef{#1}{#2}{1}{0}{#4}{#5}{#6}{#7}% - \gre@skip@temp@four = \gre@space@skip@clefchangespace\relax% - \gre@hskip\gre@skip@temp@four % - \relax% + % it makes no sense to change the clef when there is no clef... + \gresetclef{visible}% + \gre@save@clef{#1}{#2}{#4}{#5}{#6}{#7}% + \ifnum\gre@insidediscretionary=0\relax % + \GreSetLinesClef{#1}{#2}{1}{#4}{#5}{#6}{#7}% + \fi % + \ifnum#3=1\relax % + \gre@skip@temp@four = \gre@space@skip@clefchangespace\relax% + \gre@hskip\gre@skip@temp@four % + \else % + \ifdim\gre@skip@bar@lastskip=0pt\else % we're after a bar: + % here it means that there is a bar before the clef, so we skip the difference between the normal space and the space around bars with clef changes + \gre@skip@temp@four = -\gre@space@skip@spacearoundclefbars\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \fi % + \GreNoBreak % + \gre@typeclef{#1}{#2}{1}{0}{#4}{#5}{#6}{#7}% + \ifnum\gre@insidediscretionary=0\relax % + \gre@skip@temp@four = \gre@space@skip@clefchangespace\relax% + \else % + \gre@skip@temp@four = \gre@space@skip@interwordspacenotes\relax% + \fi % + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \relax% }% % custos just typesets a custos, useful for before the key changes for example % #1 is the height -% #2 is indicating if the custo ends the line -\def\GreCustos#1{% - \ifdim\gre@skip@bar@lastskip=0pt\else % we're after a bar: - \kern-\gre@skip@bar@lastskip % - \fi % - \gre@skip@temp@four = \gre@space@skip@spacebeforeinlinecustos\relax% - \kern\gre@skip@temp@four% - \gre@calculate@glyphraisevalue{#1}{0}{}% - %here we need some tricks to draw the line before the custos (for the color) - \setbox\gre@box@temp@width=\hbox{\gre@pickcustos{#1}}% - \gre@dimen@temp@three=\wd\gre@box@temp@width % - \ifgre@showlines % - \ifnum#1<\gre@pitch@belowstaff\relax % - \gre@additionalbottomcustoslinemiddle % - \else\ifnum#1>\gre@pitch@abovestaff\relax % - \gre@additionaltopcustoslinemiddle % - \fi\fi % - \fi % - \raise \gre@dimen@glyphraisevalue\relax% - \copy\gre@box@temp@width % - \ifdim\gre@skip@bar@lastskip=0pt\relax % - % for now we consider we always have a bar after the custos - % we don't want to end the line here - \GreNoBreak % - \gre@skip@temp@four = -\gre@space@skip@spacearoundclefbars\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \else % - \GreNoBreak % - \kern\gre@skip@bar@lastskip % - \GreNoBreak % - \fi % - \relax % +\def\GreCustos#1#2{% + \GreNoBreak % + \ifdim\gre@skip@bar@lastskip=0pt\else % we're after a bar: + \kern-\gre@skip@bar@lastskip % + \GreNoBreak % + \fi % + \ifgre@firstglyph% we check if it is the first glyph + \global\gre@firstglyphfalse% + \ifnum\gre@insidediscretionary=0\else % + \gre@skip@temp@four=\gre@space@skip@interwordspacenotes % + \kern\gre@skip@temp@four% + \GreNoBreak % + \fi % + \else% + \ifgre@endofscore % + \gre@skip@temp@four=\gre@space@skip@spacebeforeeolcustos % + \else % + \gre@skip@temp@four=\gre@space@skip@spacebeforeinlinecustos % + \fi % + \kern\gre@skip@temp@four% + \GreNoBreak % + \fi % + \gre@custosalteration{#1}{#2}% + \GreNoBreak% + \gre@calculate@glyphraisevalue{#1}{0}{}% + %here we need some tricks to draw the line before the custos (for the color) + \setbox\gre@box@temp@width=\hbox{\gre@pickcustos{#1}{1}}% + \gre@dimen@temp@three=\wd\gre@box@temp@width % + \ifgre@showlines % + \ifnum#1<\gre@pitch@belowstaff\relax % + \gre@additionalbottomcustoslinemiddle % + \else\ifnum#1>\gre@pitch@abovestaff\relax % + \gre@additionaltopcustoslinemiddle % + \fi\fi % + \fi % + \raise \gre@dimen@glyphraisevalue\relax% + \copy\gre@box@temp@width % + \ifdim\gre@skip@bar@lastskip=0pt\relax % + % for now we consider we always have a bar after the custos + % we don't want to end the line here + \GreNoBreak % + \gre@skip@temp@four = -\gre@space@skip@spacearoundclefbars\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \else % + \GreNoBreak % + \kern\gre@skip@bar@lastskip % + \GreNoBreak % + \fi % + \directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% + \relax % }% % typesets a custos for the end of the score -\def\GreFinalCustos#1{% - \GreNoBreak% - \gre@dimen@temp@four = \glueexpr(\gre@space@skip@spacebeforeeolcustos)\relax% - \kern\gre@dimen@temp@four % - \GreNoBreak% - \GreCustos{#1}% - \gre@endofglyphcommon % +\def\GreFinalCustos#1#2{% + \GreNoBreak% + \GreCustos{#1}{#2}% + \gre@endofglyphcommon % } % the argument is the height -\edef\gre@nextcustos{\gre@pitch@dummy}% -\def\GreNextCustos#1{% - \gre@debugmsg{custos}{nextcustos = #1}% - \ifnum\gre@insidediscretionary=0\relax % - \gre@debugmsg{custos}{not discretionary}% - \edef\gre@nextcustos{#1}% - \ifgre@blockeolcustos\else% - \gre@debugmsg{custos}{not blocked}% - \gre@calculate@glyphraisevalue{#1}{0}{}% - %here we need some tricks to draw the line before the custos (for the color) - \setbox\gre@box@temp@width=\hbox{% - % we type a hskip and the we type the custos - \gre@hskip\gre@space@skip@spacebeforeeolcustos\relax % - \gre@pickcustos{#1}\relax % - }% - \gre@dimen@temp@three=\wd\gre@box@temp@width % - % we make \wd\gre@box@temp@sign contain the width of a custos - \setbox\gre@box@temp@sign=\hbox{% - \gre@pickcustos{#1}\relax % - }% - \gre@localrightbox{% - \ifgre@showlines % - \ifnum#1<\gre@pitch@belowstaff\relax % - \gre@additionalbottomcustoslineend % - \else\ifnum#1>\gre@pitch@abovestaff\relax % - \gre@additionaltopcustoslineend % - \fi\fi % - \fi % - \raise \gre@dimen@glyphraisevalue\relax% - \copy\gre@box@temp@width % - }% - \fi % - \fi % - \relax% +\edef\gre@nextcustospitch{\gre@pitch@dummy}% +\edef\gre@nextcustosalteration{}% +\def\GreNextCustos#1#2{% + \gre@debugmsg{custos}{nextcustos = #1,#2}% + \ifnum\gre@insidediscretionary=0\relax % + \gre@debugmsg{custos}{not discretionary}% + \edef\gre@nextcustospitch{#1}% + \edef\gre@nextcustosalteration{#2}% + \ifgre@blockeolcustos\else% + \gre@debugmsg{custos}{not blocked}% + \gre@calculate@glyphraisevalue{#1}{0}{}% + %here we need some tricks to draw the line before the custos (for the color) + \setbox\gre@box@temp@width=\hbox{% + % we type a hskip and the we type the custos + \gre@hskip\gre@space@skip@spacebeforeeolcustos\relax % + \gre@custosalteration{#1}{#2}% + \GreNoBreak% + \raise \gre@dimen@glyphraisevalue\relax% + \hbox{% + \gre@pickcustos{#1}{2}\relax % + }% + }% + \gre@dimen@temp@three=\wd\gre@box@temp@width % + % we make \wd\gre@box@temp@sign contain the width of a custos + \setbox\gre@box@temp@sign=\hbox{% + \gre@custosalteration{#1}{#2}% + \GreNoBreak% + \gre@pickcustos{#1}{0}\relax % + }% + \gre@localrightbox{% + \ifgre@showlines % + \ifnum#1<\gre@pitch@belowstaff\relax % + \gre@additionalbottomcustoslineend % + \else\ifnum#1>\gre@pitch@abovestaff\relax % + \gre@additionaltopcustoslineend % + \fi\fi % + \fi % + \copy\gre@box@temp@width % + }% + \fi % + \fi % + \relax% }% % macro that typesets an additional line at the top for custos at end of line \def\gre@additionaltopcustoslineend{% - \gre@dimen@temp@five=\dimexpr(\gre@dimen@staffheight % - + \gre@space@dimen@spacebeneathtext % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@interstafflinespace % - + \gre@dimen@additionalbottomspace % - + \gre@dimen@currenttranslationheight)\relax % - \raise\gre@dimen@temp@five % - \hbox to 0pt{% - \gre@style@additionalstafflines % - \ifx\gre@empty@additionalstafflinesformat\greadditionalstafflinesformat% OBSOLETE - \else % OBSOLETE - \gre@obsolete{\protect\greadditionalstafflinesformat}{\protect\grechangestyle{additionalstafflinesformat}}% OBSOLETE - \fi% OBSOLETE - \kern\gre@dimen@temp@three % - \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@sign + \gre@space@dimen@additionalcustoslineswidth)\relax% - \kern-\gre@dimen@temp@five % - \vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% - \hss % - \endgre@style@additionalstafflines% - }% - \relax % + \gre@dimen@temp@five=\dimexpr(\gre@dimen@staffheight % + + \gre@space@dimen@spacebeneathtext % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@interstafflinespace % + + \gre@dimen@additionalbottomspace % + + \gre@dimen@currenttranslationheight)\relax % + \raise\gre@dimen@temp@five % + \hbox to 0pt{% + \gre@style@additionalstafflines % + \kern\gre@dimen@temp@three % + \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@sign + \gre@space@dimen@additionalcustoslineswidth)\relax% + \kern-\gre@dimen@temp@five % + \vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% + \hss % + \endgre@style@additionalstafflines% + }% + \relax % }% \def\gre@additionalbottomcustoslineend{% - \gre@dimen@temp@five=\dimexpr(\gre@space@dimen@spacebeneathtext % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@additionalbottomspace % - + \gre@dimen@currenttranslationheight % - - \gre@dimen@interstafflinespace % - - \gre@dimen@stafflineheight)\relax % - \raise\gre@dimen@temp@five % - \hbox to 0pt{% - \gre@style@additionalstafflines % - \ifx\gre@empty@additionalstafflinesformat\greadditionalstafflinesformat% OBSOLETE - \else % OBSOLETE - \gre@obsolete{\protect\greadditionalstafflinesformat}{\protect\grechangestyle{additionalstafflinesformat}}% OBSOLETE - \fi% OBSOLETE - \kern\gre@dimen@temp@three % - \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@sign+\gre@space@dimen@additionalcustoslineswidth)\relax% - \kern-\gre@dimen@temp@five % - \vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% - \hss % - \endgre@style@additionalstafflines% - }% - \relax % + \gre@dimen@temp@five=\dimexpr(\gre@space@dimen@spacebeneathtext % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@additionalbottomspace % + + \gre@dimen@currenttranslationheight % + - \gre@dimen@interstafflinespace % + - \gre@dimen@stafflineheight)\relax % + \raise\gre@dimen@temp@five % + \hbox to 0pt{% + \gre@style@additionalstafflines % + \kern\gre@dimen@temp@three % + \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@sign+\gre@space@dimen@additionalcustoslineswidth)\relax% + \kern-\gre@dimen@temp@five % + \vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% + \hss % + \endgre@style@additionalstafflines% + }% + \relax % }% % same macros, but for a custos in the middle \def\gre@additionaltopcustoslinemiddle{% - \gre@dimen@temp@five=\dimexpr(\gre@dimen@staffheight % - + \gre@space@dimen@spacebeneathtext % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@interstafflinespace % - + \gre@dimen@additionalbottomspace % - + \gre@dimen@currenttranslationheight)\relax% - \raise\gre@dimen@temp@five % - \hbox to 0pt{% - \gre@style@additionalstafflines % - \ifx\gre@empty@additionalstafflinesformat\greadditionalstafflinesformat% OBSOLETE - \else % OBSOLETE - \gre@obsolete{\protect\greadditionalstafflinesformat}{\protect\grechangestyle{additionalstafflinesformat}}% OBSOLETE - \fi% OBSOLETE - \hss % - \kern\gre@dimen@temp@three % - \gre@dimen@temp@five=\dimexpr((\gre@space@dimen@additionalcustoslineswidth*2)+\wd\gre@box@temp@sign)\relax % - \vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% - \hss % - \endgre@style@additionalstafflines% - }% - \relax % + \gre@dimen@temp@five=\dimexpr(\gre@dimen@staffheight % + + \gre@space@dimen@spacebeneathtext % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@interstafflinespace % + + \gre@dimen@additionalbottomspace % + + \gre@dimen@currenttranslationheight)\relax% + \raise\gre@dimen@temp@five % + \hbox to 0pt{% + \gre@style@additionalstafflines % + \hss % + \kern\gre@dimen@temp@three % + \gre@dimen@temp@five=\dimexpr((\gre@space@dimen@additionalcustoslineswidth*2)+\wd\gre@box@temp@sign)\relax % + \vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% + \hss % + \endgre@style@additionalstafflines% + }% + \relax % }% \def\gre@additionalbottomcustoslinemiddle{% - \gre@dimen@temp@five=\dimexpr(\gre@space@dimen@spacebeneathtext % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@additionalbottomspace % - + \gre@dimen@currenttranslationheight % - - \gre@dimen@interstafflinespace % - - \gre@dimen@stafflineheight)\relax% - \raise\gre@dimen@temp@five % - \hbox to 0pt{% - \gre@style@additionalstafflines % - \ifx\gre@empty@additionalstafflinesformat\greadditionalstafflinesformat% OBSOLETE - \else % OBSOLETE - \gre@obsolete{\protect\greadditionalstafflinesformat}{\protect\grechangestyle{additionalstafflinesformat}}% OBSOLETE - \fi% OBSOLETE - \hss % - \kern\gre@dimen@temp@three % - \gre@dimen@temp@five=\dimexpr((\gre@space@dimen@additionalcustoslineswidth*2)+\wd\gre@box@temp@sign)\relax % - \vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% - \hss % - \endgre@style@additionalstafflines% - }% - \relax % -}% - -\def\gre@pickcustos#1{% - \ifcase#1% - \or\or% - \or\gre@fontchar@custostopmiddle % - \or\gre@fontchar@custostoplong % - \or\gre@fontchar@custostopshort % - \or\gre@fontchar@custostoplong % - \or\gre@fontchar@custostopshort % - \or % - \ifgre@haslinethree % - \gre@fontchar@custostoplong % - \else % - \gre@fontchar@custosbottomlong % - \fi % - \or % - \ifgre@haslinethree % - \gre@fontchar@custostopshort % - \else % - \gre@fontchar@custosbottomshort % - \fi % - \or % - \ifgre@haslinefour % - \gre@fontchar@custostoplong % - \else % - \gre@fontchar@custosbottomlong % - \fi % - \or % - \ifgre@haslinefour % - \gre@fontchar@custostopshort % - \else % - \ifgre@haslinethree % - \gre@fontchar@custosbottomshort % - \else % - \gre@fontchar@custosbottommiddle % - \fi % - \fi % - \or % - \ifgre@haslinefive % - \gre@fontchar@custostoplong % - \else % - \gre@fontchar@custosbottomlong % - \fi % - \or % - \ifgre@haslinefive % - \gre@fontchar@custostopshort % - \else % - \ifgre@haslinefour % - \gre@fontchar@custosbottomshort % - \else % - \gre@fontchar@custosbottommiddle % - \fi % - \fi % - \or\gre@fontchar@custosbottomlong % - \or % - \ifgre@haslinefive % - \gre@fontchar@custosbottomshort % - \else % - \gre@fontchar@custosbottommiddle % - \fi % - \or\gre@fontchar@custosbottomlong % - \or\gre@fontchar@custosbottommiddle % - \fi% + \gre@dimen@temp@five=\dimexpr(\gre@space@dimen@spacebeneathtext % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@additionalbottomspace % + + \gre@dimen@currenttranslationheight % + - \gre@dimen@interstafflinespace % + - \gre@dimen@stafflineheight)\relax% + \raise\gre@dimen@temp@five % + \hbox to 0pt{% + \gre@style@additionalstafflines % + \hss % + \kern\gre@dimen@temp@three % + \gre@dimen@temp@five=\dimexpr((\gre@space@dimen@additionalcustoslineswidth*2)+\wd\gre@box@temp@sign)\relax % + \vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% + \hss % + \endgre@style@additionalstafflines% + }% + \relax % +}% + +\newif\ifgre@usecustosalteration% +\gre@usecustosalterationtrue% +\def\gresetcustosalteration#1{% + \IfStrEqCase{#1}{% + {visible}{\gre@usecustosalterationtrue}% + {invisible}{\gre@usecustosalterationfalse}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetcustosalteration\MessageBreak Possible options are: 'visible' and 'invisible'}% + ]% +}% +\def\gre@custosalteration#1#2{% + \ifgre@usecustosalteration % + \IfStrEq{#2}{}{}{\csname Gre#2\endcsname{#1}{0}{}{}{}}% + \fi % +}% + +% #2 is 0 for measurement only, 1 in the normal case, 2 for the right box +\def\gre@pickcustos#1#2{% + % set attributes to adjust the line height for the pitch of the custos + \ifcase#2% 0 + \or % 1 + \global\advance\gre@attr@glyph@id by 1\relax % + \GreGlyphHeights{#1}{#1}% + \or % 2 + \ifgre@eolshiftsenabled % + \GreGlyphHeights{#1}{#1}% + \fi % + \fi % + \ifcase#1% + \or\or% + \or\gre@fontchar@custostopmiddle % + \or\gre@fontchar@custostoplong % + \or\gre@fontchar@custostopshort % + \or\gre@fontchar@custostoplong % + \or\gre@fontchar@custostopshort % + \or % + \ifgre@haslinethree % + \gre@fontchar@custostoplong % + \else % + \gre@fontchar@custosbottomlong % + \fi % + \or % + \ifgre@haslinethree % + \gre@fontchar@custostopshort % + \else % + \gre@fontchar@custosbottomshort % + \fi % + \or % + \ifgre@haslinefour % + \gre@fontchar@custostoplong % + \else % + \gre@fontchar@custosbottomlong % + \fi % + \or % + \ifgre@haslinefour % + \gre@fontchar@custostopshort % + \else % + \ifgre@haslinethree % + \gre@fontchar@custosbottomshort % + \else % + \gre@fontchar@custosbottommiddle % + \fi % + \fi % + \or % + \ifgre@haslinefive % + \gre@fontchar@custostoplong % + \else % + \gre@fontchar@custosbottomlong % + \fi % + \or % + \ifgre@haslinefive % + \gre@fontchar@custostopshort % + \else % + \ifgre@haslinefour % + \gre@fontchar@custosbottomshort % + \else % + \gre@fontchar@custosbottommiddle % + \fi % + \fi % + \or\gre@fontchar@custosbottomlong % + \or % + \ifgre@haslinefive % + \gre@fontchar@custosbottomshort % + \else % + \gre@fontchar@custosbottommiddle % + \fi % + \or\gre@fontchar@custosbottomlong % + \or\gre@fontchar@custosbottommiddle % + \fi% }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -577,27 +611,27 @@ \newif\ifgre@metapost@curlybrace\gre@metapost@curlybracetrue % \newif\ifgre@metapost@barbrace\gre@metapost@barbracetrue % \def\gresetbracerendering{% - \@ifnextchar[{\gre@setbracerendering}{\gre@setallbracerendering}% + \@ifnextchar[{\gre@setbracerendering}{\gre@setallbracerendering}% }% \def\gre@setallbracerendering#1{% - \gre@@setbracerendering{brace}{#1}% - \gre@@setbracerendering{underbrace}{#1}% - \gre@@setbracerendering{curlybrace}{#1}% - \gre@@setbracerendering{barbrace}{#1}% + \gre@@setbracerendering{brace}{#1}% + \gre@@setbracerendering{underbrace}{#1}% + \gre@@setbracerendering{curlybrace}{#1}% + \gre@@setbracerendering{barbrace}{#1}% }% \def\gre@setbracerendering[#1]#2{% - \IfStrEqCase{#1}{% - {brace}{\gre@@setbracerendering{#1}{#2}}% - {underbrace}{\gre@@setbracerendering{#1}{#2}}% - {curlybrace}{\gre@@setbracerendering{#1}{#2}}% - {barbrace}{\gre@@setbracerendering{#1}{#2}}% - }[\gre@error{Unrecognized option "#1" for \protect\gresetbracerendering\MessageBreak Possible options are: 'brace', 'underbrace', 'curlybrace', and 'barbrace'}]% + \IfStrEqCase{#1}{% + {brace}{\gre@@setbracerendering{#1}{#2}}% + {underbrace}{\gre@@setbracerendering{#1}{#2}}% + {curlybrace}{\gre@@setbracerendering{#1}{#2}}% + {barbrace}{\gre@@setbracerendering{#1}{#2}}% + }[\gre@error{Unrecognized option "#1" for \protect\gresetbracerendering\MessageBreak Possible options are: 'brace', 'underbrace', 'curlybrace', and 'barbrace'}]% }% \def\gre@@setbracerendering#1#2{% - \IfStrEqCase{#2}{% - {font}{\csname gre@metapost@#1false\endcsname}% - {metapost}{\csname gre@metapost@#1true\endcsname}% - }[\gre@error{Unrecognized option "#2" for \protect\gresetbracerendering\MessageBreak Possible options are: 'font' and 'metapost'}]% + \IfStrEqCase{#2}{% + {font}{\csname gre@metapost@#1false\endcsname}% + {metapost}{\csname gre@metapost@#1true\endcsname}% + }[\gre@error{Unrecognized option "#2" for \protect\gresetbracerendering\MessageBreak Possible options are: 'font' and 'metapost'}]% }% \gdef\gre@fontchar@curlybrace{\gre@font@music\GreCPCurlyBrace}% @@ -613,9 +647,9 @@ % #4: 1 if we shift to the beginning of the last glyph, 0 otherwise % #5: 1 if we put an accentus above or not \def\GreOverCurlyBrace#1#2#3#4#5{% - \ifgre@boxing\else % - \gre@brace@common{#1}{#2}{#3}{#4}{#5}{\gre@pitch@overbraceglyph}{\gre@fontchar@curlybrace}% - \fi % + \ifgre@boxing\else % + \gre@brace@common{#1}{#2}{#3}{#4}{#5}{\gre@pitch@overbraceglyph}{\gre@fontchar@curlybrace}% + \fi % }% % #1: the width @@ -623,9 +657,9 @@ % #3: a horizontal shift % #4: 1 if we shift to the beginning of the last glyph, 0 otherwise \def\GreOverBrace#1#2#3#4{% - \ifgre@boxing\else % - \gre@brace@common{#1}{#2}{#3}{#4}{0}{\gre@pitch@overbraceglyph}{\gre@fontchar@brace}% - \fi % + \ifgre@boxing\else % + \gre@brace@common{#1}{#2}{#3}{#4}{0}{\gre@pitch@overbraceglyph}{\gre@fontchar@brace}% + \fi % }% % #1: the width @@ -633,9 +667,9 @@ % #3: a horizontal shift % #4: 1 if we shift to the beginning of the last glyph, 0 otherwise \def\GreUnderBrace#1#2#3#4{% - \ifgre@boxing\else % - \gre@brace@common{#1}{#2}{#3}{#4}{0}{\gre@pitch@underbrace}{\gre@fontchar@underbrace}% - \fi % + \ifgre@boxing\else % + \gre@brace@common{#1}{#2}{#3}{#4}{0}{\gre@pitch@underbrace}{\gre@fontchar@underbrace}% + \fi % }% % #1: the width @@ -646,222 +680,222 @@ % #6: the pitch at which to compute the height % #7: the brace character \def\gre@brace@common#1#2#3#4#5#6#7{% - \ifnum#4=1\relax % - \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% - \gre@dimen@temp@five=\wd\gre@box@temp@sign % - \kern-\gre@dimen@temp@five % - \fi % - \gre@calculate@glyphraisevalue{#6}{13}{}% - \advance\gre@dimen@glyphraisevalue by #2\relax % - \hbox to 0pt{% - \gre@skip@temp@four = #3\relax % - \kern\gre@skip@temp@four % - \raise\gre@dimen@glyphraisevalue\hbox{% - \ifx#7\gre@fontchar@curlybrace % - \ifgre@metapost@curlybrace % - \gre@draw@curlybrace{#1}% - \else % - \gre@draw@fontbrace{#1}{#7}% - \fi % - \else % - \ifx#7\gre@fontchar@brace % - \ifgre@metapost@brace % - \gre@draw@brace{#1}% - \else % - \gre@draw@fontbrace{#1}{#7}% - \fi % - \else % - \ifx#7\gre@fontchar@underbrace % - \ifgre@metapost@underbrace % - \gre@draw@underbrace{#1}% - \else % - \gre@draw@fontbrace{#1}{#7}% - \fi % - \fi % - \fi % - \fi % - }% - \hss % - \ifnum#5=1\relax % - \gre@calculate@glyphraisevalue{\gre@pitch@overbrace}{13}{}% - \advance\gre@dimen@glyphraisevalue by \gre@space@dimen@curlybraceaccentusshift\relax% - \raise\gre@dimen@glyphraisevalue\hbox{% - \gre@font@music\GreCPAccentus\relax % - }% - \hss % - \fi % - }% - \ifnum#4=1\relax % - \kern\gre@dimen@temp@five % - \fi % - \relax % + \ifnum#4=1\relax % + \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% + \gre@dimen@temp@five=\wd\gre@box@temp@sign % + \kern-\gre@dimen@temp@five % + \fi % + \gre@calculate@glyphraisevalue{#6}{13}{}% + \advance\gre@dimen@glyphraisevalue by #2\relax % + \hbox to 0pt{% + \gre@skip@temp@four = #3\relax % + \kern\gre@skip@temp@four % + \raise\gre@dimen@glyphraisevalue\hbox{% + \ifx#7\gre@fontchar@curlybrace % + \ifgre@metapost@curlybrace % + \gre@draw@curlybrace{#1}% + \else % + \gre@draw@fontbrace{#1}{#7}% + \fi % + \else % + \ifx#7\gre@fontchar@brace % + \ifgre@metapost@brace % + \gre@draw@brace{#1}% + \else % + \gre@draw@fontbrace{#1}{#7}% + \fi % + \else % + \ifx#7\gre@fontchar@underbrace % + \ifgre@metapost@underbrace % + \gre@draw@underbrace{#1}% + \else % + \gre@draw@fontbrace{#1}{#7}% + \fi % + \fi % + \fi % + \fi % + }% + \hss % + \ifnum#5=1\relax % + \gre@calculate@glyphraisevalue{\gre@pitch@overbrace}{13}{}% + \advance\gre@dimen@glyphraisevalue by \gre@space@dimen@curlybraceaccentusshift\relax% + \raise\gre@dimen@glyphraisevalue\hbox{% + \gre@font@music\GreCPAccentus\relax % + }% + \hss % + \fi % + }% + \ifnum#4=1\relax % + \kern\gre@dimen@temp@five % + \fi % + \relax % }% % #1 : the width % #2 : the brace character \def\gre@draw@fontbrace#1#2{% - \setbox\gre@box@temp@sign=\hbox{#2}% - \gre@resizebox{#1}{\ht\gre@box@temp@sign}{#2}% + \setbox\gre@box@temp@sign=\hbox{#2}% + \gre@resizebox{#1}{\ht\gre@box@temp@sign}{#2}% }% % #1: the width, or * for the bar brace width % this can't have @ in the name because of the metapost catcode settings \def\grebracemetapostpreamble#1{% - % multiplier to convert gre@factor to em-size in bp - % (100000 sp) * (72 bp/in) / (65536 sp/pt) / 72.27 (pt/in) - factor = 1.5201782378; - scale = \the\gre@factor * factor; - % assuming #1 is in bp, we convert it back into the internal unit of the - % calculation, ems - width = \directlua{gregoriotex.width_to_bp([[#1]], "\grebarbracewidth * scale")} / scale; + % multiplier to convert gre@factor to em-size in bp + % (100000 sp) * (72 bp/in) / (65536 sp/pt) / 72.27 (pt/in) + factor = 1.5201782378; + scale = \the\gre@factor * factor; + % assuming #1 is in bp, we convert it back into the internal unit of the + % calculation, ems + width = \directlua{gregoriotex.width_to_bp([[#1]], "\grebarbracewidth * scale")} / scale; }% % #1: the width \def\gre@draw@curlybrace#1{% - \gre@debugmsg{general}{curly brace width = #1}% - \gre@metapost{ - \grebracemetapostpreamble{#1} - transform t; - t = identity scaled scale; - p := (width - 0.1416) / 2; - q := (width - 0.08626) / 2; - if (p < 0.1005) or (q < 0.12817): - t := t xscaled (width / 0.34261); - p := 0.1005; - q := 0.12817; - fi; - f := 1 + (p / 4); - beginfig(0); - fill - ( (0,0) - -- (0.00651,0) - .. controls (((0.03239**f)*p)+0.00651,0.01763) and (((0.08502**f)*p)+0.00651,0.03065) .. (((0.15789**f)*p)+0.00651,0.03906) - .. controls (((0.23347**f)*p)+0.00651,0.04801) and (((0.32659**f)*p)+0.00651,0.05249) .. (((0.43725**f)*p)+0.00651,0.05249) - .. controls (((0.49663**f)*p)+0.00651,0.05249) and (((0.59109**f)*p)+0.00651,0.05086) .. (((0.72065**f)*p)+0.00651,0.04761) - .. controls (((0.82861**f)*p)+0.00651,0.04408) and (((0.92173**f)*p)+0.00651,0.04232) .. (p+0.00651,0.04232) - .. controls (p+0.0198,0.04232) and (p+0.03242,0.04842) .. (p+0.04435,0.06063) - .. controls (p+0.05602,0.07365) and (p+0.06483,0.0906) .. (p+0.0708,0.11149) - .. controls (p+0.07677,0.0906) and (p+0.08558,0.07365) .. (p+0.09725,0.06063) - .. controls (p+0.10918,0.04842) and (p+0.1218,0.04232) .. (p+0.13509,0.04232) - .. controls (p+((1-(0.92173**f))*p)+0.13509,0.04232) and (p+((1-(0.82861**f))*p)+0.13509,0.04408) .. (p+((1-(0.72065**f))*p)+0.13509,0.04761) - .. controls (p+((1-(0.59109**f))*p)+0.13509,0.05086) and (p+((1-(0.49663**f))*p)+0.13509,0.05249) .. (p+((1-(0.43725**f))*p)+0.13509,0.05249) - .. controls (p+((1-(0.32659**f))*p)+0.13509,0.05249) and (p+((1-(0.23347**f))*p)+0.13509,0.04801) .. (p+((1-(0.15789**f))*p)+0.13509,0.03906) - .. controls (p+((1-(0.08502**f))*p)+0.13509,0.03065) and (p+((1-(0.03239**f))*p)+0.13509,0.01763) .. (p+p+0.13509,0) - -- (p+p+0.13509,0) -- (q+q+0.08626,0) -- (q+q+0.08626,0) - .. controls (q+((1-(0.02117**f))*q)+0.08626,0.02658) and (q+((1-(0.08466**f))*q)+0.08626,0.04774) .. (q+((1-(0.19048**f))*q)+0.08626,0.06348) - .. controls (q+((1-(0.29418**f))*q)+0.08626,0.07975) and (q+((1-(0.42434**f))*q)+0.08626,0.08789) .. (q+((1-(0.58095**f))*q)+0.08626,0.08789) - .. controls (q+((1-(0.63386**f))*q)+0.08626,0.08789) and (q+((1-(0.70159**f))*q)+0.08626,0.08626) .. (q+((1-(0.78413**f))*q)+0.08626,0.08301) - .. controls (q+((1-(0.87937**f))*q)+0.08626,0.07894) and (q+((1-(0.95132**f))*q)+0.08626,0.0769) .. (q+0.08626,0.0769) - .. controls (q+0.06219,0.0769) and (q+0.05013,0.10644) .. (q+0.04679,0.13102) - -- (q+0.04679,0.13102) -- (q+0.03947,0.13102) -- (q+0.03947,0.13102) - .. controls (q+0.03614,0.10644) and (q+0.02407,0.0769) .. (q+0,0.0769) - .. controls (((0.95132**f)*q)+0,0.0769) and (((0.87937**f)*q)+0,0.07894) .. (((0.78413**f)*q)+0,0.08301) - .. controls (((0.70159**f)*q)+0,0.08626) and (((0.63386**f)*q)+0,0.08789) .. (((0.58095**f)*q)+0,0.08789) - .. controls (((0.42434**f)*q)+0,0.08789) and (((0.29418**f)*q)+0,0.07975) .. (((0.19048**f)*q)+0,0.06348) - .. controls (((0.08466**f)*q)+0,0.04774) and (((0.02117**f)*q)+0,0.02658) .. (0,0) - -- cycle - ) transformed t; - setbounds currentpicture to - ( (0,-0.67980) -- (q+q+0.08626,-0.67980) -- (q+q+0.08626,0.13102) -- (0,0.13102) -- cycle ) - transformed t; - endfig; - }% + \gre@debugmsg{general}{curly brace width = #1}% + \gre@metapost{ + \grebracemetapostpreamble{#1} + transform t; + t = identity scaled scale; + p := (width - 0.1416) / 2; + q := (width - 0.08626) / 2; + if (p < 0.1005) or (q < 0.12817): + t := t xscaled (width / 0.34261); + p := 0.1005; + q := 0.12817; + fi; + f := 1 + (p / 4); + beginfig(0); + fill + ( (0,0) + -- (0.00651,0) + .. controls (((0.03239**f)*p)+0.00651,0.01763) and (((0.08502**f)*p)+0.00651,0.03065) .. (((0.15789**f)*p)+0.00651,0.03906) + .. controls (((0.23347**f)*p)+0.00651,0.04801) and (((0.32659**f)*p)+0.00651,0.05249) .. (((0.43725**f)*p)+0.00651,0.05249) + .. controls (((0.49663**f)*p)+0.00651,0.05249) and (((0.59109**f)*p)+0.00651,0.05086) .. (((0.72065**f)*p)+0.00651,0.04761) + .. controls (((0.82861**f)*p)+0.00651,0.04408) and (((0.92173**f)*p)+0.00651,0.04232) .. (p+0.00651,0.04232) + .. controls (p+0.0198,0.04232) and (p+0.03242,0.04842) .. (p+0.04435,0.06063) + .. controls (p+0.05602,0.07365) and (p+0.06483,0.0906) .. (p+0.0708,0.11149) + .. controls (p+0.07677,0.0906) and (p+0.08558,0.07365) .. (p+0.09725,0.06063) + .. controls (p+0.10918,0.04842) and (p+0.1218,0.04232) .. (p+0.13509,0.04232) + .. controls (p+((1-(0.92173**f))*p)+0.13509,0.04232) and (p+((1-(0.82861**f))*p)+0.13509,0.04408) .. (p+((1-(0.72065**f))*p)+0.13509,0.04761) + .. controls (p+((1-(0.59109**f))*p)+0.13509,0.05086) and (p+((1-(0.49663**f))*p)+0.13509,0.05249) .. (p+((1-(0.43725**f))*p)+0.13509,0.05249) + .. controls (p+((1-(0.32659**f))*p)+0.13509,0.05249) and (p+((1-(0.23347**f))*p)+0.13509,0.04801) .. (p+((1-(0.15789**f))*p)+0.13509,0.03906) + .. controls (p+((1-(0.08502**f))*p)+0.13509,0.03065) and (p+((1-(0.03239**f))*p)+0.13509,0.01763) .. (p+p+0.13509,0) + -- (p+p+0.13509,0) -- (q+q+0.08626,0) -- (q+q+0.08626,0) + .. controls (q+((1-(0.02117**f))*q)+0.08626,0.02658) and (q+((1-(0.08466**f))*q)+0.08626,0.04774) .. (q+((1-(0.19048**f))*q)+0.08626,0.06348) + .. controls (q+((1-(0.29418**f))*q)+0.08626,0.07975) and (q+((1-(0.42434**f))*q)+0.08626,0.08789) .. (q+((1-(0.58095**f))*q)+0.08626,0.08789) + .. controls (q+((1-(0.63386**f))*q)+0.08626,0.08789) and (q+((1-(0.70159**f))*q)+0.08626,0.08626) .. (q+((1-(0.78413**f))*q)+0.08626,0.08301) + .. controls (q+((1-(0.87937**f))*q)+0.08626,0.07894) and (q+((1-(0.95132**f))*q)+0.08626,0.0769) .. (q+0.08626,0.0769) + .. controls (q+0.06219,0.0769) and (q+0.05013,0.10644) .. (q+0.04679,0.13102) + -- (q+0.04679,0.13102) -- (q+0.03947,0.13102) -- (q+0.03947,0.13102) + .. controls (q+0.03614,0.10644) and (q+0.02407,0.0769) .. (q+0,0.0769) + .. controls (((0.95132**f)*q)+0,0.0769) and (((0.87937**f)*q)+0,0.07894) .. (((0.78413**f)*q)+0,0.08301) + .. controls (((0.70159**f)*q)+0,0.08626) and (((0.63386**f)*q)+0,0.08789) .. (((0.58095**f)*q)+0,0.08789) + .. controls (((0.42434**f)*q)+0,0.08789) and (((0.29418**f)*q)+0,0.07975) .. (((0.19048**f)*q)+0,0.06348) + .. controls (((0.08466**f)*q)+0,0.04774) and (((0.02117**f)*q)+0,0.02658) .. (0,0) + -- cycle + ) transformed t; + setbounds currentpicture to + ( (0,-0.67980) -- (q+q+0.08626,-0.67980) -- (q+q+0.08626,0.13102) -- (0,0.13102) -- cycle ) + transformed t; + endfig; + }% }% % #1: the width \def\gre@draw@brace#1{% - \gre@draw@roundbrace{#1}{.89500}{ - (-.00192,.70347) % start the top - .. controls (-.00192,.70525) and (-.00134,.70740) - .. (.00000,.71000) -- (.00000,.71000){curl c} - .. (p/2,.89500) % top of the center - .. {curl c}(p,.71000) -- (p,.71000) - .. controls (p+.00134,.70740) and (p+.00192,.70525) - .. (p+.00192,.70347) % end the top - .. controls (p+.00192,.69508) and (p-.01103,.69500) - .. (p-.01856,.69500) % start the bottom - .. controls (p-.01856,.69500) and (p-.01900,.69500) - .. (p-.01900,.69500) -- (p-.01900,.69500){curl c} - .. (p/2,.86400) % bottom of the center - .. {curl c}(.01900,.69500) -- (.01900,.69500) - .. controls (.01900,.69500) and (.01856,.69500) - .. (.01856,.69500) % end the bottom - .. controls (.01103,.69500) and (-.00192,.69508) - .. (-.00192,.70347) -- cycle - }% + \gre@draw@roundbrace{#1}{.89500}{ + (-.00192,.70347) % start the top + .. controls (-.00192,.70525) and (-.00134,.70740) + .. (.00000,.71000) -- (.00000,.71000){curl c} + .. (p/2,.89500) % top of the center + .. {curl c}(p,.71000) -- (p,.71000) + .. controls (p+.00134,.70740) and (p+.00192,.70525) + .. (p+.00192,.70347) % end the top + .. controls (p+.00192,.69508) and (p-.01103,.69500) + .. (p-.01856,.69500) % start the bottom + .. controls (p-.01856,.69500) and (p-.01900,.69500) + .. (p-.01900,.69500) -- (p-.01900,.69500){curl c} + .. (p/2,.86400) % bottom of the center + .. {curl c}(.01900,.69500) -- (.01900,.69500) + .. controls (.01900,.69500) and (.01856,.69500) + .. (.01856,.69500) % end the bottom + .. controls (.01103,.69500) and (-.00192,.69508) + .. (-.00192,.70347) -- cycle + }% }% % #1: the width \def\gre@draw@underbrace#1{% - \gre@draw@roundbrace{#1}{.25500}{ - (-.00192,.24653) % start the bottom - .. controls (-.00192,.24475) and (-.00134,.24260) - .. (.00000,.24000) -- (.00000,.24000){curl c} - .. (p/2,.05500) % bottom of the center - .. {curl c}(p,.24000) -- (p,.24000) - .. controls (p+.00134,.24260) and (p+.00192,.24475) - .. (p+.00192,.24653) % end the bottom - .. controls (p+.00192,.25492) and (p-.01103,.25500) - .. (p-.01856,.25500) % start the top - .. controls (p-.01856,.25500) and (p-.01900,.25500) - .. (p-.01900,.25500) -- (p-.01900,.25500){curl c} - .. (p/2,.08600) % top to the center - .. {curl c}(.01900,.25500) -- (.01900,.25500) - .. controls (.01900,.25500) and (.01856,.25500) - .. (.01856,.25500) % end the top - .. controls (.01103,.25500) and (-.00192,.25492) - .. (-.00192,.24653) -- cycle - }% + \gre@draw@roundbrace{#1}{.25500}{ + (-.00192,.24653) % start the bottom + .. controls (-.00192,.24475) and (-.00134,.24260) + .. (.00000,.24000) -- (.00000,.24000){curl c} + .. (p/2,.05500) % bottom of the center + .. {curl c}(p,.24000) -- (p,.24000) + .. controls (p+.00134,.24260) and (p+.00192,.24475) + .. (p+.00192,.24653) % end the bottom + .. controls (p+.00192,.25492) and (p-.01103,.25500) + .. (p-.01856,.25500) % start the top + .. controls (p-.01856,.25500) and (p-.01900,.25500) + .. (p-.01900,.25500) -- (p-.01900,.25500){curl c} + .. (p/2,.08600) % top to the center + .. {curl c}(.01900,.25500) -- (.01900,.25500) + .. controls (.01900,.25500) and (.01856,.25500) + .. (.01856,.25500) % end the top + .. controls (.01103,.25500) and (-.00192,.25492) + .. (-.00192,.24653) -- cycle + }% }% % #1: the width % #2: height of the bounding box % #3: metapost commands to draw the outline \def\gre@draw@roundbrace#1#2#3{% - \gre@debugmsg{general}{round brace width = #1}% - \gre@metapost{ - \grebracemetapostpreamble{#1} - p = width; - transform t; - t = identity scaled scale; - c = 1; - if p < 0.200: - c := 0; - t := t xscaled (p/0.200); - p := 0.200; - elseif p < 0.350: - c := (p - 0.200) / 0.350; - fi; - beginfig(0); - fill ( #3 ) transformed t; - setbounds currentpicture to - ( (0,0) -- (p,0) -- (p,#2) -- (0,#2) -- cycle ) - transformed t; - endfig; - }% + \gre@debugmsg{general}{round brace width = #1}% + \gre@metapost{ + \grebracemetapostpreamble{#1} + p = width; + transform t; + t = identity scaled scale; + c = 1; + if p < 0.200: + c := 0; + t := t xscaled (p/0.200); + p := 0.200; + elseif p < 0.350: + c := (p - 0.200) / 0.350; + fi; + beginfig(0); + fill ( #3 ) transformed t; + setbounds currentpicture to + ( (0,0) -- (p,0) -- (p,#2) -- (0,#2) -- cycle ) + transformed t; + endfig; + }% }% % #1 : x-distance % #2 : y-distance % #3 : -1 for below, 1 for above \def\gre@draw@slur#1#2#3{% - \gre@metapost{ - \grebracemetapostpreamble{\directlua{gregoriotex.hypotenuse([[#1]],[[#2]])}} - transform t; - t = identity scaled scale; - t := t xscaled width; - t := t rotated \directlua{gregoriotex.rotation([[#1]],[[#2]])}; - beginfig(0); - fill - ( (0,0) - .. controls (0.3,#3*0.20) and (0.7,#3*0.20) - .. (1,0) - -- (1,0) - .. controls (0.7,#3*0.22) and (0.3,#3*0.22) - .. (0,0) - -- cycle - ) transformed t withpen pencircle scaled 0.3; - endfig; - }% + \gre@metapost{ + \grebracemetapostpreamble{\directlua{gregoriotex.hypotenuse([[#1]],[[#2]])}} + transform t; + t = identity scaled scale; + t := t xscaled width; + t := t rotated \directlua{gregoriotex.rotation([[#1]],[[#2]])}; + beginfig(0); + fill + ( (0,0) + .. controls (0.3,#3*0.20) and (0.7,#3*0.20) + .. (1,0) + -- (1,0) + .. controls (0.7,#3*0.22) and (0.3,#3*0.22) + .. (0,0) + -- cycle + ) transformed t withpen pencircle scaled 0.3; + endfig; + }% }% \newdimen\greslurheight @@ -872,69 +906,69 @@ % #5 : y-distance % #6 : end height if #6 not given \def\GreSlur#1#2#3#4#5#6{% - \ifgre@boxing\else % - \ifnum\number#2 > 0\relax % - \gre@calculate@glyphraisevalue{#1}{15}{}% - \else % - \gre@calculate@glyphraisevalue{#1}{16}{}% - \fi % - \hbox to 0pt{\raise\gre@dimen@glyphraisevalue\hbox{% - \ifcase#3 % 0 - \or % 1 - \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% - \kern-\wd\gre@box@temp@sign % - \or % 2 - \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% - \kern-.5\wd\gre@box@temp@sign % - \fi % - \if\relax\detokenize{#5}\relax % - \gre@dimen@temp@five=\gre@dimen@glyphraisevalue\relax % - \ifnum\number#2 > 0\relax % - \gre@calculate@glyphraisevalue{#6}{15}{}% - \else % - \gre@calculate@glyphraisevalue{#6}{16}{}% - \fi % - \greslurheight = \dimexpr(\gre@dimen@glyphraisevalue - \gre@dimen@temp@five)\relax % - \else % - \greslurheight = #5\relax % - \fi % - \gre@draw@slur{#4}{\the\greslurheight}{#2}% - }}% - \fi % - \relax % + \ifgre@boxing\else % + \ifnum\number#2 > 0\relax % + \gre@calculate@glyphraisevalue{#1}{15}{}% + \else % + \gre@calculate@glyphraisevalue{#1}{16}{}% + \fi % + \hbox to 0pt{\raise\gre@dimen@glyphraisevalue\hbox{% + \ifcase#3 % 0 + \or % 1 + \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% + \kern-\wd\gre@box@temp@sign % + \or % 2 + \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% + \kern-.5\wd\gre@box@temp@sign % + \fi % + \if\relax\detokenize{#5}\relax % + \gre@dimen@temp@five=\gre@dimen@glyphraisevalue\relax % + \ifnum\number#2 > 0\relax % + \gre@calculate@glyphraisevalue{#6}{15}{}% + \else % + \gre@calculate@glyphraisevalue{#6}{16}{}% + \fi % + \greslurheight = \dimexpr(\gre@dimen@glyphraisevalue - \gre@dimen@temp@five)\relax % + \else % + \greslurheight = #5\relax % + \fi % + \gre@draw@slur{#4}{\the\greslurheight}{#2}% + }}% + \fi % + \relax % }% % #1: id of the variable length brace within the score \def\GreVarBraceLength#1{% - \ifgre@boxing\else % - \directlua{gregoriotex.var_brace_len(#1)}% - \fi % + \ifgre@boxing\else % + \directlua{gregoriotex.var_brace_len(#1)}% + \fi % }% % #1: id of the variable length brace within the score % #2: 0 = no left-shift, 1 = left-shift 1 punctum, 2 = left shift 1/2 punctum % #3: 1 if the start, 2 if the end \def\GreVarBraceSavePos#1#2#3{% - \ifgre@boxing\else % - \ifcase#2 % 0 - \gre@debugmsg{general}{save case 0}% - \pdfsavepos % - \or % 1 - \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% - \kern-\wd\gre@box@temp@sign % - \pdfsavepos % - \kern\wd\gre@box@temp@sign % - \or % 2 - \gre@debugmsg{general}{save case 2}% - \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% - \gre@dimen@temp@five=\wd\gre@box@temp@sign % - \kern-.5\wd\gre@box@temp@sign % - \pdfsavepos % - \kern.5\wd\gre@box@temp@sign % - \fi % - \directlua{gregoriotex.var_brace_note_pos(#1, #3)}% - \fi % - \relax % + \ifgre@boxing\else % + \ifcase#2 % 0 + \gre@debugmsg{general}{save case 0}% + \gre@savepos % + \or % 1 + \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% + \kern-\wd\gre@box@temp@sign % + \gre@savepos % + \kern\wd\gre@box@temp@sign % + \or % 2 + \gre@debugmsg{general}{save case 2}% + \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% + \gre@dimen@temp@five=\wd\gre@box@temp@sign % + \kern-.5\wd\gre@box@temp@sign % + \gre@savepos % + \kern.5\wd\gre@box@temp@sign % + \fi % + \directlua{gregoriotex.save_length(#1, #3)}% + \fi % + \relax % }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -951,128 +985,115 @@ % #3 is 1 in case of a punctommora in the note before the last note of a podatus, porrectus or torculus resupinus, 0 otherwise. % #4 is 1 if we are at a punctum inclinatum, 0 otherwise \def\gre@punctum@mora#1#2#3#4{% - \GreNoBreak % - \ifcase#2\relax % - \gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% - \hskip\gre@skip@temp@four% - \or % - \gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% - \kern\gre@skip@temp@four % - \or % - % to get the widht of a punctum minus a line, we calculate the width of a flexus (with ambitus of two) minus the width of a punctum - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPesQuadratumLongqueueThreeNothing}% - \gre@dimen@temp@five=\wd\gre@box@temp@width % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% - \advance\gre@dimen@temp@five by -\wd\gre@box@temp@width % - \kern-\gre@dimen@temp@five % - \gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% - \kern\gre@skip@temp@four % - \or % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% - \gre@dimen@temp@five=\wd\gre@box@temp@width % - \kern-\gre@dimen@temp@five % - \gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% - \kern\gre@skip@temp@four % - \fi % - \ifnum#2=0\relax % - \global\gre@lastendswithmoratrue% - \fi % - \ifcase#3\relax % 0 - \gre@calculate@glyphraisevalue{#1}{4}{}% - \or% 1 - \gre@calculate@glyphraisevalue{#1}{8}{}% - \or% 2 - \gre@calculate@glyphraisevalue{#1}{14}{}% - \fi % - % here we shift a bit left in the case where we have a punctum inclinatum on a line - \ifnum#4=1\relax % - \ifgre@isonaline % - \gre@dimen@temp@three=\dimexpr(3700sp * \gre@factor)\relax % - \kern-\gre@dimen@temp@three % - \gre@dimen@temp@three=\dimexpr(4500sp * \gre@factor)\relax% - \advance\gre@dimen@glyphraisevalue by -\gre@dimen@temp@three % - \else % - \gre@dimen@temp@three=\dimexpr(2500sp * \gre@factor)\relax % - \advance\gre@dimen@glyphraisevalue by -\gre@dimen@temp@three % - \fi % - \fi % - \GreNoBreak % - \raise \gre@dimen@glyphraisevalue \hbox{\gre@fontchar@punctummora}% - \GreNoBreak % - \ifcase#2\relax\or % - \setbox\gre@box@temp@width=\hbox{\gre@fontchar@punctummora}% - \gre@skip@temp@four = -\wd\gre@box@temp@width % - \kern\gre@skip@temp@four% - \gre@skip@temp@four = -\gre@space@skip@spacebeforesigns\relax% - \kern\gre@skip@temp@four % - \or % - \setbox\gre@box@temp@width=\hbox{\gre@fontchar@punctummora}% - \gre@skip@temp@four = -\wd\gre@box@temp@width % - \kern\gre@skip@temp@four% - \gre@skip@temp@four = -\gre@space@skip@spacebeforesigns\relax% - \kern\gre@skip@temp@four % - \kern\gre@dimen@temp@five % - \or % - \setbox\gre@box@temp@width=\hbox{\gre@fontchar@punctummora}% - \gre@skip@temp@four = -\wd\gre@box@temp@width % - \kern\gre@skip@temp@four% - \gre@skip@temp@four = -\gre@space@skip@spacebeforesigns\relax% - \kern\gre@skip@temp@four % - \kern\gre@dimen@temp@five % - \fi % - \GreNoBreak % - \relax% + \GreNoBreak % + \ifcase#2\relax % + \gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% + \hskip\gre@skip@temp@four% + \or % + \gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% + \kern\gre@skip@temp@four % + \or % + % to get the widht of a punctum minus a line, we calculate the width of a flexus (with ambitus of two) minus the width of a punctum + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPesQuadratumLongqueueThreeNothing}% + \gre@dimen@temp@five=\wd\gre@box@temp@width % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% + \advance\gre@dimen@temp@five by -\wd\gre@box@temp@width % + \kern-\gre@dimen@temp@five % + \gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% + \kern\gre@skip@temp@four % + \or % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% + \gre@dimen@temp@five=\wd\gre@box@temp@width % + \kern-\gre@dimen@temp@five % + \gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% + \kern\gre@skip@temp@four % + \fi % + \ifnum#2=0\relax % + \global\gre@lastendswithmoratrue% + \fi % + \ifcase#3\relax % 0 + \gre@calculate@glyphraisevalue{#1}{4}{}% + \or% 1 + \gre@calculate@glyphraisevalue{#1}{8}{}% + \or% 2 + \gre@calculate@glyphraisevalue{#1}{14}{}% + \fi % + % here we shift a bit left in the case where we have a punctum inclinatum on a line + \ifnum#4=1\relax % + \ifgre@isonaline % + \gre@dimen@temp@three=\dimexpr(3700sp * \gre@factor)\relax % + \kern-\gre@dimen@temp@three % + \gre@dimen@temp@three=\dimexpr(4500sp * \gre@factor)\relax% + \advance\gre@dimen@glyphraisevalue by -\gre@dimen@temp@three % + \else % + \gre@dimen@temp@three=\dimexpr(2500sp * \gre@factor)\relax % + \advance\gre@dimen@glyphraisevalue by -\gre@dimen@temp@three % + \fi % + \fi % + \GreNoBreak % + \raise \gre@dimen@glyphraisevalue \hbox{\gre@fontchar@punctummora}% + \GreNoBreak % + \ifcase#2\relax\or % + \setbox\gre@box@temp@width=\hbox{\gre@fontchar@punctummora}% + \gre@skip@temp@four = -\wd\gre@box@temp@width % + \kern\gre@skip@temp@four% + \gre@skip@temp@four = -\gre@space@skip@spacebeforesigns\relax% + \kern\gre@skip@temp@four % + \or % + \setbox\gre@box@temp@width=\hbox{\gre@fontchar@punctummora}% + \gre@skip@temp@four = -\wd\gre@box@temp@width % + \kern\gre@skip@temp@four% + \gre@skip@temp@four = -\gre@space@skip@spacebeforesigns\relax% + \kern\gre@skip@temp@four % + \kern\gre@dimen@temp@five % + \or % + \setbox\gre@box@temp@width=\hbox{\gre@fontchar@punctummora}% + \gre@skip@temp@four = -\wd\gre@box@temp@width % + \kern\gre@skip@temp@four% + \gre@skip@temp@four = -\gre@space@skip@spacebeforesigns\relax% + \kern\gre@skip@temp@four % + \kern\gre@dimen@temp@five % + \fi % + \GreNoBreak % + \relax% }% \def\GrePunctumMora#1#2#3#4{% - \ifgre@disablemora\else % - \gre@punctum@mora{#1}{#2}{#3}{#4}% - \fi % - \relax % + \ifgre@disablemora\else % + \gre@punctum@mora{#1}{#2}{#3}{#4}% + \fi % + \relax % } % a function to typeset an augmentum duplex, easy enough to be understood... \def\GreAugmentumDuplex#1#2#3{% - \ifgre@boxing\else % - \GrePunctumMora{#1}{1}{#3}{0}% - \fi % - \GrePunctumMora{#2}{0}{0}{0}% - \relax % + \ifgre@boxing\else % + \GrePunctumMora{#1}{1}{#3}{0}% + \fi % + \GrePunctumMora{#2}{0}{0}{0}% + \relax % }% -\gdef\grelowchoralsignstyle#1{\relax}% OBSOLETE -\let\gre@empty@lowchoralsignstyle\grelowchoralsignstyle% -\gdef\grehighchoralsignstyle#1{\relax}% OBSOLETE -\let\gre@empty@highchoralsignstyle\grehighchoralsignstyle% - % quite simple function: #1 is the height, #2 is the string, #3 is #2 of punctum mora, #4 is #3 of punctum mora % #3 is 1 if it must be a bit higher \def\GreLowChoralSign#1#2#3{% - \GreNoBreak % - \gre@skip@temp@four = \gre@space@skip@beforelowchoralsignspace\relax% - \hskip\gre@skip@temp@four % - \GreNoBreak % - \ifnum#3=1\relax % - \gre@calculate@glyphraisevalue{#1}{12}{}% - \else % - \gre@calculate@glyphraisevalue{#1}{10}{}% - \fi % - \raise\gre@dimen@glyphraisevalue\hbox{\gre@style@lowchoralsign#2\endgre@style@lowchoralsign}% - \ifx\gre@empty@lowchoralsignstyle\grelowchoralsignstyle% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\grelowchoralsignstyle}{\protect\grechangestyle{lowchoralsign}}% OBSOLETE - \fi% OBSOLETE - \relax % + \GreNoBreak % + \gre@skip@temp@four = \gre@space@skip@beforelowchoralsignspace\relax% + \hskip\gre@skip@temp@four % + \GreNoBreak % + \ifnum#3=1\relax % + \gre@calculate@glyphraisevalue{#1}{12}{}% + \else % + \gre@calculate@glyphraisevalue{#1}{10}{}% + \fi % + \raise\gre@dimen@glyphraisevalue\hbox{\gre@style@lowchoralsign#2\endgre@style@lowchoralsign}% + \relax % }% \def\GreHighChoralSign#1#2#3{% - \GreNoBreak % - \gre@vepisemaorrare{#1}{#3}{}{3}{\gre@style@highchoralsign#2\endgre@style@highchoralsign}% - \ifx\gre@empty@highchoralsignstyle\grehighchoralsignstyle% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\grehighchoralsignstyle}{\protect\grechangestyle{highchoralsign}}% OBSOLETE - \fi% OBSOLETE - \relax % + \GreNoBreak % + \gre@vepisemaorrare{#1}{#3}{}{3}{\gre@style@highchoralsign#2\endgre@style@highchoralsign}% + \relax % }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1080,8 +1101,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\GreLinea#1#2#3#4#5#6{% - \GreGlyph{\GreCPLinea}{#1}{#2}{#3}{#4}{#5}{#6}% - \relax % + \GreGlyph{\GreCPLinea}{#1}{#2}{#3}{#4}{#5}{#6}% + \relax % }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1110,46 +1131,46 @@ % #6 is the type of sign (1: vertical episema, 2: rare sign, 3: choral sign) % #7 is the choral sign if relevant \def\gre@vepisemaorrareaux#1#2#3#4#5#6#7{% - % first we set \gre@dimen@temp@three to the width of the last glyph - \gre@dimen@temp@three=\gre@dimen@lastglyphwidth\relax% - \setbox\gre@box@temp@sign=\hbox{\gre@font@music #2}% - \gre@dimen@temp@two=\dimexpr(\wd\gre@box@temp@sign / 2)\relax % - \ifcase#3% - % tempwidth is the width of the last glyph - \advance\gre@dimen@temp@three by -\gre@dimen@temp@two % - \or% - \gre@dimen@temp@three=\gre@dimen@temp@two % - \or% - \setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% - \gre@dimen@temp@three=\dimexpr(\wd\gre@box@temp@sign - \gre@dimen@temp@two)\relax % - \or % - \setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% - \advance\gre@dimen@temp@three by \dimexpr(-\wd\gre@box@temp@sign + \gre@dimen@temp@two)\relax % - \fi% - \kern-\gre@dimen@temp@three % we do it here because of the now-removed ictus (chironomy) - % then we draw the sign - \ifcase#6\or % - % vertical episema - \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@verticalepisema}% - \or % rare sign - \setbox\gre@box@temp@sign=\hbox{\gre@font@music#5}% - \or % choral sign - \setbox\gre@box@temp@sign=\hbox{#7}% - \or % brace above bar - \setbox\gre@box@temp@sign=\hbox{\gre@render@barbrace}% - \fi % - % we set tempwidth to half a punctum malus half the sign width, so that the centers are aligned - \gre@dimen@temp@two=\dimexpr(\wd\gre@box@temp@sign / 2)\relax % - \advance\gre@dimen@temp@three by \gre@dimen@temp@two % - \kern-\gre@dimen@temp@two% - \gre@skip@temp@four = #4sp% - \kern \gre@skip@temp@four% - \raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % - \kern -\gre@skip@temp@four% - % and finally we go back to the end of the glyph, where we were first - \advance\gre@dimen@temp@three by -2\gre@dimen@temp@two % - \kern\gre@dimen@temp@three% - \relax% + % first we set \gre@dimen@temp@three to the width of the last glyph + \gre@dimen@temp@three=\gre@dimen@lastglyphwidth\relax% + \setbox\gre@box@temp@sign=\hbox{\gre@font@music #2}% + \gre@dimen@temp@two=\dimexpr(\wd\gre@box@temp@sign / 2)\relax % + \ifcase#3% + % tempwidth is the width of the last glyph + \advance\gre@dimen@temp@three by -\gre@dimen@temp@two % + \or% + \gre@dimen@temp@three=\gre@dimen@temp@two % + \or% + \setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% + \gre@dimen@temp@three=\dimexpr(\wd\gre@box@temp@sign - \gre@dimen@temp@two)\relax % + \or % + \setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% + \advance\gre@dimen@temp@three by \dimexpr(-\wd\gre@box@temp@sign + \gre@dimen@temp@two)\relax % + \fi% + \kern-\gre@dimen@temp@three % we do it here because of the now-removed ictus (chironomy) + % then we draw the sign + \ifcase#6\or % + % vertical episema + \setbox\gre@box@temp@sign=\hbox{\gre@fontchar@verticalepisema}% + \or % rare sign + \setbox\gre@box@temp@sign=\hbox{\gre@font@music#5}% + \or % choral sign + \setbox\gre@box@temp@sign=\hbox{#7}% + \or % brace above bar + \setbox\gre@box@temp@sign=\hbox{\gre@render@barbrace}% + \fi % + % we set tempwidth to half a punctum malus half the sign width, so that the centers are aligned + \gre@dimen@temp@two=\dimexpr(\wd\gre@box@temp@sign / 2)\relax % + \advance\gre@dimen@temp@three by \gre@dimen@temp@two % + \kern-\gre@dimen@temp@two% + \gre@skip@temp@four = #4sp% + \kern \gre@skip@temp@four% + \raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % + \kern -\gre@skip@temp@four% + % and finally we go back to the end of the glyph, where we were first + \advance\gre@dimen@temp@three by -2\gre@dimen@temp@two % + \kern\gre@dimen@temp@three% + \relax% }% \directlua{gregoriotex.emit_offset_macros()}% @@ -1163,81 +1184,81 @@ % #4 is type (1: vertical episema, 2: rare sign, 3: choral sign, 4: brace above the bar) % #5 is the choral sign if relevant \def\gre@vepisemaorrare#1#2#3#4#5{% - \ifgre@boxing\else % - \ifcase#4\or % - % if it is a vertical episema, we call the normal calculateglyphvalue - \gre@calculate@glyphraisevalue{#1}{3}{}% - \or % - % if it is not, we call it with 6 as second argument, it will give us the height of the rare signs (accentus, etc.) the first argument is m if the pitch is < k, otherwise it's n. - \ifnum#1<\gre@pitch@raresign\relax % - \gre@calculate@glyphraisevalue{\gre@pitch@raresign}{6}{}% - \else % - {% - \gre@count@temp@three=\numexpr(#1 + 1)\relax % - \gre@calculate@glyphraisevalue{\gre@count@temp@three}{6}{}% - }% - \fi % - \or % if it's a choral sign - \gre@calculate@glyphraisevalue{#1}{11}{}% - \or % if it's the brace above the bar - \gre@calculate@glyphraisevalue{#1}{13}{}% - \fi % - \gre@v@case{#2}{#3}{#4}{#5}% - \fi % - \relax% + \ifgre@boxing\else % + \ifcase#4\or % + % if it is a vertical episema, we call the normal calculateglyphvalue + \gre@calculate@glyphraisevalue{#1}{3}{}% + \or % + % if it is not, we call it with 6 as second argument, it will give us the height of the rare signs (accentus, etc.) the first argument is m if the pitch is < k, otherwise it's n. + \ifnum#1<\gre@pitch@raresign\relax % + \gre@calculate@glyphraisevalue{\gre@pitch@raresign}{6}{}% + \else % + {% + \gre@count@temp@three=\numexpr(#1 + 1)\relax % + \gre@calculate@glyphraisevalue{\gre@count@temp@three}{6}{}% + }% + \fi % + \or % if it's a choral sign + \gre@calculate@glyphraisevalue{#1}{11}{}% + \or % if it's the brace above the bar + \gre@calculate@glyphraisevalue{#1}{13}{}% + \fi % + \gre@v@case{#2}{#3}{#4}{#5}% + \fi % + \relax% }% \def\GreVEpisema#1#2{% - \ifgre@disablevepisema\else % - \gre@vepisemaorrare{#1}{#2}{\GreCPVEpisema}{1}{}% - \fi % - \relax % + \ifgre@disablevepisema\else % + \gre@vepisemaorrare{#1}{#2}{\GreCPVEpisema}{1}{}% + \fi % + \relax % }% \def\GreBarBrace#1{% - \gre@vepisemaorrare{\gre@pitch@overbraceglyph}{#1}{% - \gre@render@barbrace% - }{4}{}% - \relax % + \gre@vepisemaorrare{\gre@pitch@overbraceglyph}{#1}{% + \gre@render@barbrace% + }{4}{}% + \relax % }% \def\gre@render@barbrace{% - \hbox{% - \ifgre@metapost@barbrace % - \gre@draw@brace{*}% - \else % - \gre@fontchar@abovebarbrace % - \fi % - }% + \hbox{% + \ifgre@metapost@barbrace % + \gre@draw@brace{*}% + \else % + \gre@fontchar@abovebarbrace % + \fi % + }% }% \def\GreBarVEpisema#1{% - \gre@vepisemaorrare{\gre@pitch@barvepisema}{#1}{\GreCPVEpisema}{1}{}% - \relax % + \gre@vepisemaorrare{\gre@pitch@barvepisema}{#1}{\GreCPVEpisema}{1}{}% + \relax % }% \def\GreAccentus#1#2{% - \gre@vepisemaorrare{#1}{#2}{\GreCPAccentus}{2}{}% - \relax % + \gre@vepisemaorrare{#1}{#2}{\GreCPAccentus}{2}{}% + \relax % }% \def\GreSemicirculus#1#2{% - \gre@vepisemaorrare{#1}{#2}{\GreCPSemicirculus}{2}{}% - \relax % + \gre@vepisemaorrare{#1}{#2}{\GreCPSemicirculus}{2}{}% + \relax % }% \def\GreCirculus#1#2{% - \gre@vepisemaorrare{#1}{#2}{\GreCPCirculus}{2}{}% - \relax % + \gre@vepisemaorrare{#1}{#2}{\GreCPCirculus}{2}{}% + \relax % }% \def\GreReversedAccentus#1#2{% - \gre@vepisemaorrare{#1}{#2}{\GreCPAccentusReversus}{2}{}% - \relax % + \gre@vepisemaorrare{#1}{#2}{\GreCPAccentusReversus}{2}{}% + \relax % }% \def\GreReversedSemicirculus#1#2{% - \gre@vepisemaorrare{#1}{#2}{\GreCPSemicirculusReversus}{2}{}% - \relax % + \gre@vepisemaorrare{#1}{#2}{\GreCPSemicirculusReversus}{2}{}% + \relax % }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1262,75 +1283,71 @@ % end of #1 % #4 argument is the same as in hepisorline \def\gre@hepisorlineaux#1#2#3#4{% - \ifcase#3% case 0 - % first we set \gre@dimen@temp@three to the width of the last glyph - \gre@dimen@temp@three=\gre@dimen@lastglyphwidth\relax% - \or % case 1 - \gre@dimen@temp@three=0 pt\relax % - \or % case 2 - \setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% - \gre@dimen@temp@three=\wd\gre@box@temp@sign% - \or % case 3 - \setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% - \gre@dimen@temp@three=\dimexpr(\gre@dimen@lastglyphwidth - \wd\gre@box@temp@sign)\relax % - \or % case 4 - \setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% - \gre@dimen@temp@three=\dimexpr(\gre@dimen@lastglyphwidth - \wd\gre@box@temp@sign)\relax % - \setbox\gre@box@temp@sign=\hbox{\gre@font@music #2}% - \advance\gre@dimen@temp@three by \wd\gre@box@temp@sign % - \fi% - \kern-\gre@dimen@temp@three % - % then we draw the sign, and go back to the beginning of the sign - \setbox\gre@box@temp@sign=\hbox{\gre@font@music#2}% - % we set tempwidth to half a punctum malus half the sign width, so that the centers are aligned - \gre@dimen@temp@two=\wd\gre@box@temp@sign % - \ifcase#4% - %case of hepisema - \raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % - \or % - %case of hepisema at the bottom - \raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % - \or % case of a line at the top - \ifnum\gre@count@lastglyphiscavum=2\relax % - \gre@drawadditionalline{0}{\gre@dimen@temp@two}{0}{}{1}{}% - \else % - \gre@drawadditionalline{0}{\gre@dimen@temp@two}{1}{}{1}{}% - \fi % - \gre@dimen@temp@two=0pt\relax % - \or % case of a line at the bottom - \ifnum\gre@count@lastglyphiscavum=2\relax % - \gre@drawadditionalline{1}{\gre@dimen@temp@two}{0}{}{1}{}% - \else % - \gre@drawadditionalline{1}{\gre@dimen@temp@two}{1}{}{1}{}% - \fi % - \gre@dimen@temp@two=0pt\relax % - \or % - %case of choral sign - \raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % - \or % - \fi % - % and finally we go back to the end of the glyph, where we were first - \advance\gre@dimen@temp@three by -\gre@dimen@temp@two % - \kern\gre@dimen@temp@three % - \relax% + \ifcase#3% case 0 + % first we set \gre@dimen@temp@three to the width of the last glyph + \gre@dimen@temp@three=\gre@dimen@lastglyphwidth\relax% + \or % case 1 + \gre@dimen@temp@three=0 pt\relax % + \or % case 2 + \setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% + \gre@dimen@temp@three=\wd\gre@box@temp@sign% + \or % case 3 + \setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% + \gre@dimen@temp@three=\dimexpr(\gre@dimen@lastglyphwidth - \wd\gre@box@temp@sign)\relax % + \or % case 4 + \setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% + \gre@dimen@temp@three=\dimexpr(\gre@dimen@lastglyphwidth - \wd\gre@box@temp@sign)\relax % + \setbox\gre@box@temp@sign=\hbox{\gre@font@music #2}% + \advance\gre@dimen@temp@three by \wd\gre@box@temp@sign % + \fi% + \kern-\gre@dimen@temp@three % + % then we draw the sign, and go back to the beginning of the sign + \setbox\gre@box@temp@sign=\hbox{\gre@font@music#2}% + % we set tempwidth to half a punctum malus half the sign width, so that the centers are aligned + \gre@dimen@temp@two=\wd\gre@box@temp@sign % + \ifcase#4% + %case of hepisema + \raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % + \or % + %case of hepisema at the bottom + \raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % + \or % case of a line at the top + \ifnum\gre@count@lastglyphiscavum=2\relax % + \gre@drawadditionalline{0}{\gre@dimen@temp@two}{0}{}{1}{}% + \else % + \gre@drawadditionalline{0}{\gre@dimen@temp@two}{1}{}{1}{}% + \fi % + \gre@dimen@temp@two=0pt\relax % + \or % case of a line at the bottom + \ifnum\gre@count@lastglyphiscavum=2\relax % + \gre@drawadditionalline{1}{\gre@dimen@temp@two}{0}{}{1}{}% + \else % + \gre@drawadditionalline{1}{\gre@dimen@temp@two}{1}{}{1}{}% + \fi % + \gre@dimen@temp@two=0pt\relax % + \or % + %case of choral sign + \raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % + \or % + \fi % + % and finally we go back to the end of the glyph, where we were first + \advance\gre@dimen@temp@three by -\gre@dimen@temp@two % + \kern\gre@dimen@temp@three % + \relax% }% % another dumb top function \def\GreAdditionalLine#1#2#3{% - \ifgre@showlines % - \ifgre@boxing\else % - \xdef\gre@dimen@savedglyphraise{\the\gre@dimen@glyphraisevalue}% - \gre@style@additionalstafflines % - \ifx\gre@empty@additionalstafflinesformat\greadditionalstafflinesformat% OBSOLETE - \else % OBSOLETE - \gre@obsolete{\protect\greadditionalstafflinesformat}{\protect\grechangestyle{additionalstafflinesformat}}% OBSOLETE - \fi% OBSOLETE - \gre@hepisorline{\gre@pitch@dummy}{#1}{#2}{#3}{f}{}{}% - \endgre@style@additionalstafflines% - \gre@dimen@glyphraisevalue=\gre@dimen@savedglyphraise\relax% - \fi % - \fi % - \relax % + \ifgre@showlines % + \ifgre@boxing\else % + \xdef\gre@dimen@savedglyphraise{\the\gre@dimen@glyphraisevalue}% + \gre@style@additionalstafflines % + \gre@hepisorline{\gre@pitch@dummy}{#1}{#2}{#3}{f}{}{}% + \endgre@style@additionalstafflines% + \gre@dimen@glyphraisevalue=\gre@dimen@savedglyphraise\relax% + \fi % + \fi % + \relax % }% % #1 0 for over staff, @@ -1345,60 +1362,56 @@ % 2 for #6 space after % #6 custom space after, used if #4 is 2 \def\GreDrawAdditionalLine#1#2#3#4#5#6{% - \ifgre@showlines % - \xdef\gre@dimen@savedglyphraise{\the\gre@dimen@glyphraisevalue}% - \gre@style@additionalstafflines % - \ifx\gre@empty@additionalstafflinesformat\greadditionalstafflinesformat% OBSOLETE - \else % OBSOLETE - \gre@obsolete{\protect\greadditionalstafflinesformat}{\protect\grechangestyle{additionalstafflinesformat}}% OBSOLETE - \fi% OBSOLETE - \gre@drawadditionalline{#1}{#2}{#3}{#4}{#5}{#6}% - \endgre@style@additionalstafflines% - \gre@dimen@glyphraisevalue=\gre@dimen@savedglyphraise\relax% - \fi % - \relax % + \ifgre@showlines % + \xdef\gre@dimen@savedglyphraise{\the\gre@dimen@glyphraisevalue}% + \gre@style@additionalstafflines % + \gre@drawadditionalline{#1}{#2}{#3}{#4}{#5}{#6}% + \endgre@style@additionalstafflines% + \gre@dimen@glyphraisevalue=\gre@dimen@savedglyphraise\relax% + \fi % + \relax % } \def\gre@drawadditionalline#1#2#3#4#5#6{% - \ifcase#3 % 0 - \gre@dimen@temp@five=0pt\relax % - \or % 1 - \gre@dimen@temp@five=\gre@space@dimen@additionallineswidth\relax % - \or % 2 - \gre@dimen@temp@five=#4\relax % - \fi % - \ifcase#5 % 0 - \gre@dimen@temp@four=0pt\relax % - \or % 1 - \gre@dimen@temp@four=\gre@space@dimen@additionallineswidth\relax % - \or % 2 - \gre@dimen@temp@four=#6\relax % - \fi % - \gre@dimen@temp@two=% - \dimexpr(#2 % - + \gre@dimen@temp@five % - + \gre@dimen@temp@four)\relax % - \ifcase#1 % 0 - \gre@dimen@glyphraisevalue=% - \dimexpr(\gre@dimen@additionalbottomspace % - + \gre@space@dimen@spacebeneathtext % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@currenttranslationheight % - + \gre@stafflines\gre@dimen@interstafflinespace % - + \gre@stafflines\gre@dimen@stafflineheight)\relax% - \or % 1 - \gre@dimen@glyphraisevalue=% - \dimexpr(\gre@dimen@additionalbottomspace % - + \gre@space@dimen@spacebeneathtext % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@currenttranslationheight % - - \gre@dimen@interstafflinespace % - - \gre@dimen@stafflineheight)\relax% - \fi % - \raise\gre@dimen@glyphraisevalue\hbox to 0pt{% - \kern-\gre@dimen@temp@five % - \vrule height \gre@dimen@stafflineheight % - width \gre@dimen@temp@two % - }% + \ifcase#3 % 0 + \gre@dimen@temp@five=0pt\relax % + \or % 1 + \gre@dimen@temp@five=\gre@space@dimen@additionallineswidth\relax % + \or % 2 + \gre@dimen@temp@five=#4\relax % + \fi % + \ifcase#5 % 0 + \gre@dimen@temp@four=0pt\relax % + \or % 1 + \gre@dimen@temp@four=\gre@space@dimen@additionallineswidth\relax % + \or % 2 + \gre@dimen@temp@four=#6\relax % + \fi % + \gre@dimen@temp@two=% + \dimexpr(#2 % + + \gre@dimen@temp@five % + + \gre@dimen@temp@four)\relax % + \ifcase#1 % 0 + \gre@dimen@glyphraisevalue=% + \dimexpr(\gre@dimen@additionalbottomspace % + + \gre@space@dimen@spacebeneathtext % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@currenttranslationheight % + + \gre@stafflines\gre@dimen@interstafflinespace % + + \gre@stafflines\gre@dimen@stafflineheight)\relax% + \or % 1 + \gre@dimen@glyphraisevalue=% + \dimexpr(\gre@dimen@additionalbottomspace % + + \gre@space@dimen@spacebeneathtext % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@currenttranslationheight % + - \gre@dimen@interstafflinespace % + - \gre@dimen@stafflineheight)\relax% + \fi % + \raise\gre@dimen@glyphraisevalue\hbox to 0pt{% + \kern-\gre@dimen@temp@five % + \vrule height \gre@dimen@stafflineheight % + width \gre@dimen@temp@two % + }% } % a function to typeset a horizontal line (additional line or episema). @@ -1423,19 +1436,19 @@ %% 4 : low in space below note %% 5 : high in space below note \def\gre@hepisorline#1#2#3#4#5#6#7{{% - \ifcase#4 % 0 - \gre@calculate@glyphraisevalue{#1}{9}{#7}% - \or % 1 - \gre@calculate@glyphraisevalue{#1}{5}{#7}% - \or % 2 - % the glyphraisevalue is ignored anyway... but it's just in case... - \gre@calculate@glyphraisevalue{\gre@pitch@ledger@above}{0}{}% - \or % 3 - \gre@calculate@glyphraisevalue{\gre@pitch@ledger@below}{0}{}% - \fi % - \global\gre@dimen@glyphraisevalue=\dimexpr\gre@dimen@glyphraisevalue#6\relax % - \gre@h@case{#2}{#3}{#4}{#5}% - \relax% + \ifcase#4 % 0 + \gre@calculate@glyphraisevalue{#1}{9}{#7}% + \or % 1 + \gre@calculate@glyphraisevalue{#1}{5}{#7}% + \or % 2 + % the glyphraisevalue is ignored anyway... but it's just in case... + \gre@calculate@glyphraisevalue{\gre@pitch@ledger@above}{0}{}% + \or % 3 + \gre@calculate@glyphraisevalue{\gre@pitch@ledger@below}{0}{}% + \fi % + \global\gre@dimen@glyphraisevalue=\dimexpr\gre@dimen@glyphraisevalue#6\relax % + \gre@h@case{#2}{#3}{#4}{#5}% + \relax% }}% % dumb top function @@ -1451,39 +1464,31 @@ %% 4 : low in space below note %% 5 : high in space below note \def\GreHEpisema#1#2#3#4#5#6#7#8#9{% - \ifgre@boxing\else\ifgre@disablehepisema\else % - \gre@prephepisemaledgerlineheuristics% - #7% - \ifgre@hepisemabridge% - \gre@hepisorline{#6}{#2}{#3}{#4}{#5}{#8}{#9}% - \else % - \gre@hepisorline{#1}{#2}{#3}{#4}{#5}{#8}{#9}% - \fi % - \gre@resetledgerlineheuristics% - \fi\fi % - \relax % + \ifgre@boxing\else\ifgre@disablehepisema\else % + \gre@prephepisemaledgerlineheuristics% + #7% + \ifgre@hepisemabridge% + \gre@hepisorline{#6}{#2}{#3}{#4}{#5}{#8}{#9}% + \else % + \gre@hepisorline{#1}{#2}{#3}{#4}{#5}{#8}{#9}% + \fi % + \gre@resetledgerlineheuristics% + \fi\fi % + \relax % }% \newif\ifgre@hepisemabridge \gre@hepisemabridgetrue -\def\AddHEpisemusBridges{%OBSOLETE - \gre@obsolete{\protect\AddHEpisemusBridges}{\protect\gresethepisema{bridge}}% -}% - -\def\RemoveHEpisemusBridges{%OBSOLETE - \gre@obsolete{\protect\RemoveHEpisemusBridges}{\protect\gresethepisema{break}}% -}% - \def\gresethepisema#1{% - \IfStrEqCase{#1}{% - {bridge}% - {\gre@hepisemabridgetrue}% - {break}% - {\gre@hepisemabridgefalse}% - }[% all other cases - \gre@error{Unrecognized option, #1, for \protect\gresethepisema\MessageBreak Possible options are: 'bridge' and 'break'}% - ]% + \IfStrEqCase{#1}{% + {bridge}% + {\gre@hepisemabridgetrue}% + {break}% + {\gre@hepisemabridgefalse}% + }[% all other cases + \gre@error{Unrecognized option, #1, for \protect\gresethepisema\MessageBreak Possible options are: 'bridge' and 'break'}% + ]% }% % same but for a "bridge episema" after the last note of a glyph (element, syllable) if the next episema is at the same height @@ -1500,38 +1505,38 @@ %% 4 : low in space below note %% 5 : high in space below note \def\GreHEpisemaBridge#1#2#3#4#5#6{% - \ifgre@hepisemabridge% - \ifgre@boxing\else % - \gre@prephepisemaledgerlineheuristics% - #4% - \ifcase#2 % - \gre@calculate@glyphraisevalue{#1}{9}{#6}% - \or % - \gre@calculate@glyphraisevalue{#1}{5}{#6}% - \fi % - \global\gre@dimen@glyphraisevalue=\dimexpr\gre@dimen@glyphraisevalue#5\relax % - \IfStrEq{-1}{#3}{% - \raise\gre@dimen@glyphraisevalue\hbox to 0pt{\gre@font@music\gre@char@he@punctum{f}\hss}% - }{% - % special handling for punctum inclinatum - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPHEpisemaPunctumReduced}% - \gre@dimen@temp@four = \wd\gre@box@temp@width\relax % - \gre@get@spaceskip{#3}% - % convert rubber length to dimension... not perfect but works in the usual case - \gre@dimen@temp@three = 1\gre@skip@temp@four\relax % - \raise\gre@dimen@glyphraisevalue\hbox to 0pt{% - \loop\ifdim\gre@dimen@temp@three > 0pt\relax% - \advance\gre@dimen@temp@three by -\gre@dimen@temp@four\relax % - {\gre@font@music\GreCPHEpisemaPunctumReduced}% - \repeat % - \kern\gre@dimen@temp@three{\gre@font@music\GreCPHEpisemaPunctumReduced}% - \hss % - }% - }% - \gre@resetledgerlineheuristics% - \fi % - \fi % - \relax % + \ifgre@hepisemabridge% + \ifgre@boxing\else % + \gre@prephepisemaledgerlineheuristics% + #4% + \ifcase#2 % + \gre@calculate@glyphraisevalue{#1}{9}{#6}% + \or % + \gre@calculate@glyphraisevalue{#1}{5}{#6}% + \fi % + \global\gre@dimen@glyphraisevalue=\dimexpr\gre@dimen@glyphraisevalue#5\relax % + \IfStrEq{-1}{#3}{% + \raise\gre@dimen@glyphraisevalue\hbox to 0pt{\gre@font@music\gre@char@he@punctum{f}\hss}% + }{% + % special handling for punctum inclinatum + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPHEpisemaPunctumReduced}% + \gre@dimen@temp@four = \wd\gre@box@temp@width\relax % + \gre@get@spaceskip{#3}% + % convert rubber length to dimension... not perfect but works in the usual case + \gre@dimen@temp@three = 1\gre@skip@temp@four\relax % + \raise\gre@dimen@glyphraisevalue\hbox to 0pt{% + \loop\ifdim\gre@dimen@temp@three > 0pt\relax% + \advance\gre@dimen@temp@three by -\gre@dimen@temp@four\relax % + {\gre@font@music\GreCPHEpisemaPunctumReduced}% + \repeat % + \kern\gre@dimen@temp@three{\gre@font@music\GreCPHEpisemaPunctumReduced}% + \hss % + }% + }% + \gre@resetledgerlineheuristics% + \fi % + \fi % + \relax % }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1541,134 +1546,134 @@ % we define two types of macro for each four bar : when it is inside a syllable, and when it is not \def\GreInVirgula#1#2{% - \gre@writebar{0}{1}{#1}{#2}% - \relax% + \gre@writebar{0}{1}{#1}{#2}% + \relax% }% \def\GreVirgula#1#2{% - \gre@writebar{0}{0}{#1}{#2}% - \relax% + \gre@writebar{0}{0}{#1}{#2}% + \relax% }% \def\GreInDivisioMinima#1#2{% - \gre@writebar{1}{1}{#1}{#2}% - \relax% + \gre@writebar{1}{1}{#1}{#2}% + \relax% }% \def\GreDivisioMinima#1#2{% - \gre@writebar{1}{0}{#1}{#2}% - \relax% + \gre@writebar{1}{0}{#1}{#2}% + \relax% }% \def\GreInDivisioMinor#1#2{% - \gre@writebar{2}{1}{#1}{#2}% - \relax% + \gre@writebar{2}{1}{#1}{#2}% + \relax% }% \def\GreDivisioMinor#1#2{% - \gre@writebar{2}{0}{#1}{#2}% - \relax% + \gre@writebar{2}{0}{#1}{#2}% + \relax% }% \def\GreInDivisioMaior#1#2{% - \gre@writebar{3}{1}{#1}{#2}% - \relax% + \gre@writebar{3}{1}{#1}{#2}% + \relax% }% \def\GreDivisioMaior#1#2{% - \gre@writebar{3}{0}{#1}{#2}% - \relax% + \gre@writebar{3}{0}{#1}{#2}% + \relax% }% \def\GreDominica#1#2#3{% - \ifcase#1\or % - \gre@writebar{6}{0}{#2}{#3}% - \or % - \gre@writebar{7}{0}{#2}{#3}% - \or % - \gre@writebar{8}{0}{#2}{#3}% - \or % - \gre@writebar{9}{0}{#2}{#3}% - \or % - \gre@writebar{10}{0}{#2}{#3}% - \or % - \gre@writebar{11}{0}{#2}{#3}% - \or % - \gre@writebar{12}{0}{#2}{#3}% - \or % - \gre@writebar{13}{0}{#2}{#3}% - \fi % - \relax% + \ifcase#1\or % + \gre@writebar{6}{0}{#2}{#3}% + \or % + \gre@writebar{7}{0}{#2}{#3}% + \or % + \gre@writebar{8}{0}{#2}{#3}% + \or % + \gre@writebar{9}{0}{#2}{#3}% + \or % + \gre@writebar{10}{0}{#2}{#3}% + \or % + \gre@writebar{11}{0}{#2}{#3}% + \or % + \gre@writebar{12}{0}{#2}{#3}% + \or % + \gre@writebar{13}{0}{#2}{#3}% + \fi % + \relax% }% \def\GreInDominica#1#2#3{% - \ifcase#1\or % - \gre@writebar{6}{1}{#2}{#3}% - \or % - \gre@writebar{7}{1}{#2}{#3}% - \or % - \gre@writebar{8}{1}{#2}{#3}% - \or % - \gre@writebar{9}{1}{#2}{#3}% - \or % - \gre@writebar{10}{1}{#2}{#3}% - \or % - \gre@writebar{11}{1}{#2}{#3}% - \or % - \gre@writebar{12}{1}{#2}{#3}% - \or % - \gre@writebar{13}{1}{#2}{#3}% - \fi % - \relax% + \ifcase#1\or % + \gre@writebar{6}{1}{#2}{#3}% + \or % + \gre@writebar{7}{1}{#2}{#3}% + \or % + \gre@writebar{8}{1}{#2}{#3}% + \or % + \gre@writebar{9}{1}{#2}{#3}% + \or % + \gre@writebar{10}{1}{#2}{#3}% + \or % + \gre@writebar{11}{1}{#2}{#3}% + \or % + \gre@writebar{12}{1}{#2}{#3}% + \or % + \gre@writebar{13}{1}{#2}{#3}% + \fi % + \relax% }% \def\GreInDivisioFinalis#1#2{% - \ifgre@endofscore % - \gre@writebar{5}{1}{#1}{#2}% - \else % - \gre@writebar{4}{1}{#1}{#2}% - \fi % - \relax% + \ifgre@endofscore % + \gre@writebar{5}{1}{#1}{#2}% + \else % + \gre@writebar{4}{1}{#1}{#2}% + \fi % + \relax% }% \def\GreDivisioFinalis#1#2{% - \ifgre@endofscore % - \gre@writebar{5}{0}{#1}{#2}% - \else % - \gre@writebar{4}{0}{#1}{#2}% - \fi % - \relax% + \ifgre@endofscore % + \gre@writebar{5}{0}{#1}{#2}% + \else % + \gre@writebar{4}{0}{#1}{#2}% + \fi % + \relax% }% % #1 is #2 of gre@writebar % #2 is #3 of gre@writebar % emits the suffix of the space \def\gre@bar@space@suffix#1#2{% - \ifcase#1\ifgre@newbarspacing % - \ifcase#2 @standalone@notext\or @standalone@text\fi % - \fi\fi % + \ifcase#1\ifgre@newbarspacing % + \ifcase#2 @standalone@notext\or @standalone@text\fi % + \fi\fi % }% \newcount\gre@count@shiftaftermora \gre@count@shiftaftermora=5 \def\gresetshiftaftermora#1{% - \IfStrEqCase{#1}{% - {always}% - {\gre@count@shiftaftermora=5}% - {notesonly}% - {\gre@count@shiftaftermora=4}% - {barsonly}% - {\gre@count@shiftaftermora=3}% - {barsnotextonly}% - {\gre@count@shiftaftermora=2}% - {barsinsideonly}% - {\gre@count@shiftaftermora=1}% - {never}% - {\gre@count@shiftaftermora=0}% - }[% all other cases - \gre@error{Unrecognized option "#1" in gresetshiftaftermora\MessageBreak Possible options are: 'always', 'barsonly', 'notesonly', 'barsnotextonly', 'barsinsideonly' and 'never'}% - ]% + \IfStrEqCase{#1}{% + {always}% + {\gre@count@shiftaftermora=5}% + {notesonly}% + {\gre@count@shiftaftermora=4}% + {barsonly}% + {\gre@count@shiftaftermora=3}% + {barsnotextonly}% + {\gre@count@shiftaftermora=2}% + {barsinsideonly}% + {\gre@count@shiftaftermora=1}% + {never}% + {\gre@count@shiftaftermora=0}% + }[% all other cases + \gre@error{Unrecognized option "#1" in gresetshiftaftermora\MessageBreak Possible options are: 'always', 'barsonly', 'notesonly', 'barsnotextonly', 'barsinsideonly' and 'never'}% + ]% }% % width of a punctum mora, reinitalized at each score @@ -1681,36 +1686,36 @@ % - 1 for the general case % - 2 when the punctum mora is before a bar \def\gre@get@unkern@aftermora#1{% - \ifdim\gre@dimen@morawidth=0pt\relax % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@fontchar@punctummora}% - \global\gre@dimen@morawidth=\wd\gre@box@temp@width % - \fi % - \ifnum #1=1% - \global\gre@skip@punctummorashift=\glueexpr - \gre@dimen@morawidth - \gre@space@skip@spacebeforesigns + \gre@space@skip@moraadjustment\relax % - \else % - \global\gre@skip@punctummorashift=\glueexpr - \gre@dimen@morawidth - \gre@space@skip@spacebeforesigns + \gre@space@skip@moraadjustmentbar\relax % - \fi % - \relax % + \ifdim\gre@dimen@morawidth=0pt\relax % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@fontchar@punctummora}% + \global\gre@dimen@morawidth=\wd\gre@box@temp@width % + \fi % + \ifnum #1=1% + \global\gre@skip@punctummorashift=\glueexpr - \gre@dimen@morawidth - \gre@space@skip@spacebeforesigns + \gre@space@skip@moraadjustment\relax % + \else % + \global\gre@skip@punctummorashift=\glueexpr - \gre@dimen@morawidth - \gre@space@skip@spacebeforesigns + \gre@space@skip@moraadjustmentbar\relax % + \fi % + \relax % } \def\gre@unkern@bar@aftermora{% - \ifgre@newbarspacing% - % don't apply a negative kern on the first glyph - % while boxing, otherwise the box width will be wrong - \ifgre@firstglyph % - \ifgre@boxing\else % - \gre@get@unkern@aftermora{2}% - \kern\gre@skip@punctummorashift % - \fi % - \else % - \gre@get@unkern@aftermora{2}% - \kern\gre@skip@punctummorashift % - \fi % - \else% - \gre@get@unkern@aftermora{2}% - \kern\gre@skip@punctummorashift % - \fi% - \relax % + \ifgre@newbarspacing% + % don't apply a negative kern on the first glyph + % while boxing, otherwise the box width will be wrong + \ifgre@firstglyph % + \ifgre@boxing\else % + \gre@get@unkern@aftermora{2}% + \kern\gre@skip@punctummorashift % + \fi % + \else % + \gre@get@unkern@aftermora{2}% + \kern\gre@skip@punctummorashift % + \fi % + \else% + \gre@get@unkern@aftermora{2}% + \kern\gre@skip@punctummorashift % + \fi% + \relax % } \newskip\gre@skip@bar@lastskip% skip after last bar @@ -1721,295 +1726,296 @@ %% 3: is 0 if there's no text under the bar or 1 if there is text under the bar %% 4: macros that may happen before the skip after the bar (typically GreVEpisema) \def\gre@writebar#1#2#3#4{% - % first, for the bar to be really centered, if the last glyph has a punctum - % mora, we kern of the corresponding space. We do it only in the case - % of a bar in the middle of other notes. - \ifgre@lastendswithmora % - \ifgre@newbarspacing % - \ifnum\gre@count@shiftaftermora=0\else\ifnum\gre@count@shiftaftermora=4\else % - % new bar spacing takes care of punctum mora on its own, but only when - % bar has its own syllable - \ifcase #2\or % - \gre@unkern@bar@aftermora % - \fi % - \fi\fi % - \else % - \ifcase\gre@count@shiftaftermora\or % - % barsinsideonly - \ifcase #2\or % - \gre@unkern@bar@aftermora % - \fi % - \or % - % barsnotextonly - \ifcase #3\relax % - \gre@unkern@bar@aftermora % - \fi % - \or % - % barsonly - \gre@unkern@bar@aftermora % - \or\or % - % always - \gre@unkern@bar@aftermora % - \fi % - \fi % - \fi % - \gre@newglyphcommon % - \gre@calculate@glyphraisevalue{\gre@pitch@bar}{0}{}% bar glyphs are made to be at this height - \GreNoBreak % - % count indicating if we have to output space or not: - \gre@count@temp@one=0\relax % - \ifnum#2=1\relax % - \gre@count@temp@one=1\relax % - \else % - \ifgre@newbarspacing % - \gre@count@temp@one=1\relax % - \fi % - \fi % - \gre@skip@temp@four=0pt\relax % - \ifcase#1 % 0 : virgula - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@virgula\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPVirgula}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPVirgula}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@virgula\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 1 : minima - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@minima\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMinima}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioMinima}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@minima\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 2 : minor - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@minor\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMinor}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioMinor}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@minor\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 3 : maior - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@maior\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMaior}% - \gre@fontchar@divisiomaior % - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@maior\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 4 : finalis - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@finalis\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@fontchar@divisiofinalis}% - #4\relax % - \gre@fontchar@divisiofinalis% - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@finalis\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 5 : final finalis - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@finalfinalis\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@fontchar@divisiofinalis}% - #4\relax % - \gre@fontchar@divisiofinalis% - \ifgre@newbarspacing % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@finalfinalis\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \or % 6 : dominican bar 1 - \gre@calculate@glyphraisevalue{\gre@pitch@e}{0}{}% - % we need to adjust the height of the bar a little so that it is perfectly aligned with the bottom (or the top for some bars) of the staff line, which is not the case by default if \gre@stafflinefactor is not 10. - \advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 7 : dominican bar 2 - \gre@calculate@glyphraisevalue{\gre@pitch@e}{0}{}% - \advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 8 : dominican bar 3 - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 9 : dominican bar 4 - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 10 : dominican bar 5 - \gre@calculate@glyphraisevalue{\gre@pitch@i}{0}{}% - \advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 11 : dominican bar 6 - \gre@calculate@glyphraisevalue{\gre@pitch@i}{0}{}% - \advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 12 : dominican bar 7 - \gre@calculate@glyphraisevalue{\gre@pitch@k}{0}{}% - \advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \or % 13 : dominican bar 8 - \gre@calculate@glyphraisevalue{\gre@pitch@k}{0}{}% - \advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% - \ifnum\gre@count@temp@one=1\relax % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \GreNoBreak % - \fi % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% - #4\relax % - \ifnum\gre@count@temp@one=1\relax % - \GreNoBreak % - \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% - \gre@hskip\gre@skip@temp@four % - \fi % - \fi % - \global\gre@skip@bar@lastskip=\gre@skip@temp@four % - \gre@debugmsg{spacing}{Width of bar just printed: \the\wd\gre@box@temp@width}% - \gre@debugmsg{spacing}{Last bar space: \the\gre@skip@temp@four}% - \global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % - \directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% - \relax% + % first, for the bar to be really centered, if the last glyph has a punctum + % mora, we kern of the corresponding space. We do it only in the case + % of a bar in the middle of other notes. + \ifgre@lastendswithmora % + \ifgre@newbarspacing % + \ifnum\gre@count@shiftaftermora=0\else\ifnum\gre@count@shiftaftermora=4\else % + % new bar spacing takes care of punctum mora on its own, but only when + % bar has its own syllable + \ifcase #2\or % + \gre@unkern@bar@aftermora % + \fi % + \fi\fi % + \else % + \ifcase\gre@count@shiftaftermora\or % + % barsinsideonly + \ifcase #2\or % + \gre@unkern@bar@aftermora % + \fi % + \or % + % barsnotextonly + \ifcase #3\relax % + \gre@unkern@bar@aftermora % + \fi % + \or % + % barsonly + \gre@unkern@bar@aftermora % + \or\or % + % always + \gre@unkern@bar@aftermora % + \fi % + \fi % + \fi % + \gre@newglyphcommon % + \gre@calculate@glyphraisevalue{\gre@pitch@bar}{0}{}% bar glyphs are made to be at this height + \GreNoBreak % + % count indicating if we have to output space or not: + \gre@count@temp@one=0\relax % + \ifnum#2=1\relax % + \gre@count@temp@one=1\relax % + \else % + \ifgre@newbarspacing % + \gre@count@temp@one=1\relax % + \fi % + \fi % + \gre@skip@temp@four=0pt\relax % + \ifcase#1 % 0 : virgula + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@virgula\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPVirgula}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPVirgula}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@virgula\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 1 : minima + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@minima\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMinima}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioMinima}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@minima\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 2 : minor + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@minor\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMinor}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioMinor}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@minor\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 3 : maior + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@maior\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMaior}% + \gre@fontchar@divisiomaior % + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@maior\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 4 : finalis + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@finalis\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@fontchar@divisiofinalis}% + #4\relax % + \gre@fontchar@divisiofinalis% + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@finalis\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 5 : final finalis + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@finalfinalis\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@fontchar@divisiofinalis}% + #4\relax % + \gre@fontchar@divisiofinalis% + \ifgre@newbarspacing % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@finalfinalis\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \or % 6 : dominican bar 1 + \gre@calculate@glyphraisevalue{\gre@pitch@e}{0}{}% + % we need to adjust the height of the bar a little so that it is perfectly aligned with the bottom (or the top for some bars) of the staff line, which is not the case by default if \gre@stafflinefactor is not 10. + \advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 7 : dominican bar 2 + \gre@calculate@glyphraisevalue{\gre@pitch@e}{0}{}% + \advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 8 : dominican bar 3 + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 9 : dominican bar 4 + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 10 : dominican bar 5 + \gre@calculate@glyphraisevalue{\gre@pitch@i}{0}{}% + \advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 11 : dominican bar 6 + \gre@calculate@glyphraisevalue{\gre@pitch@i}{0}{}% + \advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 12 : dominican bar 7 + \gre@calculate@glyphraisevalue{\gre@pitch@k}{0}{}% + \advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \or % 13 : dominican bar 8 + \gre@calculate@glyphraisevalue{\gre@pitch@k}{0}{}% + \advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% + \ifnum\gre@count@temp@one=1\relax % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \GreNoBreak % + \fi % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% + #4\relax % + \ifnum\gre@count@temp@one=1\relax % + \GreNoBreak % + \gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}\endcsname\relax% + \gre@hskip\gre@skip@temp@four % + \fi % + \fi % + \global\gre@skip@bar@lastskip=\gre@skip@temp@four % + \gre@debugmsg{spacing}{Width of bar just printed: \the\wd\gre@box@temp@width}% + \gre@debugmsg{spacing}{Last bar space: \the\gre@skip@temp@four}% + \global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % + \directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% + \global\gre@firstglyphfalse % + \relax% }% \def\gre@fontchar@divisiomaior{% - \ifnum\gre@stafflinefactor=17\relax % - %\gre@calculate@glyphraisevalue{\gre@pitch@bar}{0}{}% bar glyphs are made to be at this height - \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioMaior}% - \else % - \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMaior}% - % we calculate the raise of the bar - \gre@dimen@temp@five=\dimexpr(\gre@dimen@additionalbottomspace % - + \gre@space@dimen@spacebeneathtext % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@currenttranslationheight)\relax% - % we calculate the height of the bar - \raise\gre@dimen@temp@five\hbox{\vrule height \gre@dimen@staffheight width \wd\gre@box@temp@width}% - \fi % - \relax % + \ifnum\gre@stafflinefactor=17\relax % + %\gre@calculate@glyphraisevalue{\gre@pitch@bar}{0}{}% bar glyphs are made to be at this height + \raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioMaior}% + \else % + \setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMaior}% + % we calculate the raise of the bar + \gre@dimen@temp@five=\dimexpr(\gre@dimen@additionalbottomspace % + + \gre@space@dimen@spacebeneathtext % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@currenttranslationheight)\relax% + % we calculate the height of the bar + \raise\gre@dimen@temp@five\hbox{\vrule height \gre@dimen@staffheight width \wd\gre@box@temp@width}% + \fi % + \relax % }% \def\gre@fontchar@divisiofinalis{% - \gre@calculate@glyphraisevalue{\gre@pitch@bar}{0}{}% bar glyphs are made to be at this height - \gre@fontchar@divisiomaior % - \kern\gre@space@dimen@divisiofinalissep % - \GreNoBreak % - \gre@fontchar@divisiomaior % + \gre@calculate@glyphraisevalue{\gre@pitch@bar}{0}{}% bar glyphs are made to be at this height + \gre@fontchar@divisiomaior % + \kern\gre@space@dimen@divisiofinalissep % + \GreNoBreak % + \gre@fontchar@divisiomaior % }% % Flag to tell if we have to keep the localrightbox until the end @@ -2017,26 +2023,26 @@ %macro to end a line with a divisio finalis \def\GreFinalDivisioFinalis#1{% - \GreBarSyllable{\GreSetThisSyllable{}{}{}{}{}}{}{}{1}{\GreSetNextSyllable{}{}{}{}{}\GreLastOfLine}{}{16}{}{% - \ifgre@newbarspacing\else % - \gre@hskip\gre@space@skip@bar@finalfinalis % - \GreNoBreak % - \fi % - \GreLastOfScore % - \GreDivisioFinalis{0}{}% - #1% - }% - \relax% + \GreBarSyllable{\GreSetThisSyllable{}{}{}{}{}}{}{}{1}{\GreSetNextSyllable{}{}{}{}{}\GreLastOfLine}{}{16}{}{% + \ifgre@newbarspacing\else % + \gre@hskip\gre@space@skip@bar@finalfinalis % + \GreNoBreak % + \fi % + \GreLastOfScore % + \GreDivisioFinalis{0}{}% + #1% + }% + \relax% }% %macro to end a line with a divisio maior \def\GreFinalDivisioMaior#1{% - \GreBarSyllable{\GreSetThisSyllable{}{}{}{}{}}{}{}{1}{\GreSetNextSyllable{}{}{}{}{}\GreLastOfLine}{}{16}{}{% - \GreLastOfScore % - \GreDivisioMaior{0}{}% - #1% - }% - \relax% + \GreBarSyllable{\GreSetThisSyllable{}{}{}{}{}}{}{}{1}{\GreSetNextSyllable{}{}{}{}{}\GreLastOfLine}{}{16}{}{% + \GreLastOfScore % + \GreDivisioMaior{0}{}% + #1% + }% + \relax% }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2050,22 +2056,14 @@ % macro for manipulating above flag \def\gresetlinesbehindpunctumcavum#1{% - \IfStrEqCase{#1}{% - {visible}% - {\gre@hidepclinesfalse}% - {invisible}% - {\gre@hidepclinestrue}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetlinesbehindpunctumcavum\MessageBreak Possible options are: 'visible' and 'invisible'}% - ]% -}% - -\def\GreHidePCLines{%OBSOLETE - \gre@obsolete{\protect\GreHidePCLines}{\protect\gresetlinesbehindpunctumcavum{invisible}}% -}% - -\def\GreDontHidePCLines{%OBSOLETE - \gre@obsolete{\protect\GreDontHidePCLines}{\protect\gresetlinesbehindpunctumcavum{visible}}% + \IfStrEqCase{#1}{% + {visible}% + {\gre@hidepclinesfalse}% + {invisible}% + {\gre@hidepclinestrue}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetlinesbehindpunctumcavum\MessageBreak Possible options are: 'visible' and 'invisible'}% + ]% }% % flag to indicate that lines behind an alteration should be hidden @@ -2075,22 +2073,14 @@ % macro for manipulating above flag \def\gresetlinesbehindalteration#1{% - \IfStrEqCase{#1}{% - {visible}% - {\gre@hidealtlinesfalse}% - {invisible}% - {\gre@hidealtlinestrue}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetlinesbehindalteration\MessageBreak Possible options are: 'visible' and 'invisible'}% - ]% -}% - -\def\GreHideAltLines{%OBSOLETE - \gre@obsolete{\protect\GreHideAltLines}{\protect\gresetlinesbehindalteration{invisible}}% -}% - -\def\GreDontHideAltLines{%OBSOLETE - \gre@obsolete{\protect\GreDontHideAltLines}{\protect\gresetlinesbehindalteration{visible}}% + \IfStrEqCase{#1}{% + {visible}% + {\gre@hidealtlinesfalse}% + {invisible}% + {\gre@hidealtlinestrue}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetlinesbehindalteration\MessageBreak Possible options are: 'visible' and 'invisible'}% + ]% }% % is last glyph a cavum? @@ -2103,21 +2093,21 @@ % the argument is the character with which we fill the hole, and we suppose that % isonaline and glyphraisevalue are correctly set. \def\gre@fillhole#1{% - \ifgre@boxing\else % - \global\gre@count@lastglyphiscavum=1\relax % - \setbox\gre@box@temp@sign=\hbox{#1}% - \hbox to 0pt{% - {% - \color{grebackgroundcolor}% - \raise \gre@dimen@glyphraisevalue\relax% - \copy\gre@box@temp@sign % - }% - %\pdfliteral{}% this is a ugly hack for old versions of LuaTeX to work - \hss % - }% - \GreNoBreak % - \fi % - \relax % + \ifgre@boxing\else % + \global\gre@count@lastglyphiscavum=1\relax % + \setbox\gre@box@temp@sign=\hbox{#1}% + \hbox to 0pt{% + {% + \color{grebackgroundcolor}% + \raise \gre@dimen@glyphraisevalue\relax% + \copy\gre@box@temp@sign % + }% + %\pdfliteral{}% this is a ugly hack for old versions of LuaTeX to work + \hss % + }% + \GreNoBreak % + \fi % + \relax % }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2133,63 +2123,63 @@ % #6 are the signs to typeset after the glyph (almost all signs) % #7 is the line:char:column for a textedit link \def\gre@alteration#1#2#3#4#5#6#7{% - \setbox\gre@box@temp@width=\hbox{\gre@pointandclick{#2}{#7}}% - \ifnum#4=0\relax % - \gre@newglyphcommon % - \fi % - \global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % - % the three next lines are a trick to get the additional lines below the glyphs - \gre@skip@temp@one = \gre@dimen@lastglyphwidth\relax% - \kern\gre@skip@temp@one % - #5\relax % - \kern-\gre@skip@temp@one % - \gre@calculate@glyphraisevalue{#1}{0}{}% - \ifgre@hidealtlines % - \gre@fillhole{#3}% - \fi % - \raise \gre@dimen@glyphraisevalue\relax% - \copy\gre@box@temp@width% - #6\relax % - \ifnum#4=0\relax % - % we try to avoid line breaking after a flat or a natural - \GreNoBreak % - \gre@skip@temp@four = \gre@space@dimen@alterationspace\relax% - \ifgre@firstglyph% - \gre@debugmsg{bolshift}{making adjustments for leading alteration}% - \global\advance\gre@dimen@notesaligncenter by % - \dimexpr(\wd\gre@box@temp@width + \dimexpr\gre@skip@temp@four)\relax % - \kern\gre@skip@temp@four % - \global\gre@dimen@bolextra = \dimexpr(\wd\gre@box@temp@width + \dimexpr\gre@skip@temp@four)\relax% - \gre@debugmsg{bolshift}{bolextra: \the\gre@dimen@bolextra}% - \else % - \gre@hskip\gre@skip@temp@four % - \fi % - \GreNoBreak % - \directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% - \fi % - \relax % + \setbox\gre@box@temp@width=\hbox{\gre@pointandclick{#2}{#7}}% + \ifnum#4=0\relax % + \gre@newglyphcommon % + \fi % + \global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % + % the three next lines are a trick to get the additional lines below the glyphs + \gre@skip@temp@one = \gre@dimen@lastglyphwidth\relax% + \kern\gre@skip@temp@one % + #5\relax % + \kern-\gre@skip@temp@one % + \gre@calculate@glyphraisevalue{#1}{0}{}% + \ifgre@hidealtlines % + \gre@fillhole{#3}% + \fi % + \raise \gre@dimen@glyphraisevalue\relax% + \copy\gre@box@temp@width% + #6\relax % + \ifnum#4=0\relax % + % we try to avoid line breaking after a flat or a natural + \GreNoBreak % + \gre@skip@temp@four = \gre@space@dimen@alterationspace\relax% + \ifgre@firstglyph% + \gre@debugmsg{bolshift}{making adjustments for leading alteration}% + \global\advance\gre@dimen@notesaligncenter by % + \dimexpr(\wd\gre@box@temp@width + \dimexpr\gre@skip@temp@four)\relax % + \kern\gre@skip@temp@four % + \global\gre@dimen@bolextra = \dimexpr(\wd\gre@box@temp@width + \dimexpr\gre@skip@temp@four)\relax% + \gre@debugmsg{bolshift}{bolextra: \the\gre@dimen@bolextra}% + \else % + \gre@hskip\gre@skip@temp@four % + \fi % + \GreNoBreak % + \directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% + \fi % + \relax % }% % This macro typesets a flat on the height provided by #1. % #2 is 1 if the flat is part of a clef. \def\GreFlat#1#2#3#4#5{% - \gre@alteration{#1}{\gre@fontchar@flat}{\gre@fontchar@flathole}{#2}{#3}{#4}{#5}% - \relax% + \gre@alteration{#1}{\gre@fontchar@flat}{\gre@fontchar@flathole}{#2}{#3}{#4}{#5}% + \relax% }% % Same as the one before, but for naturals. \def\GreNatural#1#2#3#4#5{% - \gre@alteration{#1}{\gre@fontchar@natural}{\gre@fontchar@naturalhole}{#2}{#3}{#4}{#5}% - \relax% + \gre@alteration{#1}{\gre@fontchar@natural}{\gre@fontchar@naturalhole}{#2}{#3}{#4}{#5}% + \relax% }% % Same as the one before, but for sharps. \def\GreSharp#1#2#3#4#5{% - \gre@alteration{#1}{\gre@fontchar@sharp}{\gre@fontchar@sharphole}{#2}{#3}{#4}{#5}% - \relax% + \gre@alteration{#1}{\gre@fontchar@sharp}{\gre@fontchar@sharphole}{#2}{#3}{#4}{#5}% + \relax% }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2202,81 +2192,73 @@ \def\gre@fontchar@lineapunctumcavumhole{\gre@font@music\GreCPLineaPunctumCavumHole}% \def\gresetpunctumcavum#1{% - \IfStrEqCase{#1}{% - {alternate}% - {% - \grechangeglyph{PunctumCavum}{greciliae}{.caeciliae}% - \grechangeglyph{LineaPunctumCavum}{greciliae}{.caeciliae}% - \grechangeglyph{PunctumCavumHole}{greciliae}{.caeciliae}% - \grechangeglyph{LineaPunctumCavumHole}{greciliae}{.caeciliae}% - }% - {normal}% - {% - \greresetglyph{PunctumCavum}% - \greresetglyph{LineaPunctumCavum}% - \greresetglyph{PunctumCavumHole}% - \greresetglyph{LineaPunctumCavumHole}% - }% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetpunctumcavum\MessageBreak Possible options are: 'alternate' and 'normal'}% - ]% + \IfStrEqCase{#1}{% + {alternate}% + {% + \grechangeglyph{PunctumCavum}{greciliae}{.caeciliae}% + \grechangeglyph{LineaPunctumCavum}{greciliae}{.caeciliae}% + \grechangeglyph{PunctumCavumHole}{greciliae}{.caeciliae}% + \grechangeglyph{LineaPunctumCavumHole}{greciliae}{.caeciliae}% + }% + {normal}% + {% + \greresetglyph{PunctumCavum}% + \greresetglyph{LineaPunctumCavum}% + \greresetglyph{PunctumCavumHole}% + \greresetglyph{LineaPunctumCavumHole}% + }% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetpunctumcavum\MessageBreak Possible options are: 'alternate' and 'normal'}% + ]% }% -\def\UseAlternatePunctumCavum{%OBSOLETE - \gre@obsolete{\protect\UseAlternatePunctumCavum}{\protect\gresetpunctumcavum{alternate}}% -}% - -\def\UseNormalPunctumCavum{%OBSOLETE - \gre@obsolete{\protect\UseNormalPunctumCavum}{\protect\gresetpunctumcavum{normal}}% -}% - \def\gre@char@cavum#1#2#3#4#5#6#7#8{% - \setbox\gre@box@temp@width=\hbox{#7}% - \global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % - \gre@skip@temp@four = \gre@dimen@lastglyphwidth\relax% - \kern\gre@skip@temp@four % - #4\relax % - \kern-\gre@skip@temp@four % - \gre@calculate@glyphraisevalue{#1}{0}{}% - \ifgre@hidepclines% - \gre@fillhole{#8}% - \fi % - \GreGlyph{#7}{#1}{#2}{#3}{}{#5}{#6}% - %\relax % + \setbox\gre@box@temp@width=\hbox{#7}% + \global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % + \gre@skip@temp@four = \gre@dimen@lastglyphwidth\relax% + \kern\gre@skip@temp@four % + #4\relax % + \kern-\gre@skip@temp@four % + \gre@calculate@glyphraisevalue{#1}{0}{}% + \ifgre@hidepclines% + \gre@fillhole{#8}% + \fi % + \GreGlyph{#7}{#1}{#2}{#3}{}{#5}{#6}% + %\relax % }% \def\GrePunctumCavum#1#2#3#4#5#6{% - \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% - {\gre@fontchar@punctumcavum}{\gre@fontchar@punctumcavumhole}% + \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% + {\gre@fontchar@punctumcavum}{\gre@fontchar@punctumcavumhole}% }% \def\GreLineaPunctumCavum#1#2#3#4#5#6{% - \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% - {\gre@fontchar@lineapunctumcavum}{\gre@fontchar@lineapunctumcavumhole}% + \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% + {\gre@fontchar@lineapunctumcavum}{\gre@fontchar@lineapunctumcavumhole}% }% \def\GrePunctumCavumInclinatum#1#2#3#4#5#6{% - \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% - {\gre@font@music\GreCPPunctumCavumInclinatum}{\gre@font@music\GreCPPunctumCavumInclinatumHole}% + \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% + {\gre@font@music\GreCPPunctumCavumInclinatum}{\gre@font@music\GreCPPunctumCavumInclinatumHole}% }% \def\GrePunctumCavumInclinatumAuctus#1#2#3#4#5#6{% - \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% - {\gre@font@music\GreCPPunctumCavumInclinatumAuctus}{\gre@font@music\GreCPPunctumCavumInclinatumAuctusHole}% + \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% + {\gre@font@music\GreCPPunctumCavumInclinatumAuctus}{\gre@font@music\GreCPPunctumCavumInclinatumAuctusHole}% }% -\def\GreOriscusCavum#1#2#3#4#5#6{% - \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% - {\gre@font@music\GreCPOriscusCavum}{\gre@font@music\GreCPOriscusCavumHole}% +\def\GreAscendensOriscusCavum#1#2#3#4#5#6{% + \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% + {\gre@font@music\GreCPAscendensOriscusCavum}{\gre@font@music\GreCPAscendensOriscusCavumHole}% }% -\def\GreOriscusCavumAuctus#1#2#3#4#5#6{% - \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% - {\gre@font@music\GreCPOriscusCavumReversus}{\gre@font@music\GreCPOriscusCavumReversusHole}% +\def\GreDescendensOriscusCavum#1#2#3#4#5#6{% + \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% + {\gre@font@music\GreCPDescendensOriscusCavum}{\gre@font@music\GreCPDescendensOriscusCavumHole}% }% \def\GreOriscusCavumDeminutus#1#2#3#4#5#6{% - \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% - {\gre@font@music\GreCPOriscusCavumDeminutus}{\gre@font@music\GreCPOriscusCavumDeminutusHole}% + \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}% + {\gre@font@music\GreCPOriscusCavumDeminutus}{\gre@font@music\GreCPOriscusCavumDeminutusHole}% }% diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex index dab25f2208e..d46efe02a3a 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex @@ -20,7 +20,7 @@ % this file contains definitions of spaces \gre@debugmsg{general}{Loading gregoriotex-spaces.tex}% -\gre@declarefileversion{gregoriotex-spaces.tex}{4.1.1}% GREGORIO_VERSION +\gre@declarefileversion{gregoriotex-spaces.tex}{4.2.0-beta1}% GREGORIO_VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% macros for tuning penalties @@ -29,52 +29,65 @@ %% The following macros enable users to tune penalties used in Gregorio % macro to force a break on a new line -\def\GreForceBreak{\gre@penalty{\grenewlinepenalty}}% +\def\GreForceBreak{\gre@penalty{\the\gre@space@count@newlinepenalty}}% % macro to prevent a line break -\def\GreNoBreak{\gre@penalty{\grenobreakpenalty}}% +\def\GreNoBreak{\gre@penalty{\the\gre@space@count@nobreakpenalty}}% + +\newcount\gre@hyphenpenaltysave% +\newcount\gre@exhyphenpenaltysave% +\newcount\gre@doublehyphendemeritssave% +\newcount\gre@finalhyphendemeritssave% +\newcount\gre@brokenpenaltysave% +\newcount\gre@loosenesssave% +\newcount\gre@tolerancesave% +\newcount\gre@pretolerancesave% +\newskip\gre@emergencystretchsave% +\newcount\gre@widowpenaltysave% +\newcount\gre@clubpenaltysave% %% The following macros cancel some useless penalties, and reinstates them %% at the end of a score \def\gre@cancelpenalties{% - \xdef\gre@hyphenpenaltysave{\the\hyphenpenalty }% - \xdef\gre@exhyphenpenaltysave{\the\exhyphenpenalty }% - \xdef\gre@doublehyphendemeritssave{\the\doublehyphendemerits }% - \xdef\gre@finalhyphendemeritssave{\the\finalhyphendemerits }% - \xdef\gre@brokenpenaltysave{\the\brokenpenalty }% - \hyphenpenalty=\grehyphenpenalty\relax % - \exhyphenpenalty=\grehyphenpenalty\relax % - \doublehyphendemerits=0\relax % - \finalhyphendemerits=0\relax % - \brokenpenalty=\grebrokenpenalty\relax % - \xdef\gre@loosenesssave{\the\looseness}% - \xdef\gre@tolerancesave{\the\tolerance}% - \xdef\gre@pretolerancesave{\the\pretolerance}% - \xdef\gre@emergencystretchsave{\the\emergencystretch}% - \xdef\gre@widowpenaltysave{\the\widowpenalty}% - \xdef\gre@clubpenaltysave{\the\clubpenalty}% - \looseness=\grelooseness % - \tolerance=\gretolerance % - \pretolerance=\grepretolerance % - \emergencystretch=\greemergencystretch % - \widowpenalty=\grewidowpenalty % - \clubpenalty=\greclubpenalty % + \global\gre@hyphenpenaltysave=\hyphenpenalty\relax % + \global\gre@exhyphenpenaltysave=\exhyphenpenalty\relax % + \global\gre@doublehyphendemeritssave=\doublehyphendemerits\relax % + \global\gre@finalhyphendemeritssave=\finalhyphendemerits\relax % + \global\gre@brokenpenaltysave=\brokenpenalty\relax % + \global\gre@loosenesssave=\looseness\relax % + \global\gre@tolerancesave=\tolerance\relax % + \global\gre@pretolerancesave=\pretolerance\relax % + \global\gre@emergencystretchsave=\emergencystretch\relax % + \global\gre@widowpenaltysave=\widowpenalty\relax % + \global\gre@clubpenaltysave=\clubpenalty\relax % + % + \hyphenpenalty=\gre@space@count@hyphenpenalty % + \exhyphenpenalty=\gre@space@count@hyphenpenalty % + \doublehyphendemerits=0\relax % + \finalhyphendemerits=0\relax % + \brokenpenalty=\gre@space@count@brokenpenalty % + \looseness=\gre@space@count@looseness % + \tolerance=\gre@space@count@tolerance % + \pretolerance=\gre@space@count@pretolerance % + \emergencystretch=\gre@space@skip@emergencystretch\relax % + \widowpenalty=\gre@space@count@widowpenalty % + \clubpenalty=\gre@space@count@clubpenalty % }% \def\gre@restorepenalties{% - \hyphenpenalty=\gre@hyphenpenaltysave % - \exhyphenpenalty=\gre@exhyphenpenaltysave % - \doublehyphendemerits=\gre@doublehyphendemeritssave % - \finalhyphendemerits=\gre@finalhyphendemeritssave % - \brokenpenalty=\gre@brokenpenaltysave % - \looseness=\gre@loosenesssave % - \tolerance=\gre@tolerancesave % - \pretolerance=\gre@pretolerancesave % - \emergencystretch=\gre@emergencystretchsave % - \widowpenalty=\gre@widowpenaltysave % - \clubpenalty=\gre@clubpenaltysave % + \hyphenpenalty=\gre@hyphenpenaltysave % + \exhyphenpenalty=\gre@exhyphenpenaltysave % + \doublehyphendemerits=\gre@doublehyphendemeritssave % + \finalhyphendemerits=\gre@finalhyphendemeritssave % + \brokenpenalty=\gre@brokenpenaltysave % + \looseness=\gre@loosenesssave % + \tolerance=\gre@tolerancesave % + \pretolerance=\gre@pretolerancesave % + \emergencystretch=\gre@emergencystretchsave % + \widowpenalty=\gre@widowpenaltysave % + \clubpenalty=\gre@clubpenaltysave % }% @@ -91,21 +104,21 @@ % textlower is the height of the separation between the bottom line (which is invisible : for the notes which are very low) and the bottom of the text \newdimen\gre@dimen@textlower\relax% \def\gre@calculate@textlower{% - \gre@dimen@textlower=\gre@space@dimen@spacebeneathtext\relax% - %\advance\gre@dimen@textlower by \translationheight + \gre@dimen@textlower=\gre@space@dimen@spacebeneathtext\relax% + %\advance\gre@dimen@textlower by \translationheight }% % stafflinewidth is the width of a line of staff, this can vary, for example at the first line \newdimen\gre@dimen@stafflinewidth\relax% \def\gre@calculate@stafflinewidth{% - \gre@dimen@stafflinewidth=\gre@dimen@linewidth\relax% + \gre@dimen@stafflinewidth=\gre@dimen@linewidth\relax% }% % linewidth is the width of a line of a score (including the initial) \newdimen\gre@dimen@linewidth\relax% \def\gre@calculate@linewidth{% - \gre@dimen@linewidth=\hsize % + \gre@dimen@linewidth=\hsize % }% % Messing with the staff line thickness directly is messy, so we provide the following interface to make life easier on the user: @@ -113,27 +126,27 @@ % = 1500 * stafflinefactor \newdimen\gre@dimen@stafflineheight\relax% \def\gre@calculate@stafflineheight{% - \global\gre@dimen@stafflineheight=\dimexpr(1500 sp * \gre@stafflinefactor)\relax % + \global\gre@dimen@stafflineheight=\dimexpr(1500 sp * \gre@stafflinefactor)\relax % }% % interstafflinespace is the space between two lines of staff % = (30000 - (stafflineheight/gre@factor - 1500)) * gre@factor = 31500 * gre@factor - stafflineheight \newdimen\gre@dimen@interstafflinespace\relax% \def\gre@calculate@interstafflinespace{% - \global\gre@dimen@interstafflinespace=\dimexpr((31500sp * \gre@factor) % - - \gre@dimen@stafflineheight)\relax% + \global\gre@dimen@interstafflinespace=\dimexpr((31500sp * \gre@factor) % + - \gre@dimen@stafflineheight)\relax% }% % a distance to help place glyphs when the lines are not their default thickness % = (stafflineheight/gre@factor - 1500sp)/2 * gre@factor \newdimen\gre@dimen@stafflinediff\relax% \def\gre@calculate@stafflinediff{% - \global\gre@dimen@stafflinediff = \dimexpr(% - ( ( ( \gre@dimen@stafflineheight % - / \gre@factor)% - - 1500sp)% - / 2)% - * \gre@factor)\relax% + \global\gre@dimen@stafflinediff = \dimexpr(% + ( ( ( \gre@dimen@stafflineheight % + / \gre@factor)% + - 1500sp)% + / 2)% + * \gre@factor)\relax% }% % the default factor @@ -145,40 +158,37 @@ % a macro for setting the thickness of the staff lines. This changes the stafflinefactor and then adjusts the spaces that are affected by the thicker staff lines. \def\grechangestafflinethickness#1{% - \xdef\gre@stafflinefactor{#1}% - \relax % + \xdef\gre@stafflinefactor{#1}% + \relax % }% -\def\setstafflinethickness{%OBSOLETE - \gre@obsolete{\protect\setstafflinethickness}{\protect\grechangestafflinethickness}% -}% %constantglyphraise is the space between the 0 of the gregorian fonts and the effective 0 of the TeX score \newdimen\gre@dimen@constantglyphraise\relax% % to calculate that, we take the bottom of the third line : it is at 200 in the fonts, and it must be at grespacelinestext + grespacebeneathtext + 2*greinterstafflinespace + 2*grestafflineheight + translationheight \def\gre@calculate@constantglyphraise{% - \global\gre@dimen@constantglyphraise = \dimexpr((-22000 sp * \gre@factor) % - + \gre@dimen@additionalbottomspace % - + \gre@space@dimen@spacebeneathtext % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@interstafflinespace % - + \gre@dimen@interstafflinespace % - + \gre@dimen@stafflineheight % - + \gre@dimen@stafflineheight % - + \gre@dimen@currenttranslationheight % - % an adjustment in the case of big lines - + \gre@dimen@stafflinediff)\relax% - \relax % + \global\gre@dimen@constantglyphraise = \dimexpr((-22000 sp * \gre@factor) % + + \gre@dimen@additionalbottomspace % + + \gre@space@dimen@spacebeneathtext % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@interstafflinespace % + + \gre@dimen@interstafflinespace % + + \gre@dimen@stafflineheight % + + \gre@dimen@stafflineheight % + + \gre@dimen@currenttranslationheight % + % an adjustment in the case of big lines + + \gre@dimen@stafflinediff)\relax% + \relax % }% %% Here is the function to compute some more vertical spaces from the basic values \newdimen\gre@dimen@staffheight\relax% \def\gre@calculate@staffheight{% - \global\gre@dimen@staffheight = \dimexpr % - \gre@stafflines\gre@dimen@stafflineheight % - + \gre@stafflines\gre@dimen@interstafflinespace % - - \gre@dimen@interstafflinespace\relax% - \relax % + \global\gre@dimen@staffheight = \dimexpr % + \gre@stafflines\gre@dimen@stafflineheight % + + \gre@stafflines\gre@dimen@interstafflinespace % + - \gre@dimen@interstafflinespace\relax% + \relax % }% % A routine that simply aggregates the above global space calculating routines so we can easily update all when needed. @@ -193,14 +203,14 @@ %% staffheight: stafflineheight & interstafflinespace %% constantglyphraise: gre@factor, additionalbottomspace, spacebeneathtext, spacelinestext, interstafflinespace, stafflineheight, currenttranslationheight, stafflinediff \def\gre@computespaces{% - \gre@calculate@textlower% - \gre@calculate@linewidth% - \gre@calculate@stafflinewidth% - \gre@calculate@stafflineheight% - \gre@calculate@interstafflinespace% - \gre@calculate@stafflinediff% - \gre@calculate@staffheight% - \gre@calculate@constantglyphraise% + \gre@calculate@textlower% + \gre@calculate@linewidth% + \gre@calculate@stafflinewidth% + \gre@calculate@stafflineheight% + \gre@calculate@interstafflinespace% + \gre@calculate@stafflinediff% + \gre@calculate@staffheight% + \gre@calculate@constantglyphraise% }% \newskip\gre@skip@syllablefinalskip @@ -242,69 +252,69 @@ %% shift = max(min_shift_text, min_shift_notes) \def\gre@calculate@syllablefinalskip#1#2{% %% min_text_dist = prev_cur_word ? 0 : space_inter_words - \ifnum#1=1\relax % - \ifgre@in@euouae % - \ifgre@newbarspacing% - \ifnum#2=1\relax % - \gre@skip@minTextDistance=\gre@space@dimen@interwordspacetext@bars@euouae\relax% - \else % - \gre@skip@minTextDistance=\gre@space@skip@interwordspacetext@euouae\relax% - \fi % - \else% - \gre@skip@minTextDistance=\gre@space@skip@interwordspacetext@euouae\relax% - \fi% - \else % - \ifgre@newbarspacing% - \ifnum#2=1\relax % - \gre@skip@minTextDistance=\gre@space@dimen@interwordspacetext@bars\relax% - \else % - \gre@skip@minTextDistance=\gre@space@skip@interwordspacetext\relax% - \fi % - \else% - \gre@skip@minTextDistance=\gre@space@skip@interwordspacetext\relax% - \fi% - \fi % - \else % - \gre@skip@minTextDistance=0pt\relax% - \fi % - \gre@debugmsg{syllablespacing}{ minTextDistance = \the\gre@skip@minTextDistance}% - % setting minNotesDistance (quite simple) - \ifcase#2\relax % - \ifnum#1=1\relax % - \ifgre@in@euouae % - \gre@skip@minNotesDistance=\gre@space@skip@interwordspacenotes@euouae\relax% - \else % - \gre@skip@minNotesDistance=\gre@space@skip@interwordspacenotes\relax% - \fi % - \else % - \gre@skip@minNotesDistance=\gre@space@dimen@intersyllablespacenotes\relax% - \fi % - \ifnum\gre@count@shiftaftermora>3\relax % - \ifgre@thisendswithmora % - % last syllable ends by a punctum mora, we want to ignore it. - % this sets the distance to shift into \gre@skip@temp@four: - \gre@get@unkern@aftermora{1}% - \advance\gre@skip@minNotesDistance by \gre@skip@punctummorashift % - \fi % - \fi % - \or % - \ifgre@newbarspacing % - \gre@skip@minNotesDistance=0pt\relax% - \else % - \gre@skip@minNotesDistance=\gre@space@skip@notebarspace\relax% - \fi % - \or % - \ifnum#1=1\relax % - \gre@skip@minNotesDistance=\gre@space@skip@interwordspacenotes@alteration\relax % - \else % - \gre@skip@minNotesDistance=\gre@space@dimen@intersyllablespacenotes@alteration\relax% - \fi % - \fi % - \gre@debugmsg{syllablespacing}{ minNotesDistance = \the\gre@skip@minNotesDistance}% - % determining current distance between notes and - % next notes, and current distance between text and next text - \gre@dimen@curTextDistance=0pt\relax% - \gre@dimen@curNotesDistance=0pt\relax% + \ifnum#1=1\relax % + \ifgre@in@euouae % + \ifgre@newbarspacing% + \ifnum#2=1\relax % + \gre@skip@minTextDistance=\gre@space@dimen@interwordspacetext@bars@euouae\relax% + \else % + \gre@skip@minTextDistance=\gre@space@skip@interwordspacetext@euouae\relax% + \fi % + \else% + \gre@skip@minTextDistance=\gre@space@skip@interwordspacetext@euouae\relax% + \fi% + \else % + \ifgre@newbarspacing% + \ifnum#2=1\relax % + \gre@skip@minTextDistance=\gre@space@dimen@interwordspacetext@bars\relax% + \else % + \gre@skip@minTextDistance=\gre@space@skip@interwordspacetext\relax% + \fi % + \else% + \gre@skip@minTextDistance=\gre@space@skip@interwordspacetext\relax% + \fi% + \fi % + \else % + \gre@skip@minTextDistance=0pt\relax% + \fi % + \gre@debugmsg{syllablespacing}{ minTextDistance = \the\gre@skip@minTextDistance}% + % setting minNotesDistance (quite simple) + \ifcase#2\relax % + \ifnum#1=1\relax % + \ifgre@in@euouae % + \gre@skip@minNotesDistance=\gre@space@skip@interwordspacenotes@euouae\relax% + \else % + \gre@skip@minNotesDistance=\gre@space@skip@interwordspacenotes\relax% + \fi % + \else % + \gre@skip@minNotesDistance=\gre@space@dimen@intersyllablespacenotes\relax% + \fi % + \ifnum\gre@count@shiftaftermora>3\relax % + \ifgre@thisendswithmora % + % last syllable ends by a punctum mora, we want to ignore it. + % this sets the distance to shift into \gre@skip@temp@four: + \gre@get@unkern@aftermora{1}% + \advance\gre@skip@minNotesDistance by \gre@skip@punctummorashift % + \fi % + \fi % + \or % + \ifgre@newbarspacing % + \gre@skip@minNotesDistance=0pt\relax% + \else % + \gre@skip@minNotesDistance=\gre@space@skip@notebarspace\relax% + \fi % + \or % + \ifnum#1=1\relax % + \gre@skip@minNotesDistance=\gre@space@skip@interwordspacenotes@alteration\relax % + \else % + \gre@skip@minNotesDistance=\gre@space@dimen@intersyllablespacenotes@alteration\relax% + \fi % + \fi % + \gre@debugmsg{syllablespacing}{ minNotesDistance = \the\gre@skip@minNotesDistance}% + % determining current distance between notes and + % next notes, and current distance between text and next text + \gre@dimen@curTextDistance=0pt\relax% + \gre@dimen@curNotesDistance=0pt\relax% %% cur_dist_notes = cur_dist_text = 0 %% if (cur_end_diff < 0): %% cur_dist_notes += -cur_end_diff @@ -314,38 +324,38 @@ %% cur_dist_notes += -next_begin_diff %% else: %% cur_dist_text += next_begin_diff - \gre@debugmsg{syllablespacing}{ enddifference = \the\gre@dimen@enddifference}% - \gre@debugmsg{syllablespacing}{ nextbegindifference = \the\gre@skip@nextbegindifference}% - \ifdim\gre@dimen@enddifference < 0 pt\relax% - \gre@dimen@curNotesDistance = -\gre@dimen@enddifference\relax% - \else % - \gre@dimen@curTextDistance = \gre@dimen@enddifference\relax% - \fi % - \ifdim\gre@skip@nextbegindifference < 0 pt\relax% - \advance\gre@dimen@curNotesDistance by -\gre@skip@nextbegindifference\relax% - \else % - \advance\gre@dimen@curTextDistance by \gre@skip@nextbegindifference\relax% - \fi % - \gre@debugmsg{syllablespacing}{ curNotesDistance = \the\gre@dimen@curNotesDistance}% - \gre@debugmsg{syllablespacing}{ curTextDistance = \the\gre@dimen@curTextDistance}% + \gre@debugmsg{syllablespacing}{ enddifference = \the\gre@dimen@enddifference}% + \gre@debugmsg{syllablespacing}{ nextbegindifference = \the\gre@skip@nextbegindifference}% + \ifdim\gre@dimen@enddifference < 0 pt\relax% + \gre@dimen@curNotesDistance = -\gre@dimen@enddifference\relax% + \else % + \gre@dimen@curTextDistance = \gre@dimen@enddifference\relax% + \fi % + \ifdim\gre@skip@nextbegindifference < 0 pt\relax% + \advance\gre@dimen@curNotesDistance by -\gre@skip@nextbegindifference\relax% + \else % + \advance\gre@dimen@curTextDistance by \gre@skip@nextbegindifference\relax% + \fi % + \gre@debugmsg{syllablespacing}{ curNotesDistance = \the\gre@dimen@curNotesDistance}% + \gre@debugmsg{syllablespacing}{ curTextDistance = \the\gre@dimen@curTextDistance}% %% min_shift_text = min_dist_text - cur_dist_text %% min_shift_notes = min_dist_notes - cur_dist_notes %% shift = max(min_shift_text, min_shift_notes) - \gre@skip@minShiftText = \glueexpr(\gre@skip@minTextDistance - \gre@dimen@curTextDistance)\relax % - \gre@skip@minShiftNotes = \glueexpr(\gre@skip@minNotesDistance - \gre@dimen@curNotesDistance)\relax % - \gre@debugmsg{syllablespacing}{ minShiftNotes = \the\gre@skip@minShiftNotes}% - \gre@debugmsg{syllablespacing}{ minShiftText = \the\gre@skip@minShiftText}% - \ifdim\gre@skip@minShiftNotes < \gre@skip@minShiftText % - \global\gre@skip@syllablefinalskip = \gre@skip@minShiftText % - \else % - \global\gre@skip@syllablefinalskip = \gre@skip@minShiftNotes % - \fi % - \ifgre@showhyphenafterthissyllable % - \gre@debugmsg{syllablespacing}{ add intersyllablespacestretchhyphen (\gre@space@skip@intersyllablespacestretchhyphen)}% - \advance\gre@skip@syllablefinalskip by \gre@space@skip@intersyllablespacestretchhyphen\relax% - \fi % - \gre@debugmsg{syllablespacing}{ syllablefinalskip = \the\gre@skip@syllablefinalskip}% - \relax % + \gre@skip@minShiftText = \glueexpr(\gre@skip@minTextDistance - \gre@dimen@curTextDistance)\relax % + \gre@skip@minShiftNotes = \glueexpr(\gre@skip@minNotesDistance - \gre@dimen@curNotesDistance)\relax % + \gre@debugmsg{syllablespacing}{ minShiftNotes = \the\gre@skip@minShiftNotes}% + \gre@debugmsg{syllablespacing}{ minShiftText = \the\gre@skip@minShiftText}% + \ifdim\gre@skip@minShiftNotes < \gre@skip@minShiftText % + \global\gre@skip@syllablefinalskip = \gre@skip@minShiftText % + \else % + \global\gre@skip@syllablefinalskip = \gre@skip@minShiftNotes % + \fi % + \ifgre@showhyphenafterthissyllable % + \gre@debugmsg{syllablespacing}{ add intersyllablespacestretchhyphen (\gre@space@skip@intersyllablespacestretchhyphen)}% + \advance\gre@skip@syllablefinalskip by \gre@space@skip@intersyllablespacestretchhyphen\relax% + \fi % + \gre@debugmsg{syllablespacing}{ syllablefinalskip = \the\gre@skip@syllablefinalskip}% + \relax % } % dimen keeping the shift computed with next function @@ -360,38 +370,38 @@ %% %% @arg#1 \gre@dimen@begindifference of the first syllable of the line \def\gre@calculate@bolshift#1{% - \gre@skip@temp@three = 0pt\relax% - % bolextra is the space taken up by a leading alteration (it's 0 if there is no leading alteration) - % it's allowed to invade spaceafterlineclef, so long as it leaves at least beforealterationspace between itself and the clef - % and minimalspaceatlinebeginning between the lyrics and the beginning of the line - \gre@skip@temp@one = \glueexpr(\gre@space@skip@spaceafterlineclef-\gre@space@dimen@beforealterationspace)\relax% - \ifdim\gre@dimen@bolextra>\gre@skip@temp@one\relax% - \global\advance\gre@skip@temp@three by \gre@skip@temp@one\relax% - \else% - \global\advance\gre@skip@temp@three by \gre@dimen@bolextra\relax% - \fi% - \ifdim#1>0pt\relax% - % no additional shift is needed if the notes start before the text - \global\gre@dimen@bolshift = \gre@skip@temp@three\relax% - \else% - % as the \gre@dimen@bolshift is computed from skips, we compute it in - % a skip temp registry, and then "cast" it into a dimen - % basic value for bolshift needs to incorporate -begindifference - \advance\gre@skip@temp@three by -#1\relax% - % we don't want to kern more than clefwidth + spaceafterlineclef - minimalspaceatlinebeginning - % violating this would mean that either the notes are closer than (clefwidth + spaceafterlineclef) - % or that the lyrics are closer than minimalspaceatlinebeginning - \gre@skip@temp@one = \glueexpr(\gre@dimen@clefwidth % - + \gre@space@skip@spaceafterlineclef % - - \gre@space@dimen@minimalspaceatlinebeginning)\relax % - \ifdim\gre@skip@temp@three < \gre@skip@temp@one % - \global\gre@dimen@bolshift = \dimexpr\gre@skip@temp@three\relax % - \else% - \global\gre@dimen@bolshift = \dimexpr\gre@skip@temp@one\relax % - \fi % - \fi% - \gre@debugmsg{bolshift}{ bolshift = \the\gre@dimen@bolshift}% - \relax % + \gre@skip@temp@three = 0pt\relax% + % bolextra is the space taken up by a leading alteration (it's 0 if there is no leading alteration) + % it's allowed to invade spaceafterlineclef, so long as it leaves at least beforealterationspace between itself and the clef + % and minimalspaceatlinebeginning between the lyrics and the beginning of the line + \gre@skip@temp@one = \glueexpr(\gre@space@skip@spaceafterlineclef-\gre@space@dimen@beforealterationspace)\relax% + \ifdim\gre@dimen@bolextra>\gre@skip@temp@one\relax% + \global\advance\gre@skip@temp@three by \gre@skip@temp@one\relax% + \else% + \global\advance\gre@skip@temp@three by \gre@dimen@bolextra\relax% + \fi% + \ifdim#1>0pt\relax% + % no additional shift is needed if the notes start before the text + \global\gre@dimen@bolshift = \gre@skip@temp@three\relax% + \else% + % as the \gre@dimen@bolshift is computed from skips, we compute it in + % a skip temp registry, and then "cast" it into a dimen + % basic value for bolshift needs to incorporate -begindifference + \advance\gre@skip@temp@three by -#1\relax% + % we don't want to kern more than clefwidth + spaceafterlineclef - minimalspaceatlinebeginning + % violating this would mean that either the notes are closer than (clefwidth + spaceafterlineclef) + % or that the lyrics are closer than minimalspaceatlinebeginning + \gre@skip@temp@one = \glueexpr(\gre@dimen@clefwidth % + + \gre@space@skip@spaceafterlineclef % + - \gre@space@dimen@minimalspaceatlinebeginning)\relax % + \ifdim\gre@skip@temp@three < \gre@skip@temp@one % + \global\gre@dimen@bolshift = \dimexpr\gre@skip@temp@three\relax % + \else% + \global\gre@dimen@bolshift = \dimexpr\gre@skip@temp@one\relax % + \fi % + \fi% + \gre@debugmsg{bolshift}{ bolshift = \the\gre@dimen@bolshift}% + \relax % } % dimen keeping the shift computed with next function @@ -402,8 +412,8 @@ \gre@count@protrusion@hyphen@eol = 50\relax \def\gresethyphenprotrusion#1{% - \gre@count@protrusion@hyphen@eol = #1\relax % - \relax % + \gre@count@protrusion@hyphen@eol = #1\relax % + \relax % } %% @desc Macro used in \GreSyllable. Sets \gre@dimen@eolshift to the right kern @@ -412,41 +422,45 @@ %% %% @arg#1 The \gre@dimen@enddifference of the corresponding syllable \def\gre@calculate@eolshift#1{% - \gre@skip@temp@two=0pt\relax% - % we only need a shift if the lyrics are longer than the notes - \gre@debugmsg{eolshift}{eolshift called with enddifference: \the #1}% - \ifdim#1 <0pt\relax% - % we only need to shift if there is a custos being printed - \ifgre@blockeolcustos% - \gre@dimen@eolshift=0pt\relax% - \else% - % The basic value for the eol shift is -enddifference - \gre@skip@temp@two=-#1\relax% - % if there is a possible hyphen (added afterwards in lua), we keep some room for it - \ifgre@possibleluahyphenafterthissyllable % - \setbox\gre@box@temp@width=\hbox{\GreHyph}% - \advance\gre@skip@temp@two by -\dimexpr(\wd\gre@box@temp@width * ((100 - \gre@count@protrusion@hyphen@eol) / 100))\relax% - \gre@debugmsg{eolshift}{adjusted enddifference for protrusion: \the\gre@skip@temp@two}% - \fi % - % The maximum value is wd(custos) + spacebeforeeolcustos - % Were the eolshift larger than this the lyrics would stick out - % into the margin - \setbox\gre@box@temp@width=\hbox{\gre@pickcustos{\gre@pitch@g}}% - \gre@skip@temp@three = \glueexpr(\wd\gre@box@temp@width+\gre@space@skip@spacebeforeeolcustos)\relax% - \gre@debugmsg{eolshift}{custos + space before custos = \the\gre@skip@temp@three}% - % pick the smaller of the two values calculated above - \ifdim\gre@skip@temp@two>\gre@skip@temp@three% - \gre@debugmsg{eolshift}{imposing limit}% - \global\gre@dimen@eolshift = \gre@skip@temp@three% - \else% - \global\gre@dimen@eolshift = \gre@skip@temp@two% - \fi% - \fi % - \else% - \global\gre@dimen@eolshift=0pt\relax% - \fi % - \gre@debugmsg{eolshift}{eolshift: \the\gre@dimen@eolshift}% - \relax % + \gre@skip@temp@two=0pt\relax% + % we only need a shift if the lyrics are longer than the notes + \gre@debugmsg{eolshift}{eolshift called with enddifference: \the #1}% + \ifdim#1 <0pt\relax% + % we only need to shift if there is a custos being printed + \ifgre@blockeolcustos% + \gre@dimen@eolshift=0pt\relax% + \else% + % The basic value for the eol shift is -enddifference + \gre@skip@temp@two=-#1\relax% + % if there is a possible hyphen (added afterwards in lua), we keep some room for it + \ifgre@possibleluahyphenafterthissyllable % + \setbox\gre@box@temp@width=\hbox{\GreHyph}% + \advance\gre@skip@temp@two by -\dimexpr(\wd\gre@box@temp@width * ((100 - \gre@count@protrusion@hyphen@eol) / 100))\relax% + \gre@debugmsg{eolshift}{adjusted enddifference for protrusion: \the\gre@skip@temp@two}% + \fi % + % The maximum value is wd(custos) + spacebeforeeolcustos + % Were the eolshift larger than this the lyrics would stick out + % into the margin + \setbox\gre@box@temp@width=\hbox{\gre@pickcustos{\gre@pitch@g}{0}}% + \gre@skip@temp@three = \glueexpr(\wd\gre@box@temp@width+\gre@space@skip@spacebeforeeolcustos)\relax% + \gre@debugmsg{eolshift}{custos + space before custos = \the\gre@skip@temp@three}% + % pick the smaller of the two values calculated above + \ifdim\gre@skip@temp@two>\gre@skip@temp@three% + \gre@debugmsg{eolshift}{imposing limit}% + \global\gre@dimen@eolshift = \gre@skip@temp@three% + \else% + \global\gre@dimen@eolshift = \gre@skip@temp@two% + \fi% + \fi % + \else% + \global\gre@dimen@eolshift=0pt\relax% + \fi % + % if the notes are not visible, then there's no shifting allowed. + \ifgre@shownotes\else% + \global\gre@dimen@eolshift=0pt\relax% + \fi% + \gre@debugmsg{eolshift}{eolshift: \the\gre@dimen@eolshift}% + \relax % } %%%%%%%%%%%%%%%%%%% @@ -459,14 +473,14 @@ \newif\ifgre@useledgerlineheuristic% \gre@useledgerlineheuristictrue% \def\gresetledgerlineheuristic#1{% - \IfStrEqCase{#1}{% - {enable}% - {\gre@useledgerlineheuristictrue}% - {disable}% - {\gre@useledgerlineheuristicfalse}% - }[% all other cases - \gre@error{Unrecognized option "#1" in \protect\gresetledgerlineheuristic\MessageBreak Possible options are: 'enable' and 'disable'}% - ]% + \IfStrEqCase{#1}{% + {enable}% + {\gre@useledgerlineheuristictrue}% + {disable}% + {\gre@useledgerlineheuristicfalse}% + }[% all other cases + \gre@error{Unrecognized option "#1" in \protect\gresetledgerlineheuristic\MessageBreak Possible options are: 'enable' and 'disable'}% + ]% }% % for backwards compatibility, we set these to true by default, and the % system will set them appropriately if the heuristics determine a ledger @@ -474,20 +488,20 @@ \newif\ifgre@ledgerline@above% \newif\ifgre@ledgerline@below% \def\GreSupposeHighLedgerLine{% - \ifgre@useledgerlineheuristic\gre@ledgerline@abovetrue\fi % + \ifgre@useledgerlineheuristic\gre@ledgerline@abovetrue\fi % }% \def\GreSupposeLowLedgerLine{% - \ifgre@useledgerlineheuristic\gre@ledgerline@belowtrue\fi % + \ifgre@useledgerlineheuristic\gre@ledgerline@belowtrue\fi % }% \def\gre@resetledgerlineheuristics{% - \gre@ledgerline@abovetrue\gre@ledgerline@belowtrue % + \gre@ledgerline@abovetrue\gre@ledgerline@belowtrue % }% \def\gre@prephepisemaledgerlineheuristics{% - \ifgre@useledgerlineheuristic % - \gre@ledgerline@abovefalse\gre@ledgerline@belowfalse % - \else % - \gre@ledgerline@abovetrue\gre@ledgerline@belowtrue % - \fi % + \ifgre@useledgerlineheuristic % + \gre@ledgerline@abovefalse\gre@ledgerline@belowfalse % + \else % + \gre@ledgerline@abovetrue\gre@ledgerline@belowtrue % + \fi % }% % a very useful macro : it determines the good height of a glyph : the argument is the "number" where the glyph should be : 4 for the first line, 6 for the second, etc. @@ -516,183 +530,183 @@ %% 4: low in space below note %% 5: high in space below note \def\gre@calculate@glyphraisevalue#1#2#3{% - \global\gre@isonalinefalse% - \ifcase#1% - % the first two cases are special cases for episemae on the lowest note - \or\gre@count@temp@three=\number 0% - \or\gre@count@temp@three=\number 1% - \or\gre@count@temp@three=\number 2% - \or\gre@count@temp@three=\number 3% - \ifgre@ledgerline@below % - \ifnum#2=3\relax % - \else % - % if it is a vertical episema, we don't care if it is on a line or - % not... which may cause some problems... - \global\gre@isonalinetrue % - \fi % - \fi % - \or\gre@count@temp@three=\number 4% - \or\gre@count@temp@three=\number 5% - \global\gre@isonalinetrue% - \or\gre@count@temp@three=\number 6% - \or\gre@count@temp@three=\number 7% - \global\gre@isonalinetrue% - \or\gre@count@temp@three=\number 8% - \or\gre@count@temp@three=\number 9% - \ifgre@haslinethree % - \global\gre@isonalinetrue% - \else % - \ifgre@ledgerline@above % - \global\gre@isonalinetrue% - \fi % - \fi % - \or\gre@count@temp@three=\number 10% - \or\gre@count@temp@three=\number 11% - \ifgre@haslinefour % - \global\gre@isonalinetrue% - \else % - \ifgre@haslinethree % - \ifgre@ledgerline@above % - \global\gre@isonalinetrue% - \fi % - \fi % - \fi % - \or\gre@count@temp@three=\number 12% - \or\gre@count@temp@three=\number 13% - \ifgre@haslinefive % - \global\gre@isonalinetrue% - \else % - \ifgre@haslinefour % - \ifgre@ledgerline@above % - \global\gre@isonalinetrue% - \fi % - \fi % - \fi % - \or\gre@count@temp@three=\number 14% - \or\gre@count@temp@three=\number 15% - \ifgre@haslinefive % - \ifgre@ledgerline@above % - \global\gre@isonalinetrue% - \fi % - \fi % - \or\gre@count@temp@three=\number 16% - \or\gre@count@temp@three=\number 17% - \or\gre@count@temp@three=\number 18% - \or\gre@count@temp@three=\number 19% - \or\gre@count@temp@three=\number 20% - \fi% - % if there is not line... we don't consider notes are on lines - \ifgre@showlines\else % - \global\gre@isonalinefalse % - \fi % - % if the note is on a line, we change its height if necessary - \ifgre@isonaline% - \ifcase#2 % - \or% 1 - \global\advance\gre@count@temp@three by 1% - \or% 2 - \global\advance\gre@count@temp@three by -1% - \or% 3 - \global\advance\gre@count@temp@three by -1% - \or% 4 - \global\advance\gre@count@temp@three by 1% - \or% 5 - \global\advance\gre@count@temp@three by -1% - \or\or\or% 8 - \global\advance\gre@count@temp@three by -1% - \or% 9 - \global\advance\gre@count@temp@three by 1% - \or% 10 - \global\advance\gre@count@temp@three by 1% - \or% 11 - \global\advance\gre@count@temp@three by 1% - \or% 12 - \global\advance\gre@count@temp@three by -1% - \fi% - \fi% - \global\advance\gre@count@temp@three by -8 % - \global\gre@dimen@glyphraisevalue = \dimexpr(15750 sp * \gre@factor * \gre@count@temp@three)\relax % - \ifcase#2 % - \or\or\or%3: if it is a vertical episema on a line, we shift it a bit higher, so that it's more beautiful - \ifgre@isonaline% - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@vepisemahighshift\relax % - \else % if it is not on a line, we shift it a bit lower - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@vepisemalowshift\relax % - \fi % - \or% 4: if it is a punctum mora on a line, we shift it a bit lower, for the same reason - \ifgre@isonaline% - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@linepunctummorashift\relax % - \else % - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@spacepunctummorashift\relax % - \fi% - \or% 5: if it is a horizontal episema under a note which is on a line, we shift it lower - \ifcase#3\relax % 0 - auto - \ifgre@isonaline% if it is under a note between two lines, we shift it higher - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemahighshift\relax % - \else % - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemalowshift\relax % - \fi % - \or % 1 - middle - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@hepisemamiddleshift\relax % - \or % 2 - over-low - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemalowshift\relax % - \or % 3 - over-high - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemahighshift\relax % - \or % 4 - under-low - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemalowshift\relax % - \or % 5 - under-high - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemahighshift\relax % - \fi % - \or% 6: if it is a sign, we put it at an arbitrary height - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@raresignshift\relax % - \or\or% 8: if it is a punctum mora on a line, we shift it a bit lower, for the same reason - \ifgre@isonaline% - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@lineporrectuspunctummorashift\relax % - \else % - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@spaceporrectuspunctummorashift\relax % - \fi % - \or% 9: if it is an horizontal episema not on a line, we put it a bit lower - \ifcase#3\relax % 0 - auto - \ifgre@isonaline% - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemalowshift\relax % - \else % - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemahighshift\relax % - \fi % - \or % 1 - middle - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@hepisemamiddleshift\relax % - \or % 2 - over-low - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemalowshift\relax % - \or % 3 - over-high - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemahighshift\relax % - \or % 4 - under-low - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemalowshift\relax % - \or % 5 - under-high - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemahighshift\relax % - \fi % - \or% 10: low choral sign that is not lower than the note - \global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@choralsigndownshift\relax% - \or% 11: high choral sign - \ifgre@isonaline% - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@choralsignupshift\relax% - \else % - \global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@choralsigndownshift\relax% - \fi % - \or% 12: low choral sign that is lower than the note - \ifgre@isonaline% - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@choralsignupshift\relax% - \else % - \global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@choralsigndownshift\relax% - \fi % - \or% 13: if it is the brace above the bars, we shift it to a user-defined value - \global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@braceshift\relax% - \or% 14: raise the punctum mora in a space a bit higher than case 4 - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@spaceamonepespunctummorashift\relax% - \or% 15: over slur - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overslurshift\relax% - \or% 16: under slur - \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underslurshift\relax% - \fi% - \global\advance\gre@dimen@glyphraisevalue by \the\gre@dimen@constantglyphraise\relax% + \global\gre@isonalinefalse% + \ifcase#1% + % the first two cases are special cases for episemae on the lowest note + \or\gre@count@temp@three=\number 0% + \or\gre@count@temp@three=\number 1% + \or\gre@count@temp@three=\number 2% + \or\gre@count@temp@three=\number 3% + \ifgre@ledgerline@below % + \ifnum#2=3\relax % + \else % + % if it is a vertical episema, we don't care if it is on a line or + % not... which may cause some problems... + \global\gre@isonalinetrue % + \fi % + \fi % + \or\gre@count@temp@three=\number 4% + \or\gre@count@temp@three=\number 5% + \global\gre@isonalinetrue% + \or\gre@count@temp@three=\number 6% + \or\gre@count@temp@three=\number 7% + \global\gre@isonalinetrue% + \or\gre@count@temp@three=\number 8% + \or\gre@count@temp@three=\number 9% + \ifgre@haslinethree % + \global\gre@isonalinetrue% + \else % + \ifgre@ledgerline@above % + \global\gre@isonalinetrue% + \fi % + \fi % + \or\gre@count@temp@three=\number 10% + \or\gre@count@temp@three=\number 11% + \ifgre@haslinefour % + \global\gre@isonalinetrue% + \else % + \ifgre@haslinethree % + \ifgre@ledgerline@above % + \global\gre@isonalinetrue% + \fi % + \fi % + \fi % + \or\gre@count@temp@three=\number 12% + \or\gre@count@temp@three=\number 13% + \ifgre@haslinefive % + \global\gre@isonalinetrue% + \else % + \ifgre@haslinefour % + \ifgre@ledgerline@above % + \global\gre@isonalinetrue% + \fi % + \fi % + \fi % + \or\gre@count@temp@three=\number 14% + \or\gre@count@temp@three=\number 15% + \ifgre@haslinefive % + \ifgre@ledgerline@above % + \global\gre@isonalinetrue% + \fi % + \fi % + \or\gre@count@temp@three=\number 16% + \or\gre@count@temp@three=\number 17% + \or\gre@count@temp@three=\number 18% + \or\gre@count@temp@three=\number 19% + \or\gre@count@temp@three=\number 20% + \fi% + % if there is not line... we don't consider notes are on lines + \ifgre@showlines\else % + \global\gre@isonalinefalse % + \fi % + % if the note is on a line, we change its height if necessary + \ifgre@isonaline% + \ifcase#2 % + \or% 1 + \global\advance\gre@count@temp@three by 1% + \or% 2 + \global\advance\gre@count@temp@three by -1% + \or% 3 + \global\advance\gre@count@temp@three by -1% + \or% 4 + \global\advance\gre@count@temp@three by 1% + \or% 5 + \global\advance\gre@count@temp@three by -1% + \or\or\or% 8 + \global\advance\gre@count@temp@three by -1% + \or% 9 + \global\advance\gre@count@temp@three by 1% + \or% 10 + \global\advance\gre@count@temp@three by 1% + \or% 11 + \global\advance\gre@count@temp@three by 1% + \or% 12 + \global\advance\gre@count@temp@three by -1% + \fi% + \fi% + \global\advance\gre@count@temp@three by -8 % + \global\gre@dimen@glyphraisevalue = \dimexpr(15750 sp * \gre@factor * \gre@count@temp@three)\relax % + \ifcase#2 % + \or\or\or%3: if it is a vertical episema on a line, we shift it a bit higher, so that it's more beautiful + \ifgre@isonaline% + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@vepisemahighshift\relax % + \else % if it is not on a line, we shift it a bit lower + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@vepisemalowshift\relax % + \fi % + \or% 4: if it is a punctum mora on a line, we shift it a bit lower, for the same reason + \ifgre@isonaline% + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@linepunctummorashift\relax % + \else % + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@spacepunctummorashift\relax % + \fi% + \or% 5: if it is a horizontal episema under a note which is on a line, we shift it lower + \ifcase#3\relax % 0 - auto + \ifgre@isonaline% if it is under a note between two lines, we shift it higher + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemahighshift\relax % + \else % + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemalowshift\relax % + \fi % + \or % 1 - middle + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@hepisemamiddleshift\relax % + \or % 2 - over-low + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemalowshift\relax % + \or % 3 - over-high + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemahighshift\relax % + \or % 4 - under-low + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemalowshift\relax % + \or % 5 - under-high + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemahighshift\relax % + \fi % + \or% 6: if it is a sign, we put it at an arbitrary height + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@raresignshift\relax % + \or\or% 8: if it is a punctum mora on a line, we shift it a bit lower, for the same reason + \ifgre@isonaline% + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@lineporrectuspunctummorashift\relax % + \else % + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@spaceporrectuspunctummorashift\relax % + \fi % + \or% 9: if it is an horizontal episema not on a line, we put it a bit lower + \ifcase#3\relax % 0 - auto + \ifgre@isonaline% + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemalowshift\relax % + \else % + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemahighshift\relax % + \fi % + \or % 1 - middle + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@hepisemamiddleshift\relax % + \or % 2 - over-low + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemalowshift\relax % + \or % 3 - over-high + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemahighshift\relax % + \or % 4 - under-low + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemalowshift\relax % + \or % 5 - under-high + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemahighshift\relax % + \fi % + \or% 10: low choral sign that is not lower than the note + \global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@choralsigndownshift\relax% + \or% 11: high choral sign + \ifgre@isonaline% + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@choralsignupshift\relax% + \else % + \global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@choralsigndownshift\relax% + \fi % + \or% 12: low choral sign that is lower than the note + \ifgre@isonaline% + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@choralsignupshift\relax% + \else % + \global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@choralsigndownshift\relax% + \fi % + \or% 13: if it is the brace above the bars, we shift it to a user-defined value + \global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@braceshift\relax% + \or% 14: raise the punctum mora in a space a bit higher than case 4 + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@spaceamonepespunctummorashift\relax% + \or% 15: over slur + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overslurshift\relax% + \or% 16: under slur + \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underslurshift\relax% + \fi% + \global\advance\gre@dimen@glyphraisevalue by \the\gre@dimen@constantglyphraise\relax% }% % two dimensions for the additionalspaces @@ -713,38 +727,38 @@ % #3 is 1 if there is a translation somewhere % #4 is if 1 if we have space above the staff \def\gre@calculate@additionalspaces#1#2#3#4{% - \gre@debugmsg{lineheight}{gre@calculate@additional@spaces called with #1 #2 #3 #4}% - \gre@count@temp@one=\numexpr(#1 - \gre@pitch@adjust@top - \gre@space@count@additionaltopspacethreshold)\relax % - \ifnum\gre@count@temp@one>0\relax % - \global\gre@dimen@additionaltopspace=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax % - \else % - \global\gre@dimen@additionaltopspace=0 sp% - \fi % - \gre@count@temp@one=\numexpr(#1 - \gre@pitch@adjust@top - \gre@space@count@additionaltopspacealtthreshold)\relax % - \ifnum\gre@count@temp@one>0\relax % - \global\gre@dimen@additionaltopspacealt=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax % - \else % - \global\gre@dimen@additionaltopspacealt=0 sp% - \fi % - \gre@count@temp@one=\numexpr((#2 - \gre@pitch@adjust@bottom) * -1)\relax % - \ifnum\gre@count@temp@one>0\relax % - \global\gre@dimen@additionalbottomspace=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax % - \else % - \global\gre@dimen@additionalbottomspace=0 sp% - \fi % - \ifnum#3 = 1\relax % - \gre@addtranslationspace % - \else % - \gre@removetranslationspace % - \fi % - \ifnum#4 = 1\relax % - \gre@addspaceabove % - \else % - \gre@removespaceabove % - \fi % - \gre@generatelines % - \gre@calculate@constantglyphraise % - \relax % + \gre@debugmsg{lineheight}{gre@calculate@additional@spaces called with #1 #2 #3 #4}% + \gre@count@temp@one=\numexpr(#1 - \gre@pitch@adjust@top - \gre@space@count@additionaltopspacethreshold)\relax % + \ifnum\gre@count@temp@one>0\relax % + \global\gre@dimen@additionaltopspace=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax % + \else % + \global\gre@dimen@additionaltopspace=0 sp% + \fi % + \gre@count@temp@one=\numexpr(#1 - \gre@pitch@adjust@top - \gre@space@count@additionaltopspacealtthreshold)\relax % + \ifnum\gre@count@temp@one>0\relax % + \global\gre@dimen@additionaltopspacealt=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax % + \else % + \global\gre@dimen@additionaltopspacealt=0 sp% + \fi % + \gre@count@temp@one=\numexpr((#2 - \gre@pitch@adjust@bottom) * -1)\relax % + \ifnum\gre@count@temp@one>0\relax % + \global\gre@dimen@additionalbottomspace=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax % + \else % + \global\gre@dimen@additionalbottomspace=0 sp% + \fi % + \ifnum#3 = 1\relax % + \gre@addtranslationspace % + \else % + \gre@removetranslationspace % + \fi % + \ifnum#4 = 1\relax % + \gre@addspaceabove % + \else % + \gre@removespaceabove % + \fi % + \gre@generatelines % + \gre@calculate@constantglyphraise % + \relax % }% %% macro that typesets the text of the syllable, and sets textaligncenter to the middle of the middle letters, it is needed because we align the note (often the middle of the note) with the middle of the middle letters @@ -755,20 +769,20 @@ \newdimen\gre@dimen@textaligncenter\relax% \def\gre@calculate@textaligncenter#1#2#3{% - \ifnum#3=0\relax% - \gre@widthof{\gre@fixedtextformat{#1#2}}% - \else % - \gre@widthof{\gre@fixednexttextformat{#1#2}}% - \fi % - \global\gre@dimen@textaligncenter=\the\gre@dimen@temp@three % - \ifnum#3=0\relax% - \gre@widthof{\gre@fixedtextformat{#2}}% - \else % - \gre@widthof{\gre@fixednexttextformat{#2}}% - \fi % - \divide\gre@dimen@temp@three by 2 % - \global\advance\gre@dimen@textaligncenter by -\the\gre@dimen@temp@three% - \relax% + \ifnum#3=0\relax% + \gre@widthof{\gre@fixedtextformat{#1#2}}% + \else % + \gre@widthof{\gre@fixednexttextformat{#1#2}}% + \fi % + \global\gre@dimen@textaligncenter=\the\gre@dimen@temp@three % + \ifnum#3=0\relax% + \gre@widthof{\gre@fixedtextformat{#2}}% + \else % + \gre@widthof{\gre@fixednexttextformat{#2}}% + \fi % + \divide\gre@dimen@temp@three by 2 % + \global\advance\gre@dimen@textaligncenter by -\the\gre@dimen@temp@three% + \relax% }% % a dimen that will contain the difference between the end of the text and the end of the notes for the previous syllable (if we are in the same word) : positive if notes go further than text. We will use it for space adjustment between syllables of the same word @@ -786,11 +800,11 @@ % #4: notesaligncenter (defined above too) % #5: if we have to set previousenddifference or not \def\gre@calculate@enddifference#1#2#3#4#5{% - \ifcase#5\or % - \global\gre@dimen@previousenddifference=\the\gre@dimen@enddifference\relax% - \fi % - \global\gre@dimen@enddifference=\dimexpr(#1 - #2 + #3 - #4)\relax% - \relax% + \ifcase#5\or % + \global\gre@dimen@previousenddifference=\the\gre@dimen@enddifference\relax% + \fi % + \global\gre@dimen@enddifference=\dimexpr(#1 - #2 + #3 - #4)\relax% + \relax% }% % temporary value for space for the translation, beneath the text @@ -798,26 +812,22 @@ % macro to tell gregorio to set space for the translation \def\gre@addtranslationspace{% - \gre@style@translation% - \global\gre@dimen@currenttranslationheight=\gre@space@dimen@translationheight\relax% - \global\gre@dimen@textlower=\dimexpr(\gre@space@dimen@spacebeneathtext % - + \gre@space@dimen@translationheight)\relax% - \gre@generatelines % - \gre@calculate@constantglyphraise % - \endgre@style@translation% - \ifx\gre@empty@translationformat\gretranslationformat% OBSOLETE - \else% OBSOLETE - \gre@obsolete{\protect\gretranslationformat}{\protect\grechangestyle{translation}}% OBSOLETE - \fi% OBSOLETE - \relax % + \gre@style@translation% + \global\gre@dimen@currenttranslationheight=\gre@space@dimen@translationheight\relax% + \global\gre@dimen@textlower=\dimexpr(\gre@space@dimen@spacebeneathtext % + + \gre@space@dimen@translationheight)\relax% + \gre@generatelines % + \gre@calculate@constantglyphraise % + \endgre@style@translation% + \relax % }% \def\gre@removetranslationspace{% - \global\gre@dimen@currenttranslationheight=0 sp% - \global\gre@dimen@textlower=\gre@space@dimen@spacebeneathtext\relax% - \gre@generatelines % - \gre@calculate@constantglyphraise % - \relax % + \global\gre@dimen@currenttranslationheight=0 sp% + \global\gre@dimen@textlower=\gre@space@dimen@spacebeneathtext\relax% + \gre@generatelines % + \gre@calculate@constantglyphraise % + \relax % }% %nextbegindifference is the begindifference of the next syllable @@ -829,20 +839,20 @@ %% 3 : the end letters of the next syllable %% 4 : the type of notes alignment \def\gre@calculate@nextbegindifference#1#2#3#4{% - \ifnum\gre@lastoflinecount=1\relax % - \global\gre@skip@nextbegindifference=0pt\relax% - \else % - %to prevent the pollution of the normal values, we stock them into a temp value - \gre@dimen@temp@two=\gre@dimen@textaligncenter\relax% - \gre@calculate@textaligncenter{#1}{#2}{1}% - \global\gre@skip@nextbegindifference=-\gre@dimen@textaligncenter\relax% - \global\gre@dimen@textaligncenter=\gre@dimen@temp@two % - \gre@dimen@temp@two=\gre@dimen@notesaligncenter\relax% - \gre@calculate@nextnotesaligncenter{#4}% idem - \global\advance\gre@skip@nextbegindifference by \the\gre@dimen@notesaligncenter\relax% - \global\gre@dimen@notesaligncenter=\gre@dimen@temp@two % - \fi % - \relax % + \ifnum\gre@lastoflinecount=1\relax % + \global\gre@skip@nextbegindifference=0pt\relax% + \else % + %to prevent the pollution of the normal values, we stock them into a temp value + \gre@dimen@temp@two=\gre@dimen@textaligncenter\relax% + \gre@calculate@textaligncenter{#1}{#2}{1}% + \global\gre@skip@nextbegindifference=-\gre@dimen@textaligncenter\relax% + \global\gre@dimen@textaligncenter=\gre@dimen@temp@two % + \gre@dimen@temp@two=\gre@dimen@notesaligncenter\relax% + \gre@calculate@nextnotesaligncenter{#4}% idem + \global\advance\gre@skip@nextbegindifference by \the\gre@dimen@notesaligncenter\relax% + \global\gre@dimen@notesaligncenter=\gre@dimen@temp@two % + \fi % + \relax % }% %The distance from the baseline of the line to the baseline of the annotations @@ -850,34 +860,34 @@ % When text is placed in the annotation boxes these dimensions are initialized with values based on the contents and the user parameters %This function sets the true raises of the two lines above the initial (it has to be called just as the boxes are placed in order to make sure that the values are all correct) \def\gre@calculate@annotationtrueraise{% - \gre@debugmsg{annotation}{Calculating the raise.}% - \global\advance\gre@dimen@annotationtrueraise by % - \dimexpr(\gre@dimen@staffheight % - + \gre@space@dimen@spacebeneathtext % - + \gre@dimen@currenttranslationheight % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@additionalbottomspace)\relax% - \gre@style@annotation% - \global\advance\gre@dimen@annotationtrueraise by \gre@space@dimen@annotationraise\relax% - \gre@debugmsg{annnotation}{Added user raise.}% - \endgre@style@annotation% - \relax % + \gre@debugmsg{annotation}{Calculating the raise.}% + \global\advance\gre@dimen@annotationtrueraise by % + \dimexpr(\gre@dimen@staffheight % + + \gre@space@dimen@spacebeneathtext % + + \gre@dimen@currenttranslationheight % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@additionalbottomspace)\relax% + \gre@style@annotation% + \global\advance\gre@dimen@annotationtrueraise by \gre@space@dimen@annotationraise\relax% + \gre@debugmsg{annnotation}{Added user raise.}% + \endgre@style@annotation% + \relax % }% %The distance from the baseline of the line to the baseline of the commentary \newdimen\gre@dimen@commentarytrueraise\relax% %This function sets the true raises of the commentary (it has to be called just as the boxes are placed in order to make sure that the values are all correct) \def\gre@calculate@commentarytrueraise{% - \gre@style@commentary% - \gre@debugmsg{commentary}{Calculating the raise.}% - \global\advance\gre@dimen@commentarytrueraise by % - \dimexpr(\gre@dimen@staffheight % - + \gre@space@dimen@spacebeneathtext % - + \gre@dimen@currenttranslationheight % - + \gre@space@dimen@spacelinestext % - + \gre@dimen@additionalbottomspace % - + \gre@space@dimen@commentaryraise)\relax% - \endgre@style@commentary% + \gre@style@commentary% + \gre@debugmsg{commentary}{Calculating the raise.}% + \global\advance\gre@dimen@commentarytrueraise by % + \dimexpr(\gre@dimen@staffheight % + + \gre@space@dimen@spacebeneathtext % + + \gre@dimen@currenttranslationheight % + + \gre@space@dimen@spacelinestext % + + \gre@dimen@additionalbottomspace % + + \gre@space@dimen@commentaryraise)\relax% + \endgre@style@commentary% }% % spaces for new bar positioning algorithm @@ -897,227 +907,227 @@ % #1 is #4 from \GreBarSyllable (1 if bar is end of word, 0 if not) % #2 is #7 from \GreBarSyllable (alignment type of first next glyph) \def\gre@calculate@barposition#1#2{% - % we start by finding the distance between the text and notes of the previous and the next syllable (as if this syllable didn't exist, for the moment) - \gre@debugmsg{barspacing}{calculate available space}% - % first, recomputing \gre@dimen@previousenddifference into \gre@dimen@adjustedpreviousenddifference - % taking into account the punctum mora shift - \gre@dimen@adjustedpreviousenddifference=\gre@dimen@previousenddifference % - % gre@skip@punctummorashift is 0 or the punctum mora shift - \gre@skip@punctummorashift=0pt\relax % - \ifgre@lastendswithmora % - \ifcase\gre@count@shiftaftermora\or\or % - \ifdim\wd\gre@box@syllabletext=0pt\relax % - % punctum mora adjustment should occur only for bars with no text - \gre@get@unkern@aftermora{2}% - \advance\gre@dimen@adjustedpreviousenddifference by \gre@skip@punctummorashift % - \fi % - \or % - % punctum mora adjustment only before bars - \gre@get@unkern@aftermora{2}% - \advance\gre@dimen@adjustedpreviousenddifference by \gre@skip@punctummorashift % - \or\or % - % punctum mora adjustment always occurs - \gre@get@unkern@aftermora{2}% - \advance\gre@dimen@adjustedpreviousenddifference by \gre@skip@punctummorashift % - \fi % - \fi % - % now something a bit tricky: as we changed previousenddifference, - % we must kern of the difference we created, but no more than - % the end of the text: - \ifdim\gre@skip@punctummorashift=0pt\else % - \gre@debugmsg{barspacing}{adjustment for punctum mora: \the\gre@skip@punctummorashift}% - \gre@debugmsg{barspacing}{adjusted previous enddifference (for punctum mora): \the\gre@dimen@adjustedpreviousenddifference}% - \ifdim -\gre@skip@punctummorashift < \gre@dimen@previousenddifference % - \gre@debugmsg{barspacing}{kern \the\gre@skip@punctummorashift for punctum mora adjustment}% - \kern\gre@skip@punctummorashift % - \else % - \ifdim\gre@dimen@previousenddifference > 0pt\relax % - \gre@debugmsg{barspacing}{kern \the\gre@dimen@previousenddifference for punctum mora adjustment}% - \kern-\gre@dimen@previousenddifference % - \fi % - \fi % - \fi % - \ifdim\gre@dimen@adjustedpreviousenddifference > 0pt\relax% - % the notes ended after the text in the previous syllable - \gre@skip@text@allocation = \gre@dimen@adjustedpreviousenddifference\relax% - \gre@skip@bar@allocation = 0pt\relax% - \else% - % the text ended after the notes in the previous syllable - \gre@skip@text@allocation = 0pt\relax% - \gre@skip@bar@allocation = -\gre@dimen@adjustedpreviousenddifference\relax% - \fi% - \ifdim\gre@skip@nextbegindifference > 0pt\relax% - % the text began after the notes in the next syllable - \advance\gre@skip@text@allocation by \gre@skip@nextbegindifference\relax% - \advance\gre@skip@bar@allocation by 0pt\relax% - \else% - % the notes begin after the text in the next syllable - \advance\gre@skip@text@allocation by 0pt\relax% - \advance\gre@skip@bar@allocation by -\gre@skip@nextbegindifference\relax% - \fi% - \gre@debugmsg{barspacing}{space available to text: \the\gre@skip@text@allocation}% - \gre@debugmsg{barspacing}{spacing available to notes: \the\gre@skip@bar@allocation}% - % now we need to check these widths against the width the current syllable needs for each element and increase them as necessary - % if they aren't wide enough, then we need to increase *both* widths - \gre@debugmsg{barspacing}{calculate required widths}% - % first we check the text width - % we have to account for the spacing around the text as well as the text itself - \ifdim\wd\gre@box@syllabletext > 0pt\relax% - % first we account for the spacing which is needed after the previous syllable text (by using the minTextDistance left over from the previous syllablefinalskip calculation) - \gre@debugmsg{barspacing}{text width: \the\wd\gre@box@syllabletext}% - \gre@debugmsg{barspacing}{previous syllable skip after text: \the\gre@skip@minTextDistance}% - \gre@skip@text@requirement = \glueexpr\wd\gre@box@syllabletext + \gre@skip@minTextDistance\relax% - %now we need to account for the spacing which goes after this syllable (if there is text to this syllable) - %this calculation is similar to what is done in \gre@calculate@syllablefinalskip, but is only for the text, so we'll use \gre@skip@syllablefinalskip to hold this value for now - \ifnum#1=1\relax % - \ifgre@in@euouae % - \gre@skip@syllablefinalskip=\gre@space@dimen@interwordspacetext@bars@euouae\relax% - \else % - \gre@skip@syllablefinalskip=\gre@space@dimen@interwordspacetext@bars\relax% - \fi % - \else % - \gre@skip@syllablefinalskip=0pt\relax% - \fi % - \gre@debugmsg{barspacing}{this syllable skip after text: \the\gre@skip@syllablefinalskip}% - \advance\gre@skip@text@requirement by \gre@skip@syllablefinalskip\relax% - \else% - \ifnum#1=1\relax% - \ifgre@in@euouae% - \gre@skip@text@requirement=\gre@space@dimen@interwordspacetext@bars@notext@euouae\relax% - \else% - \gre@skip@text@requirement=\gre@space@dimen@interwordspacetext@bars@notext\relax% - \fi% - \else% - \gre@skip@text@requirement=0pt\relax% - \fi% - \fi% - \ifdim\gre@skip@text@allocation < \gre@skip@text@requirement\relax% - \advance\gre@skip@bar@allocation by \glueexpr(\gre@skip@text@requirement - \gre@skip@text@allocation)\relax% - \gre@skip@text@allocation = \gre@skip@text@requirement\relax% - \fi% - \gre@debugmsg{barspacing}{space required by text: \the\gre@skip@text@requirement}% - \gre@debugmsg{barspacing}{allocated text space: \the\gre@skip@text@allocation}% - \gre@debugmsg{barspacing}{allocated notes space: \the\gre@skip@bar@allocation}% - % now we check the bar width - \gre@debugmsg{barspacing}{bar width: \the\wd\gre@box@syllablenotes}% - \gre@skip@bar@requirement = \wd\gre@box@syllablenotes\relax% - \ifdim\gre@skip@bar@allocation < \gre@skip@bar@requirement\relax% - \advance\gre@skip@text@allocation by \glueexpr(\gre@skip@bar@requirement - \gre@skip@bar@allocation)\relax% - \gre@skip@bar@allocation = \gre@skip@bar@requirement\relax% - \fi% - \gre@debugmsg{barspacing}{required space for notes: \the\gre@skip@bar@requirement}% - \gre@debugmsg{barspacing}{allocated text space: \the\gre@skip@text@allocation}% - \gre@debugmsg{barspacing}{allocated notes space: \the\gre@skip@bar@allocation}% - % our final position calculation is to make sure that the centers of the text and the bar are not too far from each other - % this isn't really the begindifference (it doesn't account for the width of the text and the bar), but it's close enough that we'll use that register for this calculation - % to be consistent with the normal begin difference, this value should take us from the middle of the notes to the middle of the text. - \gre@dimen@begindifference=\dimexpr(-\gre@skip@bar@allocation/2% going to the left by the bar@allocation/2 (an always positive value, so we lead with a minus sign to go left) - -\gre@dimen@adjustedpreviousenddifference% moving from the end of the notes in the previous syllable to the end of the text there (opposite the sense of enddifference so we lead with a minus sign) - +\gre@skip@text@allocation/2)\relax% going to the right by the text@allocation/2 (an always positive value, so lead with positive to go right) - \gre@debugmsg{barspacing}{new begindifference approximation: \the\gre@dimen@begindifference}% - % in order to avoid code duplication, we check whether or not there is a bar line now and set temp variables to the appropriate offset limits. We’ll then use those temp variables in the code below. - \ifdim\wd\gre@box@syllablenotes = 0pt\relax% - \gre@debugmsg{barspacing}{no bar offset limits}% - \gre@dimen@temp@three=\gre@space@dimen@maxbaroffsettextleft@nobar\relax% - \gre@dimen@temp@two=\gre@space@dimen@maxbaroffsettextright@nobar\relax% - \else% - \gre@debugmsg{barspacing}{normal offset limits}% - \gre@dimen@temp@three=\gre@space@dimen@maxbaroffsettextleft\relax% - \gre@dimen@temp@two=\gre@space@dimen@maxbaroffsettextright\relax% - \fi% - % in the event that the bar is occurring at the end of the line, we use different offset limits - % for now this only works for explicit end of lines which occur in the same syllable as the bar line (e.g. `test(::z)`) - \ifnum\gre@newlinearg=-1\relax\else% - \gre@debugmsg{barspacing}{end of line override on offset limits}% - \gre@dimen@temp@three=\gre@space@dimen@maxbaroffsettextleft@eol\relax% - \gre@dimen@temp@two=\gre@space@dimen@maxbaroffsettextright@eol\relax% - \fi% - \gre@debugmsg{barspacing}{left offset limit: \the\gre@dimen@temp@three}% - \gre@debugmsg{barspacing}{right offset limit: \the\gre@dimen@temp@two}% - % All this worry about shifts is superfluous if the text isn’t present, - % so now we check for that and set them to 0 if it is missing - \ifdim\wd\gre@box@syllabletext = 0pt\relax% - \gre@debugmsg{barspacing}{no text, shifts set to 0}% - \gre@dimen@text@shift = 0pt\relax% - \gre@dimen@bar@shift = 0pt\relax% - \else% - \ifdim\gre@dimen@begindifference > \gre@dimen@temp@two\relax% - %the two elements are too far apart and the text is to the right of the bar - \gre@debugmsg{barspacing}{shifts for text right of bar}% - % first we shift text to the left so that it has the correct offset - \gre@dimen@bar@shift = 0pt\relax% - \gre@dimen@text@shift = \dimexpr(0pt - (\gre@dimen@begindifference - \gre@dimen@temp@two))\relax% - % is the text too far to the left? - \ifdim-\gre@dimen@text@shift > \dimexpr(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax% - % it is, so push both bar and text right to prevent a collision - \gre@debugmsg{barspacing}{text collision detected}% - \gre@dimen@bar@shift = \dimexpr(-\gre@dimen@text@shift-(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2))\relax % - \gre@dimen@text@shift = \dimexpr(0pt - (\gre@skip@text@allocation/2 - \gre@skip@text@requirement/2))\relax % - % is the bar too far to the right? - % \gre@dimen@temp@one is excess shift - \gre@dimen@temp@one = \dimexpr\gre@dimen@bar@shift - (\gre@skip@bar@allocation/2 - \gre@skip@bar@requirement/2)\relax% - \ifdim\gre@dimen@temp@one>0pt\relax % - \gre@debugmsg{barspacing}{bar collision detected}% - % it is, so allocate more space to prevent the collision - \advance\gre@skip@bar@allocation by \gre@dimen@temp@one\relax % - % since the additional allocation will be split evenly on both sides of the bar, we also need to shift both elements left so that all of it will appear on the right hand side - \advance\gre@dimen@bar@shift by -0.5\gre@dimen@temp@one\relax% - \advance\gre@dimen@text@shift by -0.5\gre@dimen@temp@one\relax% - \fi % - \fi% - \else\ifdim-\gre@dimen@begindifference > \gre@dimen@temp@three\relax% - %the two elements are too far apart and the text is to the left of the bar - \gre@debugmsg{barspacing}{shifts for text to left of bar}% - % first we shift text to the right so that it has the correct offset - \gre@dimen@bar@shift = 0pt\relax % - \gre@dimen@text@shift = \dimexpr((-\gre@dimen@begindifference) - \gre@dimen@temp@three)\relax % - % is the text too far to the right? - \ifdim\gre@dimen@text@shift > \dimexpr(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax % - \gre@debugmsg{barspacing}{text collision detected}% - % it is so push both bar and text left to prevent a collision - \gre@dimen@bar@shift = \dimexpr(-\gre@dimen@text@shift+\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax % - \gre@dimen@text@shift = \dimexpr(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax % - % is the bar too far to the left? - % gre@dimen@temp@one is the excess of bar@shift: - \gre@dimen@temp@one=\dimexpr(-\gre@dimen@bar@shift -(\gre@skip@bar@allocation/2-\gre@skip@bar@requirement/2))\relax % - \ifdim\gre@dimen@temp@one>0pt\relax % - \gre@debugmsg{barspacing}{bar collision detected}% - % it is, so allocate more space to prevent the collision - \advance\gre@skip@bar@allocation by \gre@dimen@temp@one\relax % - % since the allocation will be split evenly on either side of the bar, we also need to shift both bar an text right by half of the increase so all of it appears on the left side - \advance\gre@dimen@bar@shift by 0.5\gre@dimen@temp@one\relax% - \advance\gre@dimen@text@shift by 0.5\gre@dimen@temp@one\relax% - \fi % - \fi % - \else% - %the two elements are sufficiently close together - \gre@debugmsg{barspacing}{zero shifts}% - \gre@dimen@text@shift = 0pt\relax% - \gre@dimen@bar@shift = 0pt\relax% - \fi\fi% - \fi% - \gre@debugmsg{barspacing}{text shift: \the\gre@dimen@text@shift}% - \gre@debugmsg{barspacing}{bar shift: \the\gre@dimen@bar@shift}% - %at this point we're going to correct the values of enddifference and begindifference so that they are right for calculations which reference them in the next syllable - \gre@debugmsg{barspacing}{bar width: \the\wd\gre@box@syllablenotes}% - \gre@debugmsg{barspacing}{text width: \the\wd\gre@box@syllabletext}% - \gre@debugmsg{barspacing}{Correcting begindifference}% - %same as before but now we need to account for the widths of the elements and the shifts - \gre@dimen@begindifference = \dimexpr(\wd\gre@box@syllablenotes/2% go right to the middle of the bar syllable (width is always positive so lead with plus to go right) - -\gre@dimen@bar@shift% go from actual middle of bar to nominal middle of bar (bar@shift represents going the other way, so lead with minus) - +\gre@dimen@begindifference% go from nominal middle of bar line to nominal middle of text (this is what begindifference currently holds, so lead with positive) - +\gre@dimen@text@shift% go from nominal middle of text to actual middle of text (text@shift represents this move, so lead with positive) - -\wd\gre@box@syllabletext/2)\relax% go left from middle to beginning of text (width is always positive, so lead with negative to go left - \gre@debugmsg{barspacing}{begindifference: \the\gre@dimen@begindifference}% - \gre@debugmsg{barspacing}{Correcting enddifference}% - \gre@dimen@enddifference = \dimexpr-\wd\gre@box@syllabletext% go from end of text to beginning of text (width is always positive, so lead with negative to go left) - -\gre@dimen@begindifference% go from beginning of text to beginning of notes (opposite sense of begindifference so lead with negative) - +\wd\gre@box@syllablenotes\relax% go from beginning of notes to end of notes (width is always positive so lead with positive to go right - \gre@debugmsg{barspacing}{enddifference: \the\gre@dimen@enddifference}% - %we also need to correct syllablefinalskip to make sure it’s accurate because it depends on enddifference - \gre@debugmsg{barspacing}{Correcting syllablefinalskip}% - \gre@calculate@syllablefinalskip{#1}{\gre@count@temp@one}% - \gre@debugmsg{barspacing}{syllablefinalskip: \the\gre@skip@syllablefinalskip}% + % we start by finding the distance between the text and notes of the previous and the next syllable (as if this syllable didn't exist, for the moment) + \gre@debugmsg{barspacing}{calculate available space}% + % first, recomputing \gre@dimen@previousenddifference into \gre@dimen@adjustedpreviousenddifference + % taking into account the punctum mora shift + \gre@dimen@adjustedpreviousenddifference=\gre@dimen@previousenddifference % + % gre@skip@punctummorashift is 0 or the punctum mora shift + \gre@skip@punctummorashift=0pt\relax % + \ifgre@lastendswithmora % + \ifcase\gre@count@shiftaftermora\or\or % + \ifdim\wd\gre@box@syllabletext=0pt\relax % + % punctum mora adjustment should occur only for bars with no text + \gre@get@unkern@aftermora{2}% + \advance\gre@dimen@adjustedpreviousenddifference by \gre@skip@punctummorashift % + \fi % + \or % + % punctum mora adjustment only before bars + \gre@get@unkern@aftermora{2}% + \advance\gre@dimen@adjustedpreviousenddifference by \gre@skip@punctummorashift % + \or\or % + % punctum mora adjustment always occurs + \gre@get@unkern@aftermora{2}% + \advance\gre@dimen@adjustedpreviousenddifference by \gre@skip@punctummorashift % + \fi % + \fi % + % now something a bit tricky: as we changed previousenddifference, + % we must kern of the difference we created, but no more than + % the end of the text: + \ifdim\gre@skip@punctummorashift=0pt\else % + \gre@debugmsg{barspacing}{adjustment for punctum mora: \the\gre@skip@punctummorashift}% + \gre@debugmsg{barspacing}{adjusted previous enddifference (for punctum mora): \the\gre@dimen@adjustedpreviousenddifference}% + \ifdim -\gre@skip@punctummorashift < \gre@dimen@previousenddifference % + \gre@debugmsg{barspacing}{kern \the\gre@skip@punctummorashift for punctum mora adjustment}% + \kern\gre@skip@punctummorashift % + \else % + \ifdim\gre@dimen@previousenddifference > 0pt\relax % + \gre@debugmsg{barspacing}{kern \the\gre@dimen@previousenddifference for punctum mora adjustment}% + \kern-\gre@dimen@previousenddifference % + \fi % + \fi % + \fi % + \ifdim\gre@dimen@adjustedpreviousenddifference > 0pt\relax% + % the notes ended after the text in the previous syllable + \gre@skip@text@allocation = \gre@dimen@adjustedpreviousenddifference\relax% + \gre@skip@bar@allocation = 0pt\relax% + \else% + % the text ended after the notes in the previous syllable + \gre@skip@text@allocation = 0pt\relax% + \gre@skip@bar@allocation = -\gre@dimen@adjustedpreviousenddifference\relax% + \fi% + \ifdim\gre@skip@nextbegindifference > 0pt\relax% + % the text began after the notes in the next syllable + \advance\gre@skip@text@allocation by \gre@skip@nextbegindifference\relax% + \advance\gre@skip@bar@allocation by 0pt\relax% + \else% + % the notes begin after the text in the next syllable + \advance\gre@skip@text@allocation by 0pt\relax% + \advance\gre@skip@bar@allocation by -\gre@skip@nextbegindifference\relax% + \fi% + \gre@debugmsg{barspacing}{space available to text: \the\gre@skip@text@allocation}% + \gre@debugmsg{barspacing}{spacing available to notes: \the\gre@skip@bar@allocation}% + % now we need to check these widths against the width the current syllable needs for each element and increase them as necessary + % if they aren't wide enough, then we need to increase *both* widths + \gre@debugmsg{barspacing}{calculate required widths}% + % first we check the text width + % we have to account for the spacing around the text as well as the text itself + \ifdim\wd\gre@box@syllabletext > 0pt\relax% + % first we account for the spacing which is needed after the previous syllable text (by using the minTextDistance left over from the previous syllablefinalskip calculation) + \gre@debugmsg{barspacing}{text width: \the\wd\gre@box@syllabletext}% + \gre@debugmsg{barspacing}{previous syllable skip after text: \the\gre@skip@minTextDistance}% + \gre@skip@text@requirement = \glueexpr\wd\gre@box@syllabletext + \gre@skip@minTextDistance\relax% + %now we need to account for the spacing which goes after this syllable (if there is text to this syllable) + %this calculation is similar to what is done in \gre@calculate@syllablefinalskip, but is only for the text, so we'll use \gre@skip@syllablefinalskip to hold this value for now + \ifnum#1=1\relax % + \ifgre@in@euouae % + \gre@skip@syllablefinalskip=\gre@space@dimen@interwordspacetext@bars@euouae\relax% + \else % + \gre@skip@syllablefinalskip=\gre@space@dimen@interwordspacetext@bars\relax% + \fi % + \else % + \gre@skip@syllablefinalskip=0pt\relax% + \fi % + \gre@debugmsg{barspacing}{this syllable skip after text: \the\gre@skip@syllablefinalskip}% + \advance\gre@skip@text@requirement by \gre@skip@syllablefinalskip\relax% + \else% + \ifnum#1=1\relax% + \ifgre@in@euouae% + \gre@skip@text@requirement=\gre@space@dimen@interwordspacetext@bars@notext@euouae\relax% + \else% + \gre@skip@text@requirement=\gre@space@dimen@interwordspacetext@bars@notext\relax% + \fi% + \else% + \gre@skip@text@requirement=0pt\relax% + \fi% + \fi% + \ifdim\gre@skip@text@allocation < \gre@skip@text@requirement\relax% + \advance\gre@skip@bar@allocation by \glueexpr(\gre@skip@text@requirement - \gre@skip@text@allocation)\relax% + \gre@skip@text@allocation = \gre@skip@text@requirement\relax% + \fi% + \gre@debugmsg{barspacing}{space required by text: \the\gre@skip@text@requirement}% + \gre@debugmsg{barspacing}{allocated text space: \the\gre@skip@text@allocation}% + \gre@debugmsg{barspacing}{allocated notes space: \the\gre@skip@bar@allocation}% + % now we check the bar width + \gre@debugmsg{barspacing}{bar width: \the\wd\gre@box@syllablenotes}% + \gre@skip@bar@requirement = \wd\gre@box@syllablenotes\relax% + \ifdim\gre@skip@bar@allocation < \gre@skip@bar@requirement\relax% + \advance\gre@skip@text@allocation by \glueexpr(\gre@skip@bar@requirement - \gre@skip@bar@allocation)\relax% + \gre@skip@bar@allocation = \gre@skip@bar@requirement\relax% + \fi% + \gre@debugmsg{barspacing}{required space for notes: \the\gre@skip@bar@requirement}% + \gre@debugmsg{barspacing}{allocated text space: \the\gre@skip@text@allocation}% + \gre@debugmsg{barspacing}{allocated notes space: \the\gre@skip@bar@allocation}% + % our final position calculation is to make sure that the centers of the text and the bar are not too far from each other + % this isn't really the begindifference (it doesn't account for the width of the text and the bar), but it's close enough that we'll use that register for this calculation + % to be consistent with the normal begin difference, this value should take us from the middle of the notes to the middle of the text. + \gre@dimen@begindifference=\dimexpr(-\gre@skip@bar@allocation/2% going to the left by the bar@allocation/2 (an always positive value, so we lead with a minus sign to go left) + -\gre@dimen@adjustedpreviousenddifference% moving from the end of the notes in the previous syllable to the end of the text there (opposite the sense of enddifference so we lead with a minus sign) + +\gre@skip@text@allocation/2)\relax% going to the right by the text@allocation/2 (an always positive value, so lead with positive to go right) + \gre@debugmsg{barspacing}{new begindifference approximation: \the\gre@dimen@begindifference}% + % in order to avoid code duplication, we check whether or not there is a bar line now and set temp variables to the appropriate offset limits. We’ll then use those temp variables in the code below. + \ifdim\wd\gre@box@syllablenotes = 0pt\relax% + \gre@debugmsg{barspacing}{no bar offset limits}% + \gre@dimen@temp@three=\gre@space@dimen@maxbaroffsettextleft@nobar\relax% + \gre@dimen@temp@two=\gre@space@dimen@maxbaroffsettextright@nobar\relax% + \else% + \gre@debugmsg{barspacing}{normal offset limits}% + \gre@dimen@temp@three=\gre@space@dimen@maxbaroffsettextleft\relax% + \gre@dimen@temp@two=\gre@space@dimen@maxbaroffsettextright\relax% + \fi% + % in the event that the bar is occurring at the end of the line, we use different offset limits + % for now this only works for explicit end of lines which occur in the same syllable as the bar line (e.g. `test(::z)`) + \ifnum\gre@newlinearg=-1\relax\else% + \gre@debugmsg{barspacing}{end of line override on offset limits}% + \gre@dimen@temp@three=\gre@space@dimen@maxbaroffsettextleft@eol\relax% + \gre@dimen@temp@two=\gre@space@dimen@maxbaroffsettextright@eol\relax% + \fi% + \gre@debugmsg{barspacing}{left offset limit: \the\gre@dimen@temp@three}% + \gre@debugmsg{barspacing}{right offset limit: \the\gre@dimen@temp@two}% + % All this worry about shifts is superfluous if the text isn’t present, + % so now we check for that and set them to 0 if it is missing + \ifdim\wd\gre@box@syllabletext = 0pt\relax% + \gre@debugmsg{barspacing}{no text, shifts set to 0}% + \gre@dimen@text@shift = 0pt\relax% + \gre@dimen@bar@shift = 0pt\relax% + \else% + \ifdim\gre@dimen@begindifference > \gre@dimen@temp@two\relax% + %the two elements are too far apart and the text is to the right of the bar + \gre@debugmsg{barspacing}{shifts for text right of bar}% + % first we shift text to the left so that it has the correct offset + \gre@dimen@bar@shift = 0pt\relax% + \gre@dimen@text@shift = \dimexpr(0pt - (\gre@dimen@begindifference - \gre@dimen@temp@two))\relax% + % is the text too far to the left? + \ifdim-\gre@dimen@text@shift > \dimexpr(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax% + % it is, so push both bar and text right to prevent a collision + \gre@debugmsg{barspacing}{text collision detected}% + \gre@dimen@bar@shift = \dimexpr(-\gre@dimen@text@shift-(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2))\relax % + \gre@dimen@text@shift = \dimexpr(0pt - (\gre@skip@text@allocation/2 - \gre@skip@text@requirement/2))\relax % + % is the bar too far to the right? + % \gre@dimen@temp@one is excess shift + \gre@dimen@temp@one = \dimexpr\gre@dimen@bar@shift - (\gre@skip@bar@allocation/2 - \gre@skip@bar@requirement/2)\relax% + \ifdim\gre@dimen@temp@one>0pt\relax % + \gre@debugmsg{barspacing}{bar collision detected}% + % it is, so allocate more space to prevent the collision + \advance\gre@skip@bar@allocation by \gre@dimen@temp@one\relax % + % since the additional allocation will be split evenly on both sides of the bar, we also need to shift both elements left so that all of it will appear on the right hand side + \advance\gre@dimen@bar@shift by -0.5\gre@dimen@temp@one\relax% + \advance\gre@dimen@text@shift by -0.5\gre@dimen@temp@one\relax% + \fi % + \fi% + \else\ifdim-\gre@dimen@begindifference > \gre@dimen@temp@three\relax% + %the two elements are too far apart and the text is to the left of the bar + \gre@debugmsg{barspacing}{shifts for text to left of bar}% + % first we shift text to the right so that it has the correct offset + \gre@dimen@bar@shift = 0pt\relax % + \gre@dimen@text@shift = \dimexpr((-\gre@dimen@begindifference) - \gre@dimen@temp@three)\relax % + % is the text too far to the right? + \ifdim\gre@dimen@text@shift > \dimexpr(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax % + \gre@debugmsg{barspacing}{text collision detected}% + % it is so push both bar and text left to prevent a collision + \gre@dimen@bar@shift = \dimexpr(-\gre@dimen@text@shift+\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax % + \gre@dimen@text@shift = \dimexpr(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax % + % is the bar too far to the left? + % gre@dimen@temp@one is the excess of bar@shift: + \gre@dimen@temp@one=\dimexpr(-\gre@dimen@bar@shift -(\gre@skip@bar@allocation/2-\gre@skip@bar@requirement/2))\relax % + \ifdim\gre@dimen@temp@one>0pt\relax % + \gre@debugmsg{barspacing}{bar collision detected}% + % it is, so allocate more space to prevent the collision + \advance\gre@skip@bar@allocation by \gre@dimen@temp@one\relax % + % since the allocation will be split evenly on either side of the bar, we also need to shift both bar an text right by half of the increase so all of it appears on the left side + \advance\gre@dimen@bar@shift by 0.5\gre@dimen@temp@one\relax% + \advance\gre@dimen@text@shift by 0.5\gre@dimen@temp@one\relax% + \fi % + \fi % + \else% + %the two elements are sufficiently close together + \gre@debugmsg{barspacing}{zero shifts}% + \gre@dimen@text@shift = 0pt\relax% + \gre@dimen@bar@shift = 0pt\relax% + \fi\fi% + \fi% + \gre@debugmsg{barspacing}{text shift: \the\gre@dimen@text@shift}% + \gre@debugmsg{barspacing}{bar shift: \the\gre@dimen@bar@shift}% + %at this point we're going to correct the values of enddifference and begindifference so that they are right for calculations which reference them in the next syllable + \gre@debugmsg{barspacing}{bar width: \the\wd\gre@box@syllablenotes}% + \gre@debugmsg{barspacing}{text width: \the\wd\gre@box@syllabletext}% + \gre@debugmsg{barspacing}{Correcting begindifference}% + %same as before but now we need to account for the widths of the elements and the shifts + \gre@dimen@begindifference = \dimexpr(\wd\gre@box@syllablenotes/2% go right to the middle of the bar syllable (width is always positive so lead with plus to go right) + -\gre@dimen@bar@shift% go from actual middle of bar to nominal middle of bar (bar@shift represents going the other way, so lead with minus) + +\gre@dimen@begindifference% go from nominal middle of bar line to nominal middle of text (this is what begindifference currently holds, so lead with positive) + +\gre@dimen@text@shift% go from nominal middle of text to actual middle of text (text@shift represents this move, so lead with positive) + -\wd\gre@box@syllabletext/2)\relax% go left from middle to beginning of text (width is always positive, so lead with negative to go left + \gre@debugmsg{barspacing}{begindifference: \the\gre@dimen@begindifference}% + \gre@debugmsg{barspacing}{Correcting enddifference}% + \gre@dimen@enddifference = \dimexpr-\wd\gre@box@syllabletext% go from end of text to beginning of text (width is always positive, so lead with negative to go left) + -\gre@dimen@begindifference% go from beginning of text to beginning of notes (opposite sense of begindifference so lead with negative) + +\wd\gre@box@syllablenotes\relax% go from beginning of notes to end of notes (width is always positive so lead with positive to go right + \gre@debugmsg{barspacing}{enddifference: \the\gre@dimen@enddifference}% + %we also need to correct syllablefinalskip to make sure it’s accurate because it depends on enddifference + \gre@debugmsg{barspacing}{Correcting syllablefinalskip}% + \gre@calculate@syllablefinalskip{#1}{\gre@count@temp@one}% + \gre@debugmsg{barspacing}{syllablefinalskip: \the\gre@skip@syllablefinalskip}% }% %%%%%%%%%%%%%%%%%%% @@ -1173,159 +1183,202 @@ %% Note: the distances created by this function are stored as strings, not skip or dimension registers. This allows the user to specify a distance in em or ex units even though the font parameters may not be the same at the time the distance is specified and the time the distance is used. \newif\ifgre@checklength% \def\grecreatedim#1#2#3{% - \gre@dimension{#1}{#2}% - \csname newif\expandafter\endcsname\csname ifgre@scale@#1\endcsname% - \IfStrEqCase{#3}{% - {1}% - {\gre@obsolete{A numerical (1) last argument for \protect\grecreatedim}{'scalable'}}% - {0}% - {\gre@obsolete{A numerical (0) last argument for \protect\grecreatedim}{'fixed'}}% - {scalable}% - {\grescaledim{#1}{true}}% - {fixed}% - {\grescaledim{#1}{false}}% - }[% all other cases - \gre@error{Unrecognized option "#3" for \protect\grecreatedim\MessageBreak Possible options are: 'scalable' and 'fixed'}% - ]% + \csname newif\expandafter\endcsname\csname ifgre@scale@#1\endcsname% + \IfStrEqCase{#3}{% + {scalable}% + {\grescaledim{#1}{true}}% + {fixed}% + {\grescaledim{#1}{false}}% + {inherited}% + {\grescaledim{#1}{false}}% + }[% all other cases + \gre@error{Unrecognized option "#3" for \protect\grecreatedim\MessageBreak Possible options are: 'scalable' and 'fixed'}% + ]% + \gre@dimension{#1}{#2}{#3}% }% -\def\gresetdim{%OBSOLETE - \gre@obsolete{\protect\gresetdim}{\protect\grecreatedim}% -}% % a macro for changing a dimension. Unlike \grecreatedim, this function won’t create a new distance, just change an existing one. \def\grechangedim#1#2#3{% - \gre@rubberpermit{#1}% - % figure out our prefix - \ifgre@rubber% - \gre@debugmsg{spacing}{Changing a skip.}% - \def\gre@prefix{skip}% - \else% - \gre@debugmsg{spacing}{Changing a dimen.}% - \def\gre@prefix{dimen}% - \fi% - \ifcsname gre@space@\gre@prefix @#1\endcsname% - \gre@debugmsg{spacing}{It does exist.}% - \gre@dimension{#1}{#2}% - \IfStrEqCase{#3}{% - {1}% - {\gre@obsolete{A numerical (1) last argument for \protect\grechangedim}{'scalable'}}% - {0}% - {\gre@obsolete{A numerical (0) last argument for \protect\grechangedim}{'fixed'}}% - {scalable}% - {\grescaledim{#1}{true}}% - {fixed}% - {\grescaledim{#1}{false}}% - % all other cases - }[\gre@error{Unrecognized option "#3" for \protect\grechangedim\MessageBreak Possible options are: 'scalable' and 'fixed'}]% - \else% - \IfStrEqCase{#1}{% DEPRECATED - {spacearoundsmallbars}% DEPRECATED - {% DEPRECATED - \gre@deprecated{spacearoundsmallbars}{bar@virgula or bar@minima}% DEPRECATED - \grechangedim{bar@virgula}{#2}{#3}% DEPRECATED - \grechangedim{bar@minima}{#2}{#3}% DEPRECATED - }% DEPRECATED - {spacearoundminor}% DEPRECATED - {% DEPRECATED - \gre@deprecated{spacearoundminor}{bar@minor}% DEPRECATED - \grechangedim{bar@minor}{#2}{#3}% DEPRECATED - }% DEPRECATED - {spacearoundmaior}% DEPRECATED - {% DEPRECATED - \gre@deprecated{spacearoundmaior}{bar@maior}% DEPRECATED - \grechangedim{bar@maior}{#2}{#3}% DEPRECATED - }% DEPRECATED - {spacearoundfinalis}% DEPRECATED - {% DEPRECATED - \gre@deprecated{spacearoundfinalis}{bar@finalis}% DEPRECATED - \grechangedim{bar@finalis}{#2}{#3}% DEPRECATED - }% DEPRECATED - {spacebeforefinalfinalis}% DEPRECATED - {% DEPRECATED - \gre@deprecated{spacebeforfinalfinalis}{bar@finalfinalis}% DEPRECATED - \grechangedim{bar@finalfinalis}{#2}{#3}% DEPRECATED - }% DEPRECATED - }[% DEPRECATED - \gre@error{#1 is not a recognized distance.}% keep this line - ]% DEPRECATED - \fi% + \gre@rubberpermit{#1}% + % figure out our prefix + \ifgre@rubber% + \gre@debugmsg{spacing}{Changing a skip.}% + \def\gre@prefix{skip}% + \else% + \gre@debugmsg{spacing}{Changing a dimen.}% + \def\gre@prefix{dimen}% + \fi% + \ifcsname gre@space@\gre@prefix @#1\endcsname% + \gre@debugmsg{spacing}{It does exist.}% + \IfStrEqCase{#3}{% + {scalable}% + {\grescaledim{#1}{true}}% + {fixed}% + {\grescaledim{#1}{false}}% + {inherited}% + {% + \gre@rubberpermit{#2}% + \ifgre@rubber% + \def\gre@prefixII{skip}% + \else% + \def\gre@prefixII{dimen}% + \fi% + \ifcsname gre@space@\gre@prefixII @#2\endcsname% + \grescaledim{#1}{false}% + \else% + \gre@error{'#1' cannot inherit from '#2'\MessageBreak Please make sure '#2' is a valid GregorioTeX distance}% + \fi% + }% + % all other cases + }[\gre@error{Unrecognized option "#3" for \protect\grechangedim\MessageBreak Possible options are: 'scalable', 'fixed', and 'inherited'}]% + \gre@dimension{#1}{#2}{#3}% + \else% + \IfStrEqCase{#1}{% DEPRECATED + {spacearoundsmallbars}% DEPRECATED + {% DEPRECATED + \gre@deprecated{spacearoundsmallbars}{bar@virgula or bar@minima}% DEPRECATED + \grechangedim{bar@virgula}{#2}{#3}% DEPRECATED + \grechangedim{bar@minima}{#2}{#3}% DEPRECATED + }% DEPRECATED + {spacearoundminor}% DEPRECATED + {% DEPRECATED + \gre@deprecated{spacearoundminor}{bar@minor}% DEPRECATED + \grechangedim{bar@minor}{#2}{#3}% DEPRECATED + }% DEPRECATED + {spacearoundmaior}% DEPRECATED + {% DEPRECATED + \gre@deprecated{spacearoundmaior}{bar@maior}% DEPRECATED + \grechangedim{bar@maior}{#2}{#3}% DEPRECATED + }% DEPRECATED + {spacearoundfinalis}% DEPRECATED + {% DEPRECATED + \gre@deprecated{spacearoundfinalis}{bar@finalis}% DEPRECATED + \grechangedim{bar@finalis}{#2}{#3}% DEPRECATED + }% DEPRECATED + {spacebeforefinalfinalis}% DEPRECATED + {% DEPRECATED + \gre@deprecated{spacebeforfinalfinalis}{bar@finalfinalis}% DEPRECATED + \grechangedim{bar@finalfinalis}{#2}{#3}% DEPRECATED + }% DEPRECATED + }[% DEPRECATED + \gre@error{#1 is not a recognized distance.}% keep this line + ]% DEPRECATED + \fi% }% \def\grechangecount#1#2{% - \expandafter\csname gre@space@count@#1\endcsname=#2% - \relax % + \expandafter\csname gre@space@count@#1\endcsname=#2% + \relax % } % The common internals for \grecreatedim and \grechangedim. -\def\gre@dimension#1#2{% - \gre@checklengthfalse% - %check if #2 is a rubber length (contains plus and/or minus) - \IfSubStr{#2}{plus}{\gre@checklengthtrue}{\relax}% - \IfSubStr{#2}{minus}{\gre@checklengthtrue}{\relax}% - %if #1 is one of the distances which cannot be rubber. - \gre@rubberpermit{#1}% - % do we try to assign a rubber to one where it's not permitted? - \ifgre@rubber% - \def\gre@prefix{skip}% - \else% - \ifgre@checklength% - \gre@error{#1 cannot be a rubber length.}% - \else% - \def\gre@prefix{dimen}% - \fi% - \fi% - % special check for bar@rubber - \IfStrEq*{#1}{bar@rubber}% - {% - \gre@skip@temp@one = #2\relax% - \ifdim\gre@skip@temp@one=0pt\relax\else% - \gre@error{bar@rubber cannot have a non-zero base}% - \fi% - }{}% - \expandafter\edef\csname gre@space@\gre@prefix @#1\endcsname{#2}% - \relax % +\def\gre@dimension#1#2#3{% + \IfStrEq{#3}{inherited}{% + \gre@debugmsg{spacing}{setting inherited distance}% + \gre@rubberpermit{#1}% + \ifgre@rubber% + \def\gre@prefix{skip}% + \else% + \def\gre@prefix{dimen}% + \fi% + \gre@rubberpermit{#2}% + \ifgre@rubber% + \def\gre@prefixII{skip}% + \else% + \def\gre@prefixII{dimen}% + \fi% + \expandafter\edef\csname gre@space@\gre@prefix @#1\endcsname{\expandafter\unexpanded{\csname gre@space@\gre@prefixII @#2\endcsname}}% + }{% + \gre@rubberpermit{#2}% + \ifgre@rubber% + \def\gre@prefixII{skip}% + \else% + \def\gre@prefixII{dimen}% + \fi% + \ifcsname gre@space@\gre@prefixII @#2\endcsname% + \gre@error{'#1' cannot be '#3' and depend on '#2' at the same time\MessageBreak Either use 'inherited' in the third argument\MessageBreak or give an actual distance in the second}% + \fi% + \gre@checklengthfalse% + %check if #2 is a rubber length (contains plus and/or minus) + \IfSubStr{#2}{plus}{\gre@checklengthtrue}{\relax}% + \IfSubStr{#2}{minus}{\gre@checklengthtrue}{\relax}% + %if #1 is one of the distances which cannot be rubber. + \gre@rubberpermit{#1}% + % do we try to assign a rubber to one where it's not permitted? + \ifgre@rubber% + \def\gre@prefix{skip}% + \else% + \ifgre@checklength% + \gre@error{#1 cannot be a rubber length.}% + \else% + \def\gre@prefix{dimen}% + \fi% + \fi% + % special check for bar@rubber + \IfStrEq*{#1}{bar@rubber}% + {% + \gre@skip@temp@one = #2\relax% + \ifdim\gre@skip@temp@one=0pt\relax\else% + \gre@error{bar@rubber cannot have a non-zero base}% + \fi% + }{}% + \expandafter\edef\csname gre@space@\gre@prefix @#1\endcsname{#2}% + \relax % + }% } %a macro to use if all you want to do is turn on or off the scaling for a particular distance \def\grescaledim#1#2{% - \IfStrEqCase{#2}{% - {true}% - {\csname gre@scale@#1true\endcsname}% - {yes}% - {\grescaledim{true}}% - {on}% - {\grescaledim{true}}% - {scalable}% - {\grescaledim{true}}% - }[% all other cases - \csname gre@scale@#1false\endcsname% - ]% + \ifcsname ifgre@scale@#1\endcsname% + \IfStrEqCase{#2}{% + {true}% + {\csname gre@scale@#1true\endcsname}% + {yes}% + {\grescaledim{true}}% + {on}% + {\grescaledim{true}}% + {scalable}% + {\grescaledim{true}}% + }[% all other cases + \csname gre@scale@#1false\endcsname% + ]% + \else% + \gre@error{Unrecognized distance "#1" in \protect\grescaledim}% + \fi% } -\def\grenoscaledim#1{%OBSOLETE - \gre@obsolete{\protect\grenoscaledim}{\protect\grescaledim{...}{no}}% -}% +\newcount\gre@space@count@newlinepenalty% +\newcount\gre@space@count@nobreakpenalty% +\newcount\gre@space@count@endofwordpenalty% +\newcount\gre@space@count@endofsyllablepenalty% +\newcount\gre@space@count@endafterbarpenalty% +\newcount\gre@space@count@endafterbaraltpenalty% +\newcount\gre@space@count@finalpenalty% +\newcount\gre@space@count@endofelementpenalty% +\newcount\gre@space@count@hyphenpenalty% +\newcount\gre@space@count@brokenpenalty% +\newcount\gre@space@count@looseness% +\newcount\gre@space@count@tolerance% +\newcount\gre@space@count@pretolerance% +\newcount\gre@space@count@widowpenalty% +\newcount\gre@space@count@clubpenalty% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % space configuration loading %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\GreLoadSpaceConf#1{%OBSOLETE - \gre@obsolete{\protect\GreLoadSpaceConf}{\protect\greloadspaceconf}% -}% - \newcount\greconffactor% \def\greloadspaceconf#1{% - \input gsp-#1.tex\relax % - \ifnum\greconffactor=0\relax% - \gre@error{gsp-#1.tex does not have an assigned staff size.\MessageBreak Please edit it to define \protect\greconffactor}% - \fi % - \ifnum\the\gre@factor=\greconffactor\else %If the space configuration file is designed for a \gre@factor other than the current one, then we need to rescale the distances. - \gre@changedimenfactor{\greconffactor}{\gre@factor} % - \fi% - \greconffactor=0% - \relax % + \input gsp-#1.tex\relax % + \ifnum\greconffactor=0\relax% + \gre@error{gsp-#1.tex does not have an assigned staff size.\MessageBreak Please edit it to define \protect\greconffactor}% + \fi % + \ifnum\the\gre@factor=\greconffactor\else %If the space configuration file is designed for a \gre@factor other than the current one, then we need to rescale the distances. + \gre@changedimenfactor{\greconffactor}{\gre@factor} % + \fi% + \greconffactor=0% + \relax % }% @@ -1339,143 +1392,143 @@ % This function checks to see if the length is one of the ones which cannot be a rubber length. The assumption is that any length not listed here is allowed to be rubber. \newif\ifgre@rubber% \def\gre@rubberpermit#1{% - % is length one that cannot be rubber? - \IfStrEqCase*{#1}{% - {additionallineswidth}{\gre@rubberfalse}% - {additionalcustoslineswidth}{\gre@rubberfalse}% - {zerowidthspace}{\gre@rubberfalse}% - {maximumspacewithoutdash}{\gre@rubberfalse}% - {afterinitialshift}{\gre@rubberfalse}% - {beforeinitialshift}{\gre@rubberfalse}% - {minimalspaceatlinebeginning}{\gre@rubberfalse}% - {manualinitialwidth}{\gre@rubberfalse}% - {annotationseparation}{\gre@rubberfalse}% - {intersyllablespacenotes}{\gre@rubberfalse}% - {intersyllablespacenotes@alteration}{\gre@rubberfalse}% - {annotationraise}{\gre@rubberfalse}% - {commentaryseparation}{\gre@rubberfalse}% - {commentaryraise}{\gre@rubberfalse}% - {noclefspace}{\gre@rubberfalse}% - {clivisalignmentmin}{\gre@rubberfalse}% - {choralsigndownshift}{\gre@rubberfalse}% - {choralsignupshift}{\gre@rubberfalse}% - {translationheight}{\gre@rubberfalse}% - {spacelinestext}{\gre@rubberfalse}% - {spacebeneathtext}{\gre@rubberfalse}% - {abovelinestextraise}{\gre@rubberfalse}% - {abovelinestextheight}{\gre@rubberfalse}% - {braceshift}{\gre@rubberfalse}% - {curlybraceaccentusshift}{\gre@rubberfalse}% - {initialraise}{\gre@rubberfalse}% - {beforealterationspace}{\gre@rubberfalse}% - {alterationspace}{\gre@rubberfalse}% - {overslurshift}{\gre@rubberfalse}% - {underslurshift}{\gre@rubberfalse}% - {maxbaroffsettextleft}{\gre@rubberfalse}% - {maxbaroffsettextright}{\gre@rubberfalse}% - {maxbaroffsettextleft@nobar}{\gre@rubberfalse}% - {maxbaroffsettextright@nobar}{\gre@rubberfalse}% - {maxbaroffsettextleft@eol}{\gre@rubberfalse}% - {maxbaroffsettextright@eol}{\gre@rubberfalse}% - {interwordspacetext@bars@euouae}{\gre@rubberfalse}% - {interwordspacetext@bars}{\gre@rubberfalse}% - {interwordspacetext@bars@notext@euouae}{\gre@rubberfalse}% - {interwordspacetext@bars@notext}{\gre@rubberfalse}% - {overhepisemalowshift}{\gre@rubberfalse}% - {overhepisemahighshift}{\gre@rubberfalse}% - {underhepisemalowshift}{\gre@rubberfalse}% - {underhepisemahighshift}{\gre@rubberfalse}% - {hepisemamiddleshift}{\gre@rubberfalse}% - {vepisemalowshift}{\gre@rubberfalse}% - {vepisemahighshift}{\gre@rubberfalse}% - {linepunctummorashift}{\gre@rubberfalse}% - {spacepunctummorashift}{\gre@rubberfalse}% - {spaceamonepespunctummorashift}{\gre@rubberfalse}% - {lineporrectuspunctummorashift}{\gre@rubberfalse}% - {spaceporrectuspunctummorashift}{\gre@rubberfalse}% - {raresignshift}{\gre@rubberfalse}% - {divisiofinalissep}{\gre@rubberfalse}% - }[\gre@rubbertrue]% + % is length one that cannot be rubber? + \IfStrEqCase*{#1}{% + {additionallineswidth}{\gre@rubberfalse}% + {additionalcustoslineswidth}{\gre@rubberfalse}% + {zerowidthspace}{\gre@rubberfalse}% + {maximumspacewithoutdash}{\gre@rubberfalse}% + {afterinitialshift}{\gre@rubberfalse}% + {beforeinitialshift}{\gre@rubberfalse}% + {minimalspaceatlinebeginning}{\gre@rubberfalse}% + {manualinitialwidth}{\gre@rubberfalse}% + {annotationseparation}{\gre@rubberfalse}% + {intersyllablespacenotes}{\gre@rubberfalse}% + {intersyllablespacenotes@alteration}{\gre@rubberfalse}% + {annotationraise}{\gre@rubberfalse}% + {commentaryseparation}{\gre@rubberfalse}% + {commentaryraise}{\gre@rubberfalse}% + {noclefspace}{\gre@rubberfalse}% + {clivisalignmentmin}{\gre@rubberfalse}% + {choralsigndownshift}{\gre@rubberfalse}% + {choralsignupshift}{\gre@rubberfalse}% + {translationheight}{\gre@rubberfalse}% + {spacelinestext}{\gre@rubberfalse}% + {spacebeneathtext}{\gre@rubberfalse}% + {abovelinestextraise}{\gre@rubberfalse}% + {abovelinestextheight}{\gre@rubberfalse}% + {braceshift}{\gre@rubberfalse}% + {curlybraceaccentusshift}{\gre@rubberfalse}% + {initialraise}{\gre@rubberfalse}% + {beforealterationspace}{\gre@rubberfalse}% + {alterationspace}{\gre@rubberfalse}% + {overslurshift}{\gre@rubberfalse}% + {underslurshift}{\gre@rubberfalse}% + {maxbaroffsettextleft}{\gre@rubberfalse}% + {maxbaroffsettextright}{\gre@rubberfalse}% + {maxbaroffsettextleft@nobar}{\gre@rubberfalse}% + {maxbaroffsettextright@nobar}{\gre@rubberfalse}% + {maxbaroffsettextleft@eol}{\gre@rubberfalse}% + {maxbaroffsettextright@eol}{\gre@rubberfalse}% + {interwordspacetext@bars@euouae}{\gre@rubberfalse}% + {interwordspacetext@bars}{\gre@rubberfalse}% + {interwordspacetext@bars@notext@euouae}{\gre@rubberfalse}% + {interwordspacetext@bars@notext}{\gre@rubberfalse}% + {overhepisemalowshift}{\gre@rubberfalse}% + {overhepisemahighshift}{\gre@rubberfalse}% + {underhepisemalowshift}{\gre@rubberfalse}% + {underhepisemahighshift}{\gre@rubberfalse}% + {hepisemamiddleshift}{\gre@rubberfalse}% + {vepisemalowshift}{\gre@rubberfalse}% + {vepisemahighshift}{\gre@rubberfalse}% + {linepunctummorashift}{\gre@rubberfalse}% + {spacepunctummorashift}{\gre@rubberfalse}% + {spaceamonepespunctummorashift}{\gre@rubberfalse}% + {lineporrectuspunctummorashift}{\gre@rubberfalse}% + {spaceporrectuspunctummorashift}{\gre@rubberfalse}% + {raresignshift}{\gre@rubberfalse}% + {divisiofinalissep}{\gre@rubberfalse}% + }[\gre@rubbertrue]% }% %% an aux function adapting the value #1 from the factor #2 to the factor #3 \def\gre@changeonedimenfactor#1#2#3{% - % Math - \gre@rubberpermit{#1}% - \ifgre@rubber% - % if we have a rubber allowed length we create a temporary skip - \let\gre@scaledist\gre@skip@temp@one% - \edef\gre@convert{\csname gre@space@skip@#1\endcsname}% - \gre@scaledist=\glueexpr(\gre@convert * \number#3 / \number#2)\relax % - \else% - % otherwise we create a temporary dimen - \let\gre@scaledist\gre@dimen@temp@one% - \edef\gre@convert{\csname gre@space@dimen@#1\endcsname}% - \gre@scaledist=\dimexpr(\gre@convert * \number#3 / \number#2)\relax % - \fi% - \gre@consistentunits{\gre@convert}{\gre@scaledist}% - \gre@dimension{#1}{\gre@stringdist}% - \relax % + % Math + \gre@rubberpermit{#1}% + \ifgre@rubber% + % if we have a rubber allowed length we create a temporary skip + \let\gre@scaledist\gre@skip@temp@one% + \edef\gre@convert{\csname gre@space@skip@#1\endcsname}% + \gre@scaledist=\glueexpr(\gre@convert * \number#3 / \number#2)\relax % + \else% + % otherwise we create a temporary dimen + \let\gre@scaledist\gre@dimen@temp@one% + \edef\gre@convert{\csname gre@space@dimen@#1\endcsname}% + \gre@scaledist=\dimexpr(\gre@convert * \number#3 / \number#2)\relax % + \fi% + \gre@consistentunits{\gre@convert}{\gre@scaledist}% + \gre@dimension{#1}{\gre@stringdist}% + \relax % }% % This function converts a distance to the units indicated in #1 and returns it as a string. \def\gre@convertto#1#2{% - \gre@debugmsg{general}{convertto (#1) (#2)}% - % \p@ is equal to 1pt and is used here for a more accurate computation - \edef\gre@converted{\gre@strip@pt\dimexpr#2*\p@/\dimexpr 1#1\relax\relax #1}% - \gre@debugmsg{general}{converted value is \gre@converted}% + \gre@debugmsg{general}{convertto (#1) (#2)}% + % \p@ is equal to 1pt and is used here for a more accurate computation + \edef\gre@converted{\gre@strip@pt\dimexpr#2*\p@/\dimexpr 1#1\relax\relax #1}% + \gre@debugmsg{general}{converted value is \gre@converted}% }% % This function takes a distance (#2) and formats it as a string so that its units conform to the pattern set by a string representation of a distance (#1) \newif\ifgre@stretch% \newif\ifgre@shrink% \def\gre@consistentunits#1#2{% - \gre@stretchfalse% - \gre@shrinkfalse% - \IfSubStr{#1}{plus}{\gre@stretchtrue}{\relax}% - \IfSubStr{#1}{minus}{\gre@shrinktrue}{\relax}% - \ifgre@stretch% - \ifgre@shrink% - %rubber with both stretch and shrink - \StrBefore{#1}{plus}[\gre@baseunit]% - \StrBetween{#1}{plus}{minus}[\gre@stretchunit]% - \StrBehind{#1}{minus}[\gre@shrinkunit]% - \else% - %rubber with stretch only - \StrBefore{#1}{plus}[\gre@baseunit]% - \StrBehind{#1}{plus}[\gre@stretchunit]% - \def\gre@shrinkunit{\relax}% - \fi% - \else% - \ifgre@shrink% - %rubber with shrink only - \StrBefore{#1}{minus}[\gre@baseunit]% - \def\gre@stretchunit{\relax}% - \StrBehind{#1}{minus}[\gre@shrinkunit]% - \else% - %non-rubber - \def\gre@baseunit{#1}% - \def\gre@stretchunit{\relax}% - \def\gre@shrinkunit{\relax}% - \fi% - \fi% - \StrDel{\gre@baseunit}{ }[\gre@baseunit]% - \StrRight{\gre@baseunit}{2}[\gre@baseunit]% - \StrDel{\gre@stretchunit}{ }[\gre@stretchunit]% - \StrRight{\gre@stretchunit}{2}[\gre@stretchunit]% - \StrDel{\gre@shrinkunit}{ }[\gre@shrinkunit]% - \StrRight{\gre@shrinkunit}{2}[\gre@shrinkunit]% - \gre@convertto{\gre@baseunit}{\dimexpr#2\relax}% - \edef\gre@stringdist{\gre@converted}% - \if\relax\gre@stretchunit\else% - \gre@convertto{\gre@stretchunit}{\gluestretch#2}% - \edef\gre@stringdist{\gre@stringdist plus \gre@converted}% - \fi% - \if\relax\gre@shrinkunit\else% - \gre@convertto{\gre@shrinkunit}{\glueshrink#2}% - \edef\gre@stringdist{\gre@stringdist minus \gre@converted}% - \fi% + \gre@stretchfalse% + \gre@shrinkfalse% + \IfSubStr{#1}{plus}{\gre@stretchtrue}{\relax}% + \IfSubStr{#1}{minus}{\gre@shrinktrue}{\relax}% + \ifgre@stretch% + \ifgre@shrink% + %rubber with both stretch and shrink + \StrBefore{#1}{plus}[\gre@baseunit]% + \StrBetween{#1}{plus}{minus}[\gre@stretchunit]% + \StrBehind{#1}{minus}[\gre@shrinkunit]% + \else% + %rubber with stretch only + \StrBefore{#1}{plus}[\gre@baseunit]% + \StrBehind{#1}{plus}[\gre@stretchunit]% + \def\gre@shrinkunit{\relax}% + \fi% + \else% + \ifgre@shrink% + %rubber with shrink only + \StrBefore{#1}{minus}[\gre@baseunit]% + \def\gre@stretchunit{\relax}% + \StrBehind{#1}{minus}[\gre@shrinkunit]% + \else% + %non-rubber + \def\gre@baseunit{#1}% + \def\gre@stretchunit{\relax}% + \def\gre@shrinkunit{\relax}% + \fi% + \fi% + \StrDel{\gre@baseunit}{ }[\gre@baseunit]% + \StrRight{\gre@baseunit}{2}[\gre@baseunit]% + \StrDel{\gre@stretchunit}{ }[\gre@stretchunit]% + \StrRight{\gre@stretchunit}{2}[\gre@stretchunit]% + \StrDel{\gre@shrinkunit}{ }[\gre@shrinkunit]% + \StrRight{\gre@shrinkunit}{2}[\gre@shrinkunit]% + \gre@convertto{\gre@baseunit}{\dimexpr#2\relax}% + \edef\gre@stringdist{\gre@converted}% + \if\relax\gre@stretchunit\else% + \gre@convertto{\gre@stretchunit}{\gluestretch#2}% + \edef\gre@stringdist{\gre@stringdist plus \gre@converted}% + \fi% + \if\relax\gre@shrinkunit\else% + \gre@convertto{\gre@shrinkunit}{\glueshrink#2}% + \edef\gre@stringdist{\gre@stringdist minus \gre@converted}% + \fi% }% @@ -1483,342 +1536,309 @@ %% simply by dividing them by the old factor, and multiplying them by the new one. % #1 is the old gre@factor, #2 is the new one \def\gre@changedimenfactor#1#2{% - \ifgre@scale@additionallineswidth% - \gre@changeonedimenfactor{additionallineswidth}{#1}{#2}% - \fi% - \ifgre@scale@additionalcustoslineswidth% - \gre@changeonedimenfactor{additionalcustoslineswidth}{#1}{#2}% - \fi% - \ifgre@scale@zerowidthspace% - \gre@changeonedimenfactor{zerowidthspace}{#1}{#2}% - \fi% - \ifgre@scale@interglyphspace% - \gre@changeonedimenfactor{interglyphspace}{#1}{#2}% - \fi% - \ifgre@scale@alterationspace% - \gre@changeonedimenfactor{alterationspace}{#1}{#2}% - \fi% - \ifgre@scale@clefflatspace% - \gre@changeonedimenfactor{clefflatspace}{#1}{#2}% - \fi% - \ifgre@scale@beforelowchoralsignspace% - \gre@changeonedimenfactor{beforelowchoralsignspace}{#1}{#2}% - \fi% - \ifgre@scale@beforealterationspace% - \gre@changeonedimenfactor{beforealterationspace}{#1}{#2}% - \fi% - \ifgre@scale@halfspace% - \gre@changeonedimenfactor{halfspace}{#1}{#2}% - \fi% - \ifgre@scale@interelementspace% - \gre@changeonedimenfactor{interelementspace}{#1}{#2}% - \fi% - \ifgre@scale@largerspace% - \gre@changeonedimenfactor{largerspace}{#1}{#2}% - \fi% - \ifgre@scale@nabcinterelementspace% - \gre@changeonedimenfactor{nabcinterelementspace}{#1}{#2}% - \fi% - \ifgre@scale@nabclargerspace% - \gre@changeonedimenfactor{nabclargerspace}{#1}{#2}% - \fi% - \ifgre@scale@glyphspace% - \gre@changeonedimenfactor{glyphspace}{#1}{#2}% - \fi% - \ifgre@scale@spacebeforeinlinecustos% - \gre@changeonedimenfactor{spacebeforeinlinecustos}{#1}{#2}% - \fi% - \ifgre@scale@spacebeforeeolcustos% - \gre@changeonedimenfactor{spacebeforeeolcustos}{#1}{#2}% - \fi% - \ifgre@scale@spacebeforesigns% - \gre@changeonedimenfactor{spacebeforesigns}{#1}{#2}% - \fi% - \ifgre@scale@spaceaftersigns% - \gre@changeonedimenfactor{spaceaftersigns}{#1}{#2}% - \fi% - \ifgre@scale@spaceafterlineclef% - \gre@changeonedimenfactor{spaceafterlineclef}{#1}{#2}% - \fi% - \ifgre@scale@interwordspacenotes% - \gre@changeonedimenfactor{interwordspacenotes}{#1}{#2}% - \fi% - \ifgre@scale@intersyllablespacenotes% - \gre@changeonedimenfactor{intersyllablespacenotes}{#1}{#2}% - \fi% - \ifgre@scale@interwordspacenotes@alteration% - \gre@changeonedimenfactor{interwordspacenotes@alteration}{#1}{#2}% - \fi% - \ifgre@scale@intersyllablespacenotes@alteration% - \gre@changeonedimenfactor{intersyllablespacenotes@alteration}{#1}{#2}% - \fi% - \ifgre@scale@intersyllablespacestretchhyphen% - \gre@changeonedimenfactor{intersyllablespacestretchhyphen}{#1}{#2}% - \fi% - \ifgre@scale@interwordspacetext% - \gre@changeonedimenfactor{interwordspacetext}{#1}{#2}% - \fi% - \ifgre@scale@interwordspacetext@bars% - \gre@changeonedimenfactor{interwordspacetext@bars}{#1}{#2}% - \fi% - \ifgre@scale@interwordspacetext@bars@notext% - \gre@changeonedimenfactor{interwordspacetext@bars@notext}{#1}{#2}% - \fi% - \ifgre@scale@interwordspacenotes@euouae% - \gre@changeonedimenfactor{interwordspacenotes@euouae}{#1}{#2}% - \fi% - \ifgre@scale@interwordspacetext@euouae% - \gre@changeonedimenfactor{interwordspacetext@euouae}{#1}{#2}% - \fi% - \ifgre@scale@interwordspacetext@bars@euouae% - \gre@changeonedimenfactor{interwordspacetext@bars@euouae}{#1}{#2}% - \fi% - \ifgre@scale@interwordspacetext@bars@notext@euouae% - \gre@changeonedimenfactor{interwordspacetext@bars@notext@euouae}{#1}{#2}% - \fi% - \ifgre@scale@bitrivirspace% - \gre@changeonedimenfactor{bitrivirspace}{#1}{#2}% - \fi% - \ifgre@scale@bitristrospace% - \gre@changeonedimenfactor{bitristrospace}{#1}{#2}% - \fi% - \ifgre@scale@punctuminclinatumshift% - \gre@changeonedimenfactor{punctuminclinatumshift}{#1}{#2}% - \fi% - \ifgre@scale@ascendingpunctuminclinatumshift% - \gre@changeonedimenfactor{ascendingpunctuminclinatumshift}{#1}{#2}% - \fi% - \ifgre@scale@beforepunctainclinatashift% - \gre@changeonedimenfactor{beforepunctainclinatashift}{#1}{#2}% - \fi% - \ifgre@scale@punctuminclinatumanddebilisshift% - \gre@changeonedimenfactor{punctuminclinatumanddebilisshift}{#1}{#2}% - \fi% - \ifgre@scale@ascendingpunctuminclinatumanddebilisshift% - \gre@changeonedimenfactor{ascendingpunctuminclinatumanddebilisshift}{#1}{#2}% - \fi% - \ifgre@scale@punctuminclinatumdebilisshift% - \gre@changeonedimenfactor{punctuminclinatumdebilisshift}{#1}{#2}% - \fi% - \ifgre@scale@punctuminclinatumbigshift% - \gre@changeonedimenfactor{punctuminclinatumbigshift}{#1}{#2}% - \fi% - \ifgre@scale@ascendingpunctuminclinatumbigshift% - \gre@changeonedimenfactor{ascendingpunctuminclinatumbigshift}{#1}{#2}% - \fi% - \ifgre@scale@punctuminclinatummaxshift% - \gre@changeonedimenfactor{punctuminclinatummaxshift}{#1}{#2}% - \fi% - \ifgre@scale@ascendingpunctuminclinatummaxshift% - \gre@changeonedimenfactor{ascendingpunctuminclinatummaxshift}{#1}{#2}% - \fi% - \ifgre@scale@descendinginclinatumtonobarshift% - \gre@changeonedimenfactor{descendinginclinatumtonobarshift}{#1}{#2}% - \fi% - \ifgre@scale@descendinginclinatumtonobarbigshift% - \gre@changeonedimenfactor{descendinginclinatumtonobarbigshift}{#1}{#2}% - \fi% - \ifgre@scale@descendinginclinatumtonobarmaxshift% - \gre@changeonedimenfactor{descendinginclinatumtonobarmaxshift}{#1}{#2}% - \fi% - \ifgre@scale@ascendinginclinatumtonobarshift% - \gre@changeonedimenfactor{ascendinginclinatumtonobarshift}{#1}{#2}% - \fi% - \ifgre@scale@ascendinginclinatumtonobarbigshift% - \gre@changeonedimenfactor{ascendinginclinatumtonobarbigshift}{#1}{#2}% - \fi% - \ifgre@scale@ascendinginclinatumtonobarmaxshift% - \gre@changeonedimenfactor{ascendinginclinatumtonobarmaxshift}{#1}{#2}% - \fi% - \ifgre@scale@bar@virgula% - \gre@changeonedimenfactor{bar@virgula}{#1}{#2}% - \fi% - \ifgre@scale@bar@minima% - \gre@changeonedimenfactor{bar@minima}{#1}{#2}% - \fi% - \ifgre@scale@bar@minor% - \gre@changeonedimenfactor{bar@minor}{#1}{#2}% - \fi% - \ifgre@scale@bar@minor% - \gre@changeonedimenfactor{bar@dominican}{#1}{#2}% - \fi% - \ifgre@scale@bar@maior% - \gre@changeonedimenfactor{bar@maior}{#1}{#2}% - \fi% - \ifgre@scale@bar@finalis% - \gre@changeonedimenfactor{bar@finalis}{#1}{#2}% - \fi% - \ifgre@scale@bar@finalfinalis% - \gre@changeonedimenfactor{bar@finalfinalis}{#1}{#2}% - \fi% - \ifgre@scale@bar@virgula@standalone@text% - \gre@changeonedimenfactor{bar@virgula@standalone@text}{#1}{#2}% - \fi% - \ifgre@scale@bar@minima@standalone@text% - \gre@changeonedimenfactor{bar@minima@standalone@text}{#1}{#2}% - \fi% - \ifgre@scale@bar@minor@standalone@text% - \gre@changeonedimenfactor{bar@minor@standalone@text}{#1}{#2}% - \fi% - \ifgre@scale@bar@minor@standalone@text% - \gre@changeonedimenfactor{bar@dominican@standalone@text}{#1}{#2}% - \fi% - \ifgre@scale@bar@maior@standalone@text% - \gre@changeonedimenfactor{bar@maior@standalone@text}{#1}{#2}% - \fi% - \ifgre@scale@bar@finalis@standalone@text% - \gre@changeonedimenfactor{bar@finalis@standalone@text}{#1}{#2}% - \fi% - \ifgre@scale@bar@virgula@standalone@notext% - \gre@changeonedimenfactor{bar@virgula@standalone@notext}{#1}{#2}% - \fi% - \ifgre@scale@bar@minima@standalone@notext% - \gre@changeonedimenfactor{bar@minima@standalone@notext}{#1}{#2}% - \fi% - \ifgre@scale@bar@minor@standalone@notext% - \gre@changeonedimenfactor{bar@minor@standalone@notext}{#1}{#2}% - \fi% - \ifgre@scale@bar@minor@standalone@notext% - \gre@changeonedimenfactor{bar@dominican@standalone@notext}{#1}{#2}% - \fi% - \ifgre@scale@bar@maior@standalone@notext% - \gre@changeonedimenfactor{bar@maior@standalone@notext}{#1}{#2}% - \fi% - \ifgre@scale@bar@finalis@standalone@notext% - \gre@changeonedimenfactor{bar@finalis@standalone@notext}{#1}{#2}% - \fi% - \ifgre@scale@spacearoundclefbars% - \gre@changeonedimenfactor{spacearoundclefbars}{#1}{#2}% - \fi% - \ifgre@scale@textbartextspace% - \gre@changeonedimenfactor{textbartextspace}{#1}{#2}% - \fi% - \ifgre@scale@notebarspace% - \gre@changeonedimenfactor{notebarspace}{#1}{#2}% - \fi% - \ifgre@scale@maximumspacewithoutdash% - \gre@changeonedimenfactor{maximumspacewithoutdash}{#1}{#2}% - \fi% - \ifgre@scale@afterclefnospace% - \gre@changeonedimenfactor{afterclefnospace}{#1}{#2}% - \fi% - \ifgre@scale@afterinitialshift% - \gre@changeonedimenfactor{afterinitialshift}{#1}{#2}% - \fi% - \ifgre@scale@beforeinitialshift% - \gre@changeonedimenfactor{beforeinitialshift}{#1}{#2}% - \fi% - \ifgre@scale@minimalspaceatlinebeginning% - \gre@changeonedimenfactor{minimalspaceatlinebeginning}{#1}{#2}% - \fi% - \ifgre@scale@manualinitialwidth% - \gre@changeonedimenfactor{manualinitialwidth}{#1}{#2}% - \fi% - \ifgre@scale@annotationseparation% - \gre@changeonedimenfactor{annotationseparation}{#1}{#2}% - \fi% - \ifgre@scale@annotationraise% - \gre@changeonedimenfactor{annotationraise}{#1}{#2}% - \fi% - \ifgre@scale@noclefspace% - \gre@changeonedimenfactor{noclefspace}{#1}{#2}% - \fi% - \ifgre@scale@clefchangespace% - \gre@changeonedimenfactor{clefchangespace}{#1}{#2}% - \fi% - \ifgre@scale@clivisalignmentmin% - \gre@changeonedimenfactor{clivisalignmentmin}{#1}{#2}% - \fi% - \ifgre@scale@choralsigndownshift% - \gre@changeonedimenfactor{choralsigndownshift}{#1}{#2}% - \fi% - \ifgre@scale@choralsignupshift% - \gre@changeonedimenfactor{choralsignupshift}{#1}{#2}% - \fi% - \ifgre@scale@translationheight% - \gre@changeonedimenfactor{translationheight}{#1}{#2}% - \fi% - \ifgre@scale@spaceabovelines% - \gre@changeonedimenfactor{spaceabovelines}{#1}{#2}% - \fi% - \ifgre@scale@spacelinestext% - \gre@changeonedimenfactor{spacelinestext}{#1}{#2}% - \fi% - \ifgre@scale@spacebeneathtext% - \gre@changeonedimenfactor{spacebeneathtext}{#1}{#2}% - \fi% - \ifgre@scale@abovelinestextraise% - \gre@changeonedimenfactor{abovelinestextraise}{#1}{#2}% - \fi% - \ifgre@scale@abovelinestextheight% - \gre@changeonedimenfactor{abovelinestextheight}{#1}{#2}% - \fi% - \ifgre@scale@braceshift% - \gre@changeonedimenfactor{braceshift}{#1}{#2}% - \fi% - \ifgre@scale@curlybraceaccentusshift% - \gre@changeonedimenfactor{curlybraceaccentusshift}{#1}{#2}% - \fi% - \ifgre@scale@maxbaroffsettextright% - \gre@changeonedimenfactor{maxbaroffsettextright}{#1}{#2}% - \fi% - \ifgre@scale@maxbaroffsettextleft% - \gre@changeonedimenfactor{maxbaroffsettextleft}{#1}{#2}% - \fi% - \ifgre@scale@maxbaroffsettextright@nobar% - \gre@changeonedimenfactor{maxbaroffsettextright@nobar}{#1}{#2}% - \fi% - \ifgre@scale@maxbaroffsettextleft@nobar% - \gre@changeonedimenfactor{maxbaroffsettextleft@nobar}{#1}{#2}% - \fi% - \ifgre@scale@maxbaroffsettextleft@eol% - \gre@changeonedimenfactor{maxbaroffsettextleft@eol}{#1}{#2}% - \fi% - \ifgre@scale@maxbaroffsettextright@eol% - \gre@changeonedimenfactor{maxbaroffsettextright@eol}{#1}{#2}% - \fi% - \ifgre@scale@bar@rubber% - \gre@changeonedimenfactor{bar@rubber}{#1}{#2}% - \fi% - \ifgre@scale@divisiofinalissep% - \gre@changeonedimenfactor{divisiofinalissep}{#1}{#2}% - \fi% - \ifgre@scale@stafflinefactor% - \gre@count@temp@two = \numexpr((\gre@stafflinefactor * #2) / #1)\relax% - \xdef\gre@stafflinefactor{\the\gre@count@temp@two}% - \fi% - \relax % -}% - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Some Macros for changing the spacing around the initial -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%Seeing as these are the distances that people will want to change the most often, -%we give them their own set of macros to make that easier. - -% To change the spacing between annotations. -%First argument is distance, second is whether it should scale when \gre@factor changes. -\def\setaboveinitialseparation#1#2{%OBSOLETE - \gre@obsolete{\protect\setaboveinitialseparation}{\protect\grechangedim\{annotationseparation\}}% -}% - - -%To change the space after the initial -%First argument is distance, second is whether it should scale when \gre@factor changes. -\def\setspaceafterinitial#1#2{%OBSOLETE - \gre@obsolete{\protect\setspaceafterinitial}{\protect\grechangedim{afterinitialshift}}% -} - -%To change the space before the initial -%First argument is distance, second is whether it should scale when \gre@factor changes. -\def\setspacebeforeinitial#1#2{%OBSOLETE - \gre@obsolete{\protect\setspacebeforeinitial}{\protect\grechangedim{beforeinitialshift}}% -}% - - -%To change all the distances associated with the initial. -%First three arguments are distances, last is whether they should scale when \gre@factor changes. -\def\setinitialspacing#1#2#3#4{%OBSOLETE - \gre@obsolete{\protect\setinitialspacing}{\protect\grechangedim{beforeinitialshift}, \protect\grechangedim{manualinitialwidth}, and \protect\grechangedim{afterinitialshift}}% + \ifgre@scale@additionallineswidth% + \gre@changeonedimenfactor{additionallineswidth}{#1}{#2}% + \fi% + \ifgre@scale@additionalcustoslineswidth% + \gre@changeonedimenfactor{additionalcustoslineswidth}{#1}{#2}% + \fi% + \ifgre@scale@zerowidthspace% + \gre@changeonedimenfactor{zerowidthspace}{#1}{#2}% + \fi% + \ifgre@scale@interglyphspace% + \gre@changeonedimenfactor{interglyphspace}{#1}{#2}% + \fi% + \ifgre@scale@alterationspace% + \gre@changeonedimenfactor{alterationspace}{#1}{#2}% + \fi% + \ifgre@scale@clefflatspace% + \gre@changeonedimenfactor{clefflatspace}{#1}{#2}% + \fi% + \ifgre@scale@beforelowchoralsignspace% + \gre@changeonedimenfactor{beforelowchoralsignspace}{#1}{#2}% + \fi% + \ifgre@scale@beforealterationspace% + \gre@changeonedimenfactor{beforealterationspace}{#1}{#2}% + \fi% + \ifgre@scale@halfspace% + \gre@changeonedimenfactor{halfspace}{#1}{#2}% + \fi% + \ifgre@scale@interelementspace% + \gre@changeonedimenfactor{interelementspace}{#1}{#2}% + \fi% + \ifgre@scale@largerspace% + \gre@changeonedimenfactor{largerspace}{#1}{#2}% + \fi% + \ifgre@scale@nabcinterelementspace% + \gre@changeonedimenfactor{nabcinterelementspace}{#1}{#2}% + \fi% + \ifgre@scale@nabclargerspace% + \gre@changeonedimenfactor{nabclargerspace}{#1}{#2}% + \fi% + \ifgre@scale@glyphspace% + \gre@changeonedimenfactor{glyphspace}{#1}{#2}% + \fi% + \ifgre@scale@spacebeforeinlinecustos% + \gre@changeonedimenfactor{spacebeforeinlinecustos}{#1}{#2}% + \fi% + \ifgre@scale@spacebeforeeolcustos% + \gre@changeonedimenfactor{spacebeforeeolcustos}{#1}{#2}% + \fi% + \ifgre@scale@spacebeforesigns% + \gre@changeonedimenfactor{spacebeforesigns}{#1}{#2}% + \fi% + \ifgre@scale@spaceaftersigns% + \gre@changeonedimenfactor{spaceaftersigns}{#1}{#2}% + \fi% + \ifgre@scale@spaceafterlineclef% + \gre@changeonedimenfactor{spaceafterlineclef}{#1}{#2}% + \fi% + \ifgre@scale@interwordspacenotes% + \gre@changeonedimenfactor{interwordspacenotes}{#1}{#2}% + \fi% + \ifgre@scale@intersyllablespacenotes% + \gre@changeonedimenfactor{intersyllablespacenotes}{#1}{#2}% + \fi% + \ifgre@scale@interwordspacenotes@alteration% + \gre@changeonedimenfactor{interwordspacenotes@alteration}{#1}{#2}% + \fi% + \ifgre@scale@intersyllablespacenotes@alteration% + \gre@changeonedimenfactor{intersyllablespacenotes@alteration}{#1}{#2}% + \fi% + \ifgre@scale@intersyllablespacestretchhyphen% + \gre@changeonedimenfactor{intersyllablespacestretchhyphen}{#1}{#2}% + \fi% + \ifgre@scale@interwordspacetext% + \gre@changeonedimenfactor{interwordspacetext}{#1}{#2}% + \fi% + \ifgre@scale@interwordspacetext@bars% + \gre@changeonedimenfactor{interwordspacetext@bars}{#1}{#2}% + \fi% + \ifgre@scale@interwordspacetext@bars@notext% + \gre@changeonedimenfactor{interwordspacetext@bars@notext}{#1}{#2}% + \fi% + \ifgre@scale@interwordspacenotes@euouae% + \gre@changeonedimenfactor{interwordspacenotes@euouae}{#1}{#2}% + \fi% + \ifgre@scale@interwordspacetext@euouae% + \gre@changeonedimenfactor{interwordspacetext@euouae}{#1}{#2}% + \fi% + \ifgre@scale@interwordspacetext@bars@euouae% + \gre@changeonedimenfactor{interwordspacetext@bars@euouae}{#1}{#2}% + \fi% + \ifgre@scale@interwordspacetext@bars@notext@euouae% + \gre@changeonedimenfactor{interwordspacetext@bars@notext@euouae}{#1}{#2}% + \fi% + \ifgre@scale@bitrivirspace% + \gre@changeonedimenfactor{bitrivirspace}{#1}{#2}% + \fi% + \ifgre@scale@bitristrospace% + \gre@changeonedimenfactor{bitristrospace}{#1}{#2}% + \fi% + \ifgre@scale@punctuminclinatumshift% + \gre@changeonedimenfactor{punctuminclinatumshift}{#1}{#2}% + \fi% + \ifgre@scale@ascendingpunctuminclinatumshift% + \gre@changeonedimenfactor{ascendingpunctuminclinatumshift}{#1}{#2}% + \fi% + \ifgre@scale@beforepunctainclinatashift% + \gre@changeonedimenfactor{beforepunctainclinatashift}{#1}{#2}% + \fi% + \ifgre@scale@punctuminclinatumanddebilisshift% + \gre@changeonedimenfactor{punctuminclinatumanddebilisshift}{#1}{#2}% + \fi% + \ifgre@scale@ascendingpunctuminclinatumanddebilisshift% + \gre@changeonedimenfactor{ascendingpunctuminclinatumanddebilisshift}{#1}{#2}% + \fi% + \ifgre@scale@punctuminclinatumdebilisshift% + \gre@changeonedimenfactor{punctuminclinatumdebilisshift}{#1}{#2}% + \fi% + \ifgre@scale@punctuminclinatumbigshift% + \gre@changeonedimenfactor{punctuminclinatumbigshift}{#1}{#2}% + \fi% + \ifgre@scale@ascendingpunctuminclinatumbigshift% + \gre@changeonedimenfactor{ascendingpunctuminclinatumbigshift}{#1}{#2}% + \fi% + \ifgre@scale@punctuminclinatummaxshift% + \gre@changeonedimenfactor{punctuminclinatummaxshift}{#1}{#2}% + \fi% + \ifgre@scale@ascendingpunctuminclinatummaxshift% + \gre@changeonedimenfactor{ascendingpunctuminclinatummaxshift}{#1}{#2}% + \fi% + \ifgre@scale@descendinginclinatumtonobarshift% + \gre@changeonedimenfactor{descendinginclinatumtonobarshift}{#1}{#2}% + \fi% + \ifgre@scale@descendinginclinatumtonobarbigshift% + \gre@changeonedimenfactor{descendinginclinatumtonobarbigshift}{#1}{#2}% + \fi% + \ifgre@scale@descendinginclinatumtonobarmaxshift% + \gre@changeonedimenfactor{descendinginclinatumtonobarmaxshift}{#1}{#2}% + \fi% + \ifgre@scale@ascendinginclinatumtonobarshift% + \gre@changeonedimenfactor{ascendinginclinatumtonobarshift}{#1}{#2}% + \fi% + \ifgre@scale@ascendinginclinatumtonobarbigshift% + \gre@changeonedimenfactor{ascendinginclinatumtonobarbigshift}{#1}{#2}% + \fi% + \ifgre@scale@ascendinginclinatumtonobarmaxshift% + \gre@changeonedimenfactor{ascendinginclinatumtonobarmaxshift}{#1}{#2}% + \fi% + \ifgre@scale@bar@virgula% + \gre@changeonedimenfactor{bar@virgula}{#1}{#2}% + \fi% + \ifgre@scale@bar@minima% + \gre@changeonedimenfactor{bar@minima}{#1}{#2}% + \fi% + \ifgre@scale@bar@minor% + \gre@changeonedimenfactor{bar@minor}{#1}{#2}% + \fi% + \ifgre@scale@bar@minor% + \gre@changeonedimenfactor{bar@dominican}{#1}{#2}% + \fi% + \ifgre@scale@bar@maior% + \gre@changeonedimenfactor{bar@maior}{#1}{#2}% + \fi% + \ifgre@scale@bar@finalis% + \gre@changeonedimenfactor{bar@finalis}{#1}{#2}% + \fi% + \ifgre@scale@bar@finalfinalis% + \gre@changeonedimenfactor{bar@finalfinalis}{#1}{#2}% + \fi% + \ifgre@scale@bar@virgula@standalone@text% + \gre@changeonedimenfactor{bar@virgula@standalone@text}{#1}{#2}% + \fi% + \ifgre@scale@bar@minima@standalone@text% + \gre@changeonedimenfactor{bar@minima@standalone@text}{#1}{#2}% + \fi% + \ifgre@scale@bar@minor@standalone@text% + \gre@changeonedimenfactor{bar@minor@standalone@text}{#1}{#2}% + \fi% + \ifgre@scale@bar@minor@standalone@text% + \gre@changeonedimenfactor{bar@dominican@standalone@text}{#1}{#2}% + \fi% + \ifgre@scale@bar@maior@standalone@text% + \gre@changeonedimenfactor{bar@maior@standalone@text}{#1}{#2}% + \fi% + \ifgre@scale@bar@finalis@standalone@text% + \gre@changeonedimenfactor{bar@finalis@standalone@text}{#1}{#2}% + \fi% + \ifgre@scale@bar@virgula@standalone@notext% + \gre@changeonedimenfactor{bar@virgula@standalone@notext}{#1}{#2}% + \fi% + \ifgre@scale@bar@minima@standalone@notext% + \gre@changeonedimenfactor{bar@minima@standalone@notext}{#1}{#2}% + \fi% + \ifgre@scale@bar@minor@standalone@notext% + \gre@changeonedimenfactor{bar@minor@standalone@notext}{#1}{#2}% + \fi% + \ifgre@scale@bar@minor@standalone@notext% + \gre@changeonedimenfactor{bar@dominican@standalone@notext}{#1}{#2}% + \fi% + \ifgre@scale@bar@maior@standalone@notext% + \gre@changeonedimenfactor{bar@maior@standalone@notext}{#1}{#2}% + \fi% + \ifgre@scale@bar@finalis@standalone@notext% + \gre@changeonedimenfactor{bar@finalis@standalone@notext}{#1}{#2}% + \fi% + \ifgre@scale@spacearoundclefbars% + \gre@changeonedimenfactor{spacearoundclefbars}{#1}{#2}% + \fi% + \ifgre@scale@textbartextspace% + \gre@changeonedimenfactor{textbartextspace}{#1}{#2}% + \fi% + \ifgre@scale@notebarspace% + \gre@changeonedimenfactor{notebarspace}{#1}{#2}% + \fi% + \ifgre@scale@maximumspacewithoutdash% + \gre@changeonedimenfactor{maximumspacewithoutdash}{#1}{#2}% + \fi% + \ifgre@scale@afterclefnospace% + \gre@changeonedimenfactor{afterclefnospace}{#1}{#2}% + \fi% + \ifgre@scale@afterinitialshift% + \gre@changeonedimenfactor{afterinitialshift}{#1}{#2}% + \fi% + \ifgre@scale@beforeinitialshift% + \gre@changeonedimenfactor{beforeinitialshift}{#1}{#2}% + \fi% + \ifgre@scale@minimalspaceatlinebeginning% + \gre@changeonedimenfactor{minimalspaceatlinebeginning}{#1}{#2}% + \fi% + \ifgre@scale@manualinitialwidth% + \gre@changeonedimenfactor{manualinitialwidth}{#1}{#2}% + \fi% + \ifgre@scale@annotationseparation% + \gre@changeonedimenfactor{annotationseparation}{#1}{#2}% + \fi% + \ifgre@scale@annotationraise% + \gre@changeonedimenfactor{annotationraise}{#1}{#2}% + \fi% + \ifgre@scale@noclefspace% + \gre@changeonedimenfactor{noclefspace}{#1}{#2}% + \fi% + \ifgre@scale@clefchangespace% + \gre@changeonedimenfactor{clefchangespace}{#1}{#2}% + \fi% + \ifgre@scale@clivisalignmentmin% + \gre@changeonedimenfactor{clivisalignmentmin}{#1}{#2}% + \fi% + \ifgre@scale@choralsigndownshift% + \gre@changeonedimenfactor{choralsigndownshift}{#1}{#2}% + \fi% + \ifgre@scale@choralsignupshift% + \gre@changeonedimenfactor{choralsignupshift}{#1}{#2}% + \fi% + \ifgre@scale@translationheight% + \gre@changeonedimenfactor{translationheight}{#1}{#2}% + \fi% + \ifgre@scale@spaceabovelines% + \gre@changeonedimenfactor{spaceabovelines}{#1}{#2}% + \fi% + \ifgre@scale@spacelinestext% + \gre@changeonedimenfactor{spacelinestext}{#1}{#2}% + \fi% + \ifgre@scale@spacebeneathtext% + \gre@changeonedimenfactor{spacebeneathtext}{#1}{#2}% + \fi% + \ifgre@scale@abovelinestextraise% + \gre@changeonedimenfactor{abovelinestextraise}{#1}{#2}% + \fi% + \ifgre@scale@abovelinestextheight% + \gre@changeonedimenfactor{abovelinestextheight}{#1}{#2}% + \fi% + \ifgre@scale@braceshift% + \gre@changeonedimenfactor{braceshift}{#1}{#2}% + \fi% + \ifgre@scale@curlybraceaccentusshift% + \gre@changeonedimenfactor{curlybraceaccentusshift}{#1}{#2}% + \fi% + \ifgre@scale@maxbaroffsettextright% + \gre@changeonedimenfactor{maxbaroffsettextright}{#1}{#2}% + \fi% + \ifgre@scale@maxbaroffsettextleft% + \gre@changeonedimenfactor{maxbaroffsettextleft}{#1}{#2}% + \fi% + \ifgre@scale@maxbaroffsettextright@nobar% + \gre@changeonedimenfactor{maxbaroffsettextright@nobar}{#1}{#2}% + \fi% + \ifgre@scale@maxbaroffsettextleft@nobar% + \gre@changeonedimenfactor{maxbaroffsettextleft@nobar}{#1}{#2}% + \fi% + \ifgre@scale@maxbaroffsettextleft@eol% + \gre@changeonedimenfactor{maxbaroffsettextleft@eol}{#1}{#2}% + \fi% + \ifgre@scale@maxbaroffsettextright@eol% + \gre@changeonedimenfactor{maxbaroffsettextright@eol}{#1}{#2}% + \fi% + \ifgre@scale@bar@rubber% + \gre@changeonedimenfactor{bar@rubber}{#1}{#2}% + \fi% + \ifgre@scale@divisiofinalissep% + \gre@changeonedimenfactor{divisiofinalissep}{#1}{#2}% + \fi% + \ifgre@scale@stafflinefactor% + \gre@count@temp@two = \numexpr((\gre@stafflinefactor * #2) / #1)\relax% + \xdef\gre@stafflinefactor{\the\gre@count@temp@two}% + \fi% + \relax % }% diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-syllable.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-syllable.tex index 2c3a9e08f83..b8afe707735 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-syllable.tex +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-syllable.tex @@ -20,7 +20,7 @@ % this file contains definitions of the glyphs and the syllables \gre@debugmsg{general}{Loading gregoriotex-syllable.tex}% -\gre@declarefileversion{gregoriotex-syllable.tex}{4.1.1}% GREGORIO_VERSION +\gre@declarefileversion{gregoriotex-syllable.tex}{4.2.0-beta1}% GREGORIO_VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% macros for the typesetting of the different glyphs @@ -42,88 +42,88 @@ \newcount\gre@generate@pointandclick\gre@generate@pointandclick=0\relax % \def\gresetpointandclick#1{% - \IfStrEqCase{#1}{% - {on}% - {% - \ifx\pdfoutput\undefined % - \gre@warning{Unable to enable point-and-click because \protect\pdfoutput \MessageBreak is not defined}% - \gre@generate@pointandclick=0\relax % - \else % - \ifnum\pdfoutput=1\relax % - \gre@generate@pointandclick=1\relax % - \else % - \gre@warning{Unable to enable point-and-click when not\MessageBreak generating a PDF}% - \gre@generate@pointandclick=0\relax % - \fi % - \fi % - }% - {off}% - {\gre@generate@pointandclick=0\relax}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetpointandclick\MessageBreak Possible options are: 'on' and 'off'}% - ]% + \IfStrEqCase{#1}{% + {on}% + {% + \ifx\pdfoutput\undefined % + \gre@warning{Unable to enable point-and-click because \protect\pdfoutput \MessageBreak is not defined}% + \gre@generate@pointandclick=0\relax % + \else % + \ifnum\pdfoutput=1\relax % + \gre@generate@pointandclick=1\relax % + \else % + \gre@warning{Unable to enable point-and-click when not\MessageBreak generating a PDF}% + \gre@generate@pointandclick=0\relax % + \fi % + \fi % + }% + {off}% + {\gre@generate@pointandclick=0\relax}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetpointandclick\MessageBreak Possible options are: 'on' and 'off'}% + ]% }% \def\gre@pointandclick#1#2{% - \def\gre@@arg{#2}% - \ifx\gre@@arg\gre@nothing % - #1% - \else % - \def\gre@@arg{\gre@gabcname}% - \ifx\gre@@arg\gre@nothing % - #1% - \else % - \ifnum\gre@generate@pointandclick=1\relax % - \pdfstartlink user{% - /Subtype/Link/Border[0 0 0]% - /A<</Type/Action/S/URI/URI(textedit://\gre@gabcname:#2)>>% - }% - #1% - \pdfendlink % - \else % - #1% - \fi % - \fi % - \fi % + \def\gre@@arg{#2}% + \ifx\gre@@arg\gre@nothing % + #1% + \else % + \def\gre@@arg{\gre@gabcname}% + \ifx\gre@@arg\gre@nothing % + #1% + \else % + \ifnum\gre@generate@pointandclick=1\relax % + \gre@startlink user{% + /Subtype/Link/Border[0 0 0]% + /A<</Type/Action/S/URI/URI(textedit://\gre@gabcname:#2)>>% + }% + #1% + \gre@endlink % + \else % + #1% + \fi % + \fi % + \fi % }% \def\gre@newglyphcommon{% - \global\advance\gre@attr@glyph@id by 1\relax % - % first there is something we must do: setting \gre@lastoflinecount to 0 if its value is 2. The reason of this is that in ab(abzcd), we cannot let \grelastoflinecount set to 2 after the end of line... the only way I found to achieve it is to reset \grelastoflinecount to 0 after each glyph or bar. - \ifnum\gre@lastoflinecount=2\relax % - \global\gre@lastoflinecount=0\relax % - \fi % - \global\gre@skip@bar@lastskip=0pt\relax % - \gre@currenttextabovelines % - \ifcase\gre@count@lastglyphiscavum\or % - \global\gre@count@lastglyphiscavum=2\relax % - \or % - \global\gre@count@lastglyphiscavum=0\relax % - \fi % - \global\gre@lastendswithmorafalse % - \ifgre@boxing\else\ifgre@firstin@euouae % - \ifgre@raggedbreakbeforeeuouae % - \directlua{gregoriotex.save_pos(\the\gre@lasteuouaeindex,2)}% - \fi % - \gre@firstin@euouaefalse % - \fi\fi % - \relax % + \global\advance\gre@attr@glyph@id by 1\relax % + % first there is something we must do: setting \gre@lastoflinecount to 0 if its value is 2. The reason of this is that in ab(abzcd), we cannot let \grelastoflinecount set to 2 after the end of line... the only way I found to achieve it is to reset \grelastoflinecount to 0 after each glyph or bar. + \ifnum\gre@lastoflinecount=2\relax % + \global\gre@lastoflinecount=0\relax % + \fi % + \global\gre@skip@bar@lastskip=0pt\relax % + \gre@currenttextabovelines % + \ifcase\gre@count@lastglyphiscavum\or % + \global\gre@count@lastglyphiscavum=2\relax % + \or % + \global\gre@count@lastglyphiscavum=0\relax % + \fi % + \global\gre@lastendswithmorafalse % + \ifgre@boxing\else\ifgre@firstin@euouae % + \ifgre@raggedbreakbeforeeuouae % + \directlua{gregoriotex.save_euouae(\the\gre@lasteuouaeindex,2)}% + \fi % + \gre@firstin@euouaefalse % + \fi\fi % + \relax % }% \def\gre@endofglyphcommon{% - \ifgre@endofscore % - \gre@penalty{\grefinalpenalty}% - \gre@localleftbox{}% - \gre@localrightbox{}% - \fi % + \ifgre@endofscore % + \gre@penalty{\the\gre@space@count@finalpenalty}% + \gre@localleftbox{}% + \gre@localrightbox{}% + \fi % } % passes the glyph height limits: % #1: the high height % #2: the low height \def\GreGlyphHeights#1#2{% - \global\setluatexattribute\gre@attr@glyph@top{#1}% - \global\setluatexattribute\gre@attr@glyph@bottom{#2}% + \global\setluatexattribute\gre@attr@glyph@top{#1}% + \global\setluatexattribute\gre@attr@glyph@bottom{#2}% }% % Flag that tells us if the current glyph is the first glyph or not. @@ -132,7 +132,7 @@ % macro to typeset the glyph. attributes are : % #1: character : the character that it must call % #2: height : the height it must be raised : can be negative (must be calculated by a preprocessor) -% #3: height of the next note : we define the custos with that +% #3: typesets the next custos % #4: type : the type of glyph, to determine the aligncenter; can be : %%%%%%%% 0 : one-note glyph or more than two notes glyph except porrectus : here we must put the aligncenter in the middle of the first note %%%%%%%% 1 : two notes glyph (podatus is considered as a one-note glyph) : here we put the aligncenter in the middle of the glyph @@ -148,28 +148,28 @@ % #6 are the signs to typeset after the glyph (almost all signs) % #7 is the line:char:column for a textedit link \def\GreGlyph#1#2#3#4#5#6#7{% - \gre@newglyphcommon % - \setbox\gre@box@temp@width=\hbox{\gre@pointandclick{\gre@font@music #1}{#7}}% - \global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % - % the three next lines are a trick to get the additional lines below the glyphs - \gre@skip@temp@one = \gre@dimen@lastglyphwidth\relax% - \kern\gre@skip@temp@one % - #5\relax % - \kern-\gre@skip@temp@one % - \gre@calculate@glyphraisevalue{#2}{0}{}% - \raise\gre@dimen@glyphraisevalue\relax% - \copy\gre@box@temp@width% - \ifgre@endofscore\else\ifgre@boxing\else % - \GreNextCustos{#3}% - \fi\fi % - \ifgre@firstglyph% we check if it is the first glyph - \gre@calculate@notesaligncenter{#4}% - \global\gre@firstglyphfalse% - \fi% - #6\relax % - \directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% - \gre@endofglyphcommon % - \relax% + \gre@newglyphcommon % + \setbox\gre@box@temp@width=\hbox{\gre@pointandclick{\gre@font@music #1}{#7}}% + \global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % + % the three next lines are a trick to get the additional lines below the glyphs + \gre@skip@temp@one = \gre@dimen@lastglyphwidth\relax% + \kern\gre@skip@temp@one % + #5\relax % + \kern-\gre@skip@temp@one % + \gre@calculate@glyphraisevalue{#2}{0}{}% + \raise\gre@dimen@glyphraisevalue\relax% + \copy\gre@box@temp@width% + \ifgre@endofscore\else\ifgre@boxing\else % + #3% + \fi\fi % + \ifgre@firstglyph% we check if it is the first glyph + \gre@calculate@notesaligncenter{#4}% + \global\gre@firstglyphfalse% + \fi% + #6\relax % + \directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% + \gre@endofglyphcommon % + \relax% }% % this function is quite simple, it just sets \gre@box@temp@width with a box of the good width, watch the next function for the complete thing @@ -195,64 +195,64 @@ % there is a tricky here : if notesaligncenter is not 0, it means that there is a flat before, so we simply add notes aligncenter % #2 is 0 if we are in the context of current syllable, 1 if we are in the context of next syllable \def\gre@calculate@simplenotesaligncenter#1#2{% - \ifcase#1% - %case of punctum - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% - \or% - %case of flexus - \gre@handleclivisspecialalignment{\gre@font@music\GreCPPesQuadratumLongqueueThreeNothing}{\gre@font@music\GreCPPunctum}{#2}% - \or% - %case of porrectus (we consider it to have the same alignment as punctum) - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% - \or% - %case of a initio debilis - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctumDeminutus}% - \or % - %case of a quilisma - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPQuilisma}% - \or % - %case of an oriscus - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPOriscus}% - \or % - %case of a punctum inclinatum - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctumInclinatum}% - \or % - %case of a stropha - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPStropha}% - \or % - % case of flexus with ambitus of one - \gre@handleclivisspecialalignment{\gre@font@music\GreCPPesQuadratumLongqueueOneNothing}{\gre@font@music\GreCPPunctum}{#2}% - \or % - % case of flexus deminutus - \gre@handleclivisspecialalignment{\gre@font@music\GreCPFlexusTwoDeminutus}{\gre@font@music\GreCPPunctum}{#2}% - \or % - % case of virgula - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPVirgula}% - \or % - % case of divisio minima - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMinima}% - \or % - % case of divisio minor - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMinor}% - \or % - % case of divisio maior - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMaior}% - \or % - % case of dominican bar - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% - \or % - % case of divisiofinalis - \global\setbox\gre@box@temp@width=\hbox{\gre@fontchar@divisiofinalis}% - \or % - % case of no note - \ifgre@newbarspacing% - \global\setbox\gre@box@temp@width=\hbox{}% - \else% - % under the old algorithm, syllables with no notes triggered a 0 in this function, so we duplicate the first case here - \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% - \fi% - \fi% - \relax% + \ifcase#1% + %case of punctum + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% + \or% + %case of flexus + \gre@handleclivisspecialalignment{\gre@font@music\GreCPPesQuadratumLongqueueThreeNothing}{\gre@font@music\GreCPPunctum}{#2}% + \or% + %case of porrectus (we consider it to have the same alignment as punctum) + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% + \or% + %case of a initio debilis + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctumDeminutus}% + \or % + %case of a quilisma + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPQuilisma}% + \or % + %case of an oriscus + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPAscendensOriscus}% + \or % + %case of a punctum inclinatum + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctumInclinatum}% + \or % + %case of a stropha + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPStropha}% + \or % + % case of flexus with ambitus of one + \gre@handleclivisspecialalignment{\gre@font@music\GreCPPesQuadratumLongqueueOneNothing}{\gre@font@music\GreCPPunctum}{#2}% + \or % + % case of flexus deminutus + \gre@handleclivisspecialalignment{\gre@font@music\GreCPFlexusTwoDeminutus}{\gre@font@music\GreCPPunctum}{#2}% + \or % + % case of virgula + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPVirgula}% + \or % + % case of divisio minima + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMinima}% + \or % + % case of divisio minor + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMinor}% + \or % + % case of divisio maior + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioMaior}% + \or % + % case of dominican bar + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% + \or % + % case of divisiofinalis + \global\setbox\gre@box@temp@width=\hbox{\gre@fontchar@divisiofinalis}% + \or % + % case of no note + \ifgre@newbarspacing% + \global\setbox\gre@box@temp@width=\hbox{}% + \else% + % under the old algorithm, syllables with no notes triggered a 0 in this function, so we duplicate the first case here + \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% + \fi% + \fi% + \relax% }% % aux function to previous one: sets \gre@box@temp@width to \hbox{#1} or \hbox{#2} @@ -270,116 +270,144 @@ % % #3 is the same as #2 of previous function \def\gre@handleclivisspecialalignment#1#2#3{% - \ifcase\gre@clivisalignment% - \global\setbox\gre@box@temp@width=\hbox{#1}% - \or% - \global\setbox\gre@box@temp@width=\hbox{#2}% - \or% - \gre@widthof{#1}% - \divide\gre@dimen@temp@three by 2\relax % - \gre@debugmsg{ifdim}{ temp@three > textaligncenter}% - \ifdim\gre@dimen@temp@three >\gre@dimen@textaligncenter\relax% - \global\setbox\gre@box@temp@width=\hbox{#2}% - \else% - \ifcase\gre@lyriccentering% 0 == syllable centering - \gre@debugmsg{ifdim}{ textaligncenter > clivisalignmentmin}% - \ifdim\gre@dimen@textaligncenter >\gre@space@dimen@clivisalignmentmin\relax% - \global\setbox\gre@box@temp@width=\hbox{#2}% - \else% - \global\setbox\gre@box@temp@width=\hbox{#1}% - \fi% - \else% vowel or first-letter centering - \ifcase#3% - \gre@widthof{\gre@endsyllablepart}% - \else% - \gre@widthof{\gre@nextendsyllablepart}% - \fi% - \gre@debugmsg{ifdim}{ temp@three > clivisalignmentmin}% - \ifdim\gre@dimen@temp@three >\gre@space@dimen@clivisalignmentmin\relax% - \global\setbox\gre@box@temp@width=\hbox{#2}% - \else% - \global\setbox\gre@box@temp@width=\hbox{#1}% - \fi% - \fi% - \fi% - \fi% + \ifcase\gre@clivisalignment% + \global\setbox\gre@box@temp@width=\hbox{#1}% + \or% + \global\setbox\gre@box@temp@width=\hbox{#2}% + \or% + \gre@widthof{#1}% + \divide\gre@dimen@temp@three by 2\relax % + \gre@debugmsg{ifdim}{ temp@three > textaligncenter}% + \ifdim\gre@dimen@temp@three >\gre@dimen@textaligncenter\relax% + \global\setbox\gre@box@temp@width=\hbox{#2}% + \else% + \ifcase\gre@lyriccentering% 0 == syllable centering + \gre@debugmsg{ifdim}{ textaligncenter > clivisalignmentmin}% + \ifdim\gre@dimen@textaligncenter >\gre@space@dimen@clivisalignmentmin\relax% + \global\setbox\gre@box@temp@width=\hbox{#2}% + \else% + \global\setbox\gre@box@temp@width=\hbox{#1}% + \fi% + \else% vowel or first-letter centering + \ifcase#3% + \gre@widthof{\gre@endsyllablepart}% + \else% + \gre@widthof{\gre@nextendsyllablepart}% + \fi% + \gre@debugmsg{ifdim}{ temp@three > clivisalignmentmin}% + \ifdim\gre@dimen@temp@three >\gre@space@dimen@clivisalignmentmin\relax% + \global\setbox\gre@box@temp@width=\hbox{#2}% + \else% + \global\setbox\gre@box@temp@width=\hbox{#1}% + \fi% + \fi% + \fi% + \fi% }% % the "hat" function, that calls the simple function with the good argument, according to the fact that it's a flat, natural, etc. % warning: the behaviour of all this is quite difficult to understand: this function is called with simple arguments (between 0 and 20) by the glyph function. In this case we add the align center of the argument to notesaligncenter ; and notesaligncenter can be already set to something by flat and natural. \def\gre@calculate@notesaligncenter#1{% - \gre@calculate@simplenotesaligncenter{#1}{0}% - \global\advance\gre@dimen@notesaligncenter by \dimexpr(\wd\gre@box@temp@width / 2)\relax % - \relax % + \gre@calculate@simplenotesaligncenter{#1}{0}% + \global\advance\gre@dimen@notesaligncenter by \dimexpr(\wd\gre@box@temp@width / 2)\relax % + \relax % }% % this is the function that we call when we try to determine the next aligncenter of the notes. In this case we call this function with normal arguments if there is no flat nor natural ; we call it with argument + 20 if there is a flat and argument + 40 if there is a natural, +60 with a sharp \def\gre@calculate@nextnotesaligncenter#1{% - \ifnum#1<20\relax % - \gre@calculate@simplenotesaligncenter{#1}{1}% - \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@width / 2)\relax % - \global\gre@dimen@notesaligncenter=\gre@dimen@temp@five % - \else %\ifnum#1<20 - \gre@count@temp@three=#1 % - \ifnum#1<40\relax% - \advance\gre@count@temp@three by -20\relax % - \gre@calculate@simplenotesaligncenter{\gre@count@temp@three}{1}% - \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@width / 2)\relax % - \setbox\gre@box@temp@width=\hbox{\gre@fontchar@flat}% - \else%\ifnum#1<40 - \ifnum#1<60\relax% - \advance\gre@count@temp@three by -40\relax % - \gre@calculate@simplenotesaligncenter{\gre@count@temp@three}{1}% - \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@width / 2)\relax % - \setbox\gre@box@temp@width=\hbox{\gre@fontchar@natural}% - \else%\ifnum#1<60 - \advance\gre@count@temp@three by -60\relax % - \gre@calculate@simplenotesaligncenter{\gre@count@temp@three}{1}% - \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@width / 2)\relax % - \setbox\gre@box@temp@width=\hbox{\gre@fontchar@sharp}% - \fi% - \fi % - \advance\gre@dimen@temp@five by \dimexpr(\wd\gre@box@temp@width+\gre@space@dimen@alterationspace)\relax % - \global\gre@dimen@notesaligncenter=\gre@dimen@temp@five % - \fi % - \relax % + \ifnum#1<20\relax % + \gre@calculate@simplenotesaligncenter{#1}{1}% + \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@width / 2)\relax % + \global\gre@dimen@notesaligncenter=\gre@dimen@temp@five % + \else %\ifnum#1<20 + \gre@count@temp@three=#1 % + \ifnum#1<40\relax% + \advance\gre@count@temp@three by -20\relax % + \gre@calculate@simplenotesaligncenter{\gre@count@temp@three}{1}% + \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@width / 2)\relax % + \setbox\gre@box@temp@width=\hbox{\gre@fontchar@flat}% + \else%\ifnum#1<40 + \ifnum#1<60\relax% + \advance\gre@count@temp@three by -40\relax % + \gre@calculate@simplenotesaligncenter{\gre@count@temp@three}{1}% + \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@width / 2)\relax % + \setbox\gre@box@temp@width=\hbox{\gre@fontchar@natural}% + \else%\ifnum#1<60 + \advance\gre@count@temp@three by -60\relax % + \gre@calculate@simplenotesaligncenter{\gre@count@temp@three}{1}% + \gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@width / 2)\relax % + \setbox\gre@box@temp@width=\hbox{\gre@fontchar@sharp}% + \fi% + \fi % + \advance\gre@dimen@temp@five by \dimexpr(\wd\gre@box@temp@width+\gre@space@dimen@alterationspace)\relax % + \global\gre@dimen@notesaligncenter=\gre@dimen@temp@five % + \fi % + \relax % }% % box that we will use to determine the width of the notes, to determine wether we typeset a - or not after the letters \newbox\gre@box@syllablenotes% +\newif\ifgre@showlyrics% +\gre@showlyricstrue% + +\def\gresetlyrics#1{% + \IfStrEqCase{#1}{% + {visible}{\gre@showlyricstrue}% + {invisible}{\gre@showlyricsfalse}% + }[% all other cases + \gre@error{Unknown option, "#1" for \protect\gresetlyrics\MessageBreak Possible options are: 'visible' and 'invisible'}% + ]% +}% + +\newif\ifgre@shownotes% +\gre@shownotestrue% + +\def\gresetnotes#1{% + \IfStrEqCase{#1}{% + {visible}{\gre@shownotestrue}% + {invisible}{\gre@shownotesfalse}% + }[% all other cases + \gre@error{Unknown option, "#1" for \protect\gresetnotes\MessageBreak Possible options are: 'visible' and 'invisible'}% + ]% +}% + % Macro used to fill \gre@box@syllablenotes with everything contained in #1. This % saves and restores a few values so that when really typesetting #1 in \GreSyllable, % the result is identical. \def\gre@syllablenotes#1{% - % \gre@count@lastglyphiscavum is reinitialized at each syllable... - % so there's a bug on g(bx)g(b) - \global\gre@count@lastglyphiscavum=0\relax % - \global\gre@firstglyphtrue% - \global\gre@boxingtrue% - \let\ifgre@lastendswithmorasave\ifgre@lastendswithmora% - \xdef\gre@savedlastoflinecount{\number\gre@lastoflinecount\relax }% - \setbox\gre@box@syllablenotes=\hbox{#1}% - \gre@debugmsg{spacing}{Width of notes: \the\wd\gre@box@syllablenotes}% - \global\gre@boxingfalse% - \global\gre@lastoflinecount=\gre@savedlastoflinecount\relax % - \global\gre@firstglyphtrue% - % now gre@lastendswithmora is true if this syllable ends with a - % punctum mora, but we still want to keep gre@lastendswithmora if we - % are on a bar, so: - % - we set gre@thisendswithmora to gre@lastendswithmora - % - when syllables will be really typeset, they will set gre@lastendswithmora - % again - \ifgre@lastendswithmora % - \gre@thisendswithmoratrue % - \else % - \gre@thisendswithmorafalse % - \fi % - \let\ifgre@lastendswithmora\ifgre@lastendswithmorasave % - \global\gre@count@lastglyphiscavum=0\relax % - \global\gre@skip@bar@lastskip=0pt\relax % - \global\gre@endofscorefalse % - \relax % + % \gre@count@lastglyphiscavum is reinitialized at each syllable... + % so there's a bug on g(bx)g(b) + \global\gre@count@lastglyphiscavum=0\relax % + \global\gre@firstglyphtrue% + \global\gre@boxingtrue% + \let\ifgre@lastendswithmorasave\ifgre@lastendswithmora% + \xdef\gre@savedlastoflinecount{\number\gre@lastoflinecount\relax }% + \ifgre@shownotes% + \setbox\gre@box@syllablenotes=\hbox{#1}% + \else% + \setbox\gre@box@syllablenotes=\box\voidb@x% + \fi% + \gre@debugmsg{spacing}{Width of notes: \the\wd\gre@box@syllablenotes}% + \global\gre@boxingfalse% + \global\gre@lastoflinecount=\gre@savedlastoflinecount\relax % + \global\gre@firstglyphtrue% + % now gre@lastendswithmora is true if this syllable ends with a + % punctum mora, but we still want to keep gre@lastendswithmora if we + % are on a bar, so: + % - we set gre@thisendswithmora to gre@lastendswithmora + % - when syllables will be really typeset, they will set gre@lastendswithmora + % again + \ifgre@lastendswithmora % + \gre@thisendswithmoratrue % + \else % + \gre@thisendswithmorafalse % + \fi % + \let\ifgre@lastendswithmora\ifgre@lastendswithmorasave % + \global\gre@count@lastglyphiscavum=0\relax % + \global\gre@skip@bar@lastskip=0pt\relax % + \global\gre@endofscorefalse % + \relax % }% @@ -408,7 +436,7 @@ % the macro we call with all normal text \def\gre@textnormal#1{% - #1\relax % + #1\relax % }% % macro to specify a text which is different from #1#2#3 (of \GreSyllable). It is useful for @@ -433,26 +461,26 @@ % 4: tt % 5: ul \def\GreSetFixedTextFormat#1{% - \ifcase#1\relax% - \global\let\gre@fixedtextformat\gre@textnormal % - \or % - \global\let\gre@fixedtextformat\GreItalic % - \or % - \global\let\gre@fixedtextformat\GreBold % - \or % - \global\let\gre@fixedtextformat\GreSmallCaps % - \or % - \global\let\gre@fixedtextformat\GreTypewriter % - \or % - \global\let\gre@fixedtextformat\GreUnderline % - \or % - \global\let\gre@fixedtextformat\GreColored % - \fi % + \ifcase#1\relax% + \global\let\gre@fixedtextformat\gre@textnormal % + \or % + \global\let\gre@fixedtextformat\GreItalic % + \or % + \global\let\gre@fixedtextformat\GreBold % + \or % + \global\let\gre@fixedtextformat\GreSmallCaps % + \or % + \global\let\gre@fixedtextformat\GreTypewriter % + \or % + \global\let\gre@fixedtextformat\GreUnderline % + \or % + \global\let\gre@fixedtextformat\GreColored % + \fi % }% % a function to cancel the previous one \def\gre@unsetfixedtextformat{% - \global\let\gre@fixedtextformat\gre@textnormal % + \global\let\gre@fixedtextformat\gre@textnormal % }% \let\gre@fixedtextformat\gre@textnormal % @@ -460,26 +488,26 @@ % The same but for the next syllable \def\GreSetFixedNextTextFormat#1{% - \ifcase#1\relax% - \global\let\gre@fixednexttextformat\gre@textnormal % - \or % - \global\let\gre@fixednexttextformat\GreItalic % - \or % - \global\let\gre@fixednexttextformat\GreBold % - \or % - \global\let\gre@fixednexttextformat\GreSmallCaps % - \or % - \global\let\gre@fixednexttextformat\GreTypewriter % - \or % - \global\let\gre@fixednexttextformat\GreUnderline % - \or % - \global\let\gre@fixednexttextformat\GreColored % - \fi % + \ifcase#1\relax% + \global\let\gre@fixednexttextformat\gre@textnormal % + \or % + \global\let\gre@fixednexttextformat\GreItalic % + \or % + \global\let\gre@fixednexttextformat\GreBold % + \or % + \global\let\gre@fixednexttextformat\GreSmallCaps % + \or % + \global\let\gre@fixednexttextformat\GreTypewriter % + \or % + \global\let\gre@fixednexttextformat\GreUnderline % + \or % + \global\let\gre@fixednexttextformat\GreColored % + \fi % }% % a function to cancel the previous one \def\gre@unsetfixednexttextformat{% - \global\let\gre@fixednexttextformat\gre@textnormal % + \global\let\gre@fixednexttextformat\gre@textnormal % }% \let\gre@fixednexttextformat\gre@textnormal % @@ -492,36 +520,36 @@ \gre@nextforcedcenteringfalse% \def\GreGABCForceCenters{% - \ifgre@gabcforcecenters% - \gre@forcedcenteringtrue% - \else% - \gre@forcedcenteringfalse% - \fi% + \ifgre@gabcforcecenters% + \gre@forcedcenteringtrue% + \else% + \gre@forcedcenteringfalse% + \fi% }% \def\GreGABCNextForceCenters{% - \ifgre@gabcforcecenters% - \gre@nextforcedcenteringtrue% - \else% - \gre@nextforcedcenteringfalse% - \fi% + \ifgre@gabcforcecenters% + \gre@nextforcedcenteringtrue% + \else% + \gre@nextforcedcenteringfalse% + \fi% }% \newif\ifgre@gabcforcecenters% \gre@gabcforcecenterstrue% \def\gresetgabcforcecenters#1{% - \ifcase\gre@lyriccentering\or - \gre@warning{\protect\gresetgabcforcecenters\space has no effect when lyrics are centered on the vowels}% - \fi% - \IfStrEqCase{#1}{% - {allow}% - {\gre@gabcforcecenterstrue}% - {prohibit}% - {\gre@gabcforcecentersfalse}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetgabcforcecenters\MessageBreak Possible options are: 'allow' and 'prohibit'}% - ]% + \ifcase\gre@lyriccentering\or% + \gre@warning{\protect\gresetgabcforcecenters\space has no effect when lyrics are centered on the vowels}% + \fi% + \IfStrEqCase{#1}{% + {allow}% + {\gre@gabcforcecenterstrue}% + {prohibit}% + {\gre@gabcforcecentersfalse}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetgabcforcecenters\MessageBreak Possible options are: 'allow' and 'prohibit'}% + ]% }% % #1 : the first letters of the syllable, that don't count for the alignment @@ -530,49 +558,49 @@ % #4 : the very first letter % #5 : all the letters after the first letter \def\GreSetThisSyllable#1#2#3#4#5{% - \ifgre@forcedcentering% - \gdef\gre@firstsyllablepart{#1}% - \gdef\gre@middlesyllablepart{#2}% - \gdef\gre@endsyllablepart{#3}% - \else% - \ifcase\gre@lyriccentering% 0 - syllable centering - \gdef\gre@firstsyllablepart{}% - \gdef\gre@middlesyllablepart{#1#2#3}% - \gdef\gre@endsyllablepart{}% - \or % 1 - vowel centering - \gdef\gre@firstsyllablepart{#1}% - \gdef\gre@middlesyllablepart{#2}% - \gdef\gre@endsyllablepart{#3}% - \or % 2 - first-letter centering - \gdef\gre@firstsyllablepart{}% - \gdef\gre@middlesyllablepart{#4}% - \gdef\gre@endsyllablepart{#5}% - \fi % - \fi% - \gre@forcedcenteringfalse% + \ifgre@forcedcentering% + \gdef\gre@firstsyllablepart{#1}% + \gdef\gre@middlesyllablepart{#2}% + \gdef\gre@endsyllablepart{#3}% + \else% + \ifcase\gre@lyriccentering% 0 - syllable centering + \gdef\gre@firstsyllablepart{}% + \gdef\gre@middlesyllablepart{#1#2#3}% + \gdef\gre@endsyllablepart{}% + \or % 1 - vowel centering + \gdef\gre@firstsyllablepart{#1}% + \gdef\gre@middlesyllablepart{#2}% + \gdef\gre@endsyllablepart{#3}% + \or % 2 - first-letter centering + \gdef\gre@firstsyllablepart{}% + \gdef\gre@middlesyllablepart{#4}% + \gdef\gre@endsyllablepart{#5}% + \fi % + \fi% + \gre@forcedcenteringfalse% }% \def\GreSetNextSyllable#1#2#3#4#5{% - \ifgre@nextforcedcentering% - \gdef\gre@nextfirstsyllablepart{#1}% - \gdef\gre@nextmiddlesyllablepart{#2}% - \gdef\gre@nextendsyllablepart{#3}% - \else% - \ifcase\gre@lyriccentering% 0 - syllable centering - \gdef\gre@nextfirstsyllablepart{}% - \gdef\gre@nextmiddlesyllablepart{#1#2#3}% - \gdef\gre@nextendsyllablepart{}% - \or % 1 - vowel centering - \gdef\gre@nextfirstsyllablepart{#1}% - \gdef\gre@nextmiddlesyllablepart{#2}% - \gdef\gre@nextendsyllablepart{#3}% - \or % 2 - first-letter centering - \gdef\gre@nextfirstsyllablepart{}% - \gdef\gre@nextmiddlesyllablepart{#4}% - \gdef\gre@nextendsyllablepart{#5}% - \fi % - \fi% - \gre@nextforcedcenteringfalse% + \ifgre@nextforcedcentering% + \gdef\gre@nextfirstsyllablepart{#1}% + \gdef\gre@nextmiddlesyllablepart{#2}% + \gdef\gre@nextendsyllablepart{#3}% + \else% + \ifcase\gre@lyriccentering% 0 - syllable centering + \gdef\gre@nextfirstsyllablepart{}% + \gdef\gre@nextmiddlesyllablepart{#1#2#3}% + \gdef\gre@nextendsyllablepart{}% + \or % 1 - vowel centering + \gdef\gre@nextfirstsyllablepart{#1}% + \gdef\gre@nextmiddlesyllablepart{#2}% + \gdef\gre@nextendsyllablepart{#3}% + \or % 2 - first-letter centering + \gdef\gre@nextfirstsyllablepart{}% + \gdef\gre@nextmiddlesyllablepart{#4}% + \gdef\gre@nextendsyllablepart{#5}% + \fi % + \fi% + \gre@nextforcedcenteringfalse% }% %%%%%%%%%%%%%%% @@ -580,27 +608,20 @@ %%%%%%%%%%%%%%% \def\gresetlyriccentering#1{% - \IfStrEqCase{#1}{% - {vowel}% - {\xdef\gre@lyriccentering{1}}% - {syllable}% - {\xdef\gre@lyriccentering{0}}% - {firstletter}% - {\xdef\gre@lyriccentering{2}}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetlyriccentering\MessageBreak Possible options are: 'vowel', 'syllable' and 'firstletter'}% - ]% + \IfStrEqCase{#1}{% + {vowel}% + {\xdef\gre@lyriccentering{1}}% + {syllable}% + {\xdef\gre@lyriccentering{0}}% + {firstletter}% + {\xdef\gre@lyriccentering{2}}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetlyriccentering\MessageBreak Possible options are: 'vowel', 'syllable' and 'firstletter'}% + ]% }% \xdef\gre@lyriccentering{1}% -\def\englishcentering{%OBSOLETE - \gre@obsolete{\protect\englishcentering}{\protect\gresetlyriccentering{syllable}}% -}% - -\def\defaultcentering{%OBSOLETE - \gre@obsolete{\protect\defaultcentering}{\protect\gresetlyriccentering{vowel} }% -}% %% options about clivis centering scheme. Clivis are usually aligned by their %% center, which is different from most neumes. Gregorio has three modes: @@ -615,41 +636,30 @@ \def\gresetclivisalignment#1{% - \IfStrEqCase{#1}{% - {always}% - {\global\gre@clivisalignment=0\relax}% - {never}% - {\global\gre@clivisalignment=1\relax}% - {special}% - {\global\gre@clivisalignment=2\relax}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetclivisalignment\MessageBreak Possible options are 'always', 'never', and 'special'}% - ]% + \IfStrEqCase{#1}{% + {always}% + {\global\gre@clivisalignment=0\relax}% + {never}% + {\global\gre@clivisalignment=1\relax}% + {special}% + {\global\gre@clivisalignment=2\relax}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetclivisalignment\MessageBreak Possible options are 'always', 'never', and 'special'}% + ]% }% -\def\clivisalignmentalways{%OBSOLETE - \gre@obsolete{\protect\clivisalignmentalways}{\protect\gresetclivisalignment{always}}% -}% - -\def\clivisalignmentnever{%OBSOLETE - \gre@obsolete{\protect\clivisalignmentnever}{\protect\gresetclivisalignment{never}}% -}% - -\def\clivisalignmentspecial{%OBSOLETE - \gre@obsolete{\protect\clivisalignmentspecial}{\protect\gresetclivisalignment{special}}% -}% \newif\ifgre@forceemptyfirstsyllablehyphen% \gre@forceemptyfirstsyllablehyphentrue% \def\gresetemptyfirstsyllablehyphen#1{% - \IfStrEqCase{#1}{% - {auto}% - {\gre@forceemptyfirstsyllablehyphenfalse}% - {force}% - {\gre@forceemptyfirstsyllablehyphentrue}% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetlyriccentering\MessageBreak Possible options are 'auto' and 'force'}% - ]% + \IfStrEqCase{#1}{% + {auto}% + {\gre@forceemptyfirstsyllablehyphenfalse}% + {force}% + {\gre@forceemptyfirstsyllablehyphentrue}% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetlyriccentering\MessageBreak Possible options are 'auto' and 'force'}% + ]% }% \newif\ifgre@showhyphenafterthissyllable% @@ -661,6 +671,24 @@ \newif\ifgre@possibleluahyphenafterthissyllable \gre@possibleluahyphenafterthissyllablefalse +\newcount\gre@count@unbreakabletotalnotes % +\newcount\gre@count@unbreakableinitialnotes % +\newcount\gre@count@unbreakablefinalnotes % +% #1 : minimum notes in the syllable before the syllable may be split across lines +% #2 : minimum notes to keep together at the start of a syllable +% #3 : minimum notes to keep together at the end of a syllable +\def\gresetunbreakablesyllablenotes#1#2#3{% + \gre@count@unbreakabletotalnotes=\number#1\relax % + \gre@count@unbreakableinitialnotes=\number#2\relax % + \gre@count@unbreakablefinalnotes=\number#3\relax % +}% +\gresetunbreakablesyllablenotes{10}{4}{4}% + +\newcount\gre@count@syllablenotes % +\def\GreSyllableNoteCount#1{% + \gre@count@syllablenotes=\number#1\relax % +}% + %% general macro : it will typeset the syllable : arguments are : % #1 : macro setting the letters of this syllable % #2 : reserved (unused) @@ -676,184 +704,202 @@ %% with a special option for #7 : if it is a bar, we don't put a space at the end %% at the end we wall \greendofword or \gre@endofsyllable with #7, to reduce the space in case of a flat or natural \def\GreSyllable#1#2#3#4#5#6#7#8#9{% - \gre@debugmsg{general}{}% - \gre@debugmsg{general}{New syllable: \expandafter\unexpanded{#1}}% - \gre@debugmsg{general}{}% - \global\gre@possibleluahyphenafterthissyllablefalse % - \gre@showhyphenafterthissyllablefalse% - \ifcase#4\ifgre@forcehyphen% - \gre@debugmsg{hyphen}{Forcing hyphen}% - \gre@showhyphenafterthissyllabletrue% - \fi\fi% - #1% - \gre@firstglyphtrue% - \gre@dimen@bolextra = 0pt\relax% - \gre@calculate@textaligncenter{\gre@firstsyllablepart}{\gre@middlesyllablepart}{0}% we first get the width between the alignment point and the end of the syllable - \gre@syllablenotes{#9}% we put the notes in a box, so that we have the width of it - % now we calculate the begin difference, that is to say \gre@dimen@notesaligncenter - \gre@dimen@textaligncenter - \gre@dimen@begindifference=\dimexpr(\gre@dimen@notesaligncenter - \gre@dimen@textaligncenter)\relax % - % Now, let's go for something I took years to figure out: we want to align - % scores on the notes (see https://github.com/gregorio-project/gregorio/issues/221) - % but it means we have to shift lines starting by text by \gre@dimen@bolshift - % sadly, we cannot do that in TeX, we can't just say that. But, the way TeX - % handles this with usual spaces, is that it ignores all spaces at beginning - % of lines. To use this, we just \kern\gre@dimen@bolshift right, this will be - % ignored at beginning of line, then \hbox{} that will break the "ignorance" - % of spaces, then \kern\gre@dimen@bolshift left, which will not be ignored. - % So, at beginning of lines, we will have shifted left, and in middle of lines - % we will have shifted right and left, thus cancelling... Very easy trick, but - % took me years to find it! - \gre@debugmsg{bolshift}{Current glyph: \the\gre@attr@glyph@id}% - % we only want to execute these shifts if the clef is being shown - % if no clef is being shown, then there is no space under the clef for the - % lyrics to invade - \ifgre@showclef% - \ifgre@bolshiftsenabled% - \gre@calculate@bolshift{\gre@dimen@begindifference}% - % we don't want to shift right on the first syllable of the score - % because the printing of the initial clef, initial, and/or the staff lines - % will have already broken TeX's ignorance of spaces. - \ifgre@beginningofscore% - \gre@beginningofscorefalse% - \else% - % we don't want to shift right inside a discretionary - \ifnum\gre@insidediscretionary=0\relax% - \kern\gre@dimen@bolshift\relax% - \fi% - \fi% - \GreNoBreak % - \hbox to 0pt{}% - \GreNoBreak % - \kern-\gre@dimen@bolshift\relax% - \fi% - \else% - % if there is no clef, we still need to break TeX's ignorance of spaces at - % the beginning of a line so that the alterations, which would otherwise be - % ignored in positioning the syllable, don't stick out into margin - \GreNoBreak % - \hbox to 0pt{}% - \GreNoBreak % - \fi % - % by default, gre@attr@dash will be 2 - \gre@attr@dash=2\relax % - #5% - \gre@calculate@nextbegindifference{\gre@nextfirstsyllablepart}{\gre@nextmiddlesyllablepart}{\gre@nextendsyllablepart}{#7}% - \gre@unsetfixednexttextformat % - \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart}{#6}}}% - \gre@calculate@enddifference{\wd\gre@box@syllablenotes}{\wd\gre@box@syllabletext}{\gre@dimen@textaligncenter}{\gre@dimen@notesaligncenter}{1}% - % gre@count@temp@one holds 0 if next is a not bar, 1 if it is - \gre@count@temp@one=0% - \ifnum#7>9\relax % - \ifnum#7<20\relax % - \gre@count@temp@one=1\relax % - \else % - \gre@count@temp@one=2\relax % - \fi % - \fi % - \gre@calculate@syllablefinalskip{#4}{\gre@count@temp@one}% - \ifcase#4 % - % we enter here if the end of word is 0, so we must determine if we need to type a dash here - \gre@skip@temp@one = \gre@skip@syllablefinalskip\relax% - \gre@debugmsg{ifdim}{ enddifference > 0pt}% - \ifdim\gre@dimen@enddifference >0pt\relax% - \advance\gre@skip@temp@one by \gre@dimen@enddifference\relax% - \fi % - \gre@debugmsg{ifdim}{ nextbegindifference > 0pt}% - \ifdim\gre@skip@nextbegindifference >0pt\relax% - \advance\gre@skip@temp@one by \gre@skip@nextbegindifference\relax% - \fi % - % - % then we compare it with \gre@space@dimen@maximumspacewithoutdash, if it is larger, we add a dash - % - \gre@debugmsg{ifdim}{ temp@skip@one > maximumspacewithoutdash}% - \ifdim\gre@skip@temp@one > \gre@space@dimen@maximumspacewithoutdash\relax% - \gre@debugmsg{hyphen}{spacing requires hyphen}% - \gre@showhyphenafterthissyllabletrue% - \fi % - \fi% ficase#4 - \ifgre@showhyphenafterthissyllable\relax% - \gre@debugmsg{hyphen}{Showing the hyphen}% - % if it's the last syllable of line, the hyphen will be \GreHyph - \ifnum\gre@lastoflinecount=1\relax % - \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart#3{\GreHyph}\relax}{#6}}}% - \else % - \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart#3{-}}{#6}}}% - \fi % - % recomputing end difference and final skip with the final hyphen - \gre@calculate@enddifference{\wd\gre@box@syllablenotes}{\wd\gre@box@syllabletext}{\gre@dimen@textaligncenter}{\gre@dimen@notesaligncenter}{0}% - \gre@calculate@syllablefinalskip{#4}{\gre@count@temp@one}% - \else % - \ifcase#4 % - \gre@debugmsg{hyphen}{No hyphen}% - \gre@attr@dash=1\relax % in this particular case where it is not the end of a word and we haven't put a dash, we set potentital dash to 1 - % we rebuild this box, in order it to have the attribute - \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart}{#6}}}% - \global\gre@possibleluahyphenafterthissyllabletrue % - \fi % - \fi% - % then we reuse temp, we assign to it the \gre@dimen@begindifference, but only if it is positive, else it is 0 - \gre@debugmsg{ifdim}{ begindifference > 0pt}% - \ifdim\gre@dimen@begindifference > 0 pt\relax% - \gre@skip@temp@one = \gre@dimen@begindifference\relax% - \kern\gre@skip@temp@one % - \fi% - #8\relax % - \raise\gre@dimen@textlower\relax% - \copy\gre@box@syllabletext % - \ifgre@mustdotranslationcenterend% - % case of end of translation centering, we do it after the typesetting of the text - \gre@dotranslationcenterend % - \gre@mustdotranslationcenterendfalse% - \fi % - \gre@skip@temp@one = -\wd\gre@box@syllabletext % - \kern\gre@skip@temp@one% - \gre@skip@temp@one = -\gre@dimen@begindifference\relax% - \kern\gre@skip@temp@one % - % here we need to unset \gre@attr@dash for the typesetting of notes - \gre@attr@dash=0\relax % - \GreNoBreak % no line breaks between text and notes - #9% we do that instead of \unhbox\Syllablnotes, because it would not set the \localrightbox - \GreNoBreak % no line breaks between notes and end of syllable skips - \gre@debugmsg{ifdim}{ enddifference < 0pt}% - \ifdim\gre@dimen@enddifference <0pt\relax% - %% important, else we are not really at the end of the syllable - \kern -\gre@dimen@enddifference\relax% - \GreNoBreak % - \fi% - % we call end of syllable - \gre@syllable@end{#7}{\gre@nextfirstsyllablepart\gre@nextmiddlesyllablepart\gre@nextendsyllablepart}{#4}% - \global\gre@dimen@notesaligncenter=0pt\relax% very important, see flat and natural - \gre@unsetfixedtextformat % - \ifgre@blockeolcustos\ifnum\gre@insidediscretionary=0\relax % - \gre@localrightbox{}% - \fi\fi % - \relax % + \gre@debugmsg{general}{}% + \gre@debugmsg{general}{New syllable: \expandafter\unexpanded{#1}}% + \gre@debugmsg{general}{}% + \global\gre@possibleluahyphenafterthissyllablefalse % + \gre@showhyphenafterthissyllablefalse% + \ifcase#4\ifgre@forcehyphen% + \gre@debugmsg{hyphen}{Forcing hyphen}% + \gre@showhyphenafterthissyllabletrue% + \fi\fi% + #1% + \gre@firstglyphtrue% + \gre@dimen@bolextra = 0pt\relax% + \gre@calculate@textaligncenter{\gre@firstsyllablepart}{\gre@middlesyllablepart}{0}% we first get the width between the alignment point and the end of the syllable + \gre@syllablenotes{#9}% we put the notes in a box, so that we have the width of it + % now we calculate the begin difference, that is to say \gre@dimen@notesaligncenter - \gre@dimen@textaligncenter + \gre@dimen@begindifference=\dimexpr(\gre@dimen@notesaligncenter - \gre@dimen@textaligncenter)\relax % + % Now, let's go for something I took years to figure out: we want to align + % scores on the notes (see https://github.com/gregorio-project/gregorio/issues/221) + % but it means we have to shift lines starting by text by \gre@dimen@bolshift + % sadly, we cannot do that in TeX, we can't just say that. But, the way TeX + % handles this with usual spaces, is that it ignores all spaces at beginning + % of lines. To use this, we just \kern\gre@dimen@bolshift right, this will be + % ignored at beginning of line, then \hbox{} that will break the "ignorance" + % of spaces, then \kern\gre@dimen@bolshift left, which will not be ignored. + % So, at beginning of lines, we will have shifted left, and in middle of lines + % we will have shifted right and left, thus cancelling... Very easy trick, but + % took me years to find it! + \gre@debugmsg{bolshift}{Current glyph: \the\gre@attr@glyph@id}% + % we only want to execute these shifts if the clef is being shown + % if no clef is being shown, then there is no space under the clef for the + % lyrics to invade + \ifgre@showclef% + \ifgre@bolshiftsenabled% + \gre@calculate@bolshift{\gre@dimen@begindifference}% + % we don't want to shift right on the first syllable of the score + % because the printing of the initial clef, initial, and/or the staff lines + % will have already broken TeX's ignorance of spaces. + \ifgre@beginningofscore% + \gre@beginningofscorefalse% + \else% + % we don't want to shift right inside a discretionary + \ifnum\gre@insidediscretionary=0\relax% + \kern\gre@dimen@bolshift\relax% + \fi% + \fi% + \GreNoBreak % + \hbox to 0pt{}% + \GreNoBreak % + \kern-\gre@dimen@bolshift\relax% + \fi% + \else% + % if there is no clef, we still need to break TeX's ignorance of spaces at + % the beginning of a line so that the alterations, which would otherwise be + % ignored in positioning the syllable, don't stick out into margin + \GreNoBreak % + \hbox to 0pt{}% + \GreNoBreak % + \fi % + % by default, gre@attr@dash will be 2 + \gre@attr@dash=2\relax % + #5% + \gre@calculate@nextbegindifference{\gre@nextfirstsyllablepart}{\gre@nextmiddlesyllablepart}{\gre@nextendsyllablepart}{#7}% + \gre@unsetfixednexttextformat % + \ifgre@showlyrics% + \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart}{#6}}}% + \else% + \setbox\gre@box@syllabletext=\box\voidb@x% + \fi% + \gre@calculate@enddifference{\wd\gre@box@syllablenotes}{\wd\gre@box@syllabletext}{\gre@dimen@textaligncenter}{\gre@dimen@notesaligncenter}{1}% + % gre@count@temp@one holds 0 if next is a not bar, 1 if it is + \gre@count@temp@one=0% + \ifnum#7>9\relax % + \ifnum#7<20\relax % + \gre@count@temp@one=1\relax % + \else % + \gre@count@temp@one=2\relax % + \fi % + \fi % + \gre@calculate@syllablefinalskip{#4}{\gre@count@temp@one}% + \ifcase#4 % + % we enter here if the end of word is 0, so we must determine if we need to type a dash here + \gre@skip@temp@one = \gre@skip@syllablefinalskip\relax% + \gre@debugmsg{ifdim}{ enddifference > 0pt}% + \ifdim\gre@dimen@enddifference >0pt\relax% + \advance\gre@skip@temp@one by \gre@dimen@enddifference\relax% + \fi % + \gre@debugmsg{ifdim}{ nextbegindifference > 0pt}% + \ifdim\gre@skip@nextbegindifference >0pt\relax% + \advance\gre@skip@temp@one by \gre@skip@nextbegindifference\relax% + \fi % + % + % then we compare it with \gre@space@dimen@maximumspacewithoutdash, if it is larger, we add a dash + % + \gre@debugmsg{ifdim}{ temp@skip@one > maximumspacewithoutdash}% + \ifdim\gre@skip@temp@one > \gre@space@dimen@maximumspacewithoutdash\relax% + \gre@debugmsg{hyphen}{spacing requires hyphen}% + \gre@showhyphenafterthissyllabletrue% + \fi % + \fi% ficase#4 + \ifgre@showhyphenafterthissyllable\relax% + \gre@debugmsg{hyphen}{Showing the hyphen}% + % if it's the last syllable of line, the hyphen will be \GreHyph + \ifnum\gre@lastoflinecount=1\relax % + \ifgre@showlyrics% + \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart#3{\GreHyph}\relax}{#6}}}% + \else% + \setbox\gre@box@syllabletext=\box\voidb@x% + \fi% + \else % + \ifgre@showlyrics% + \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart#3{-}}{#6}}}% + \else% + \setbox\gre@box@syllabletext=\box\voidb@x% + \fi% + \fi % + % recomputing end difference and final skip with the final hyphen + \gre@calculate@enddifference{\wd\gre@box@syllablenotes}{\wd\gre@box@syllabletext}{\gre@dimen@textaligncenter}{\gre@dimen@notesaligncenter}{0}% + \gre@calculate@syllablefinalskip{#4}{\gre@count@temp@one}% + \else % + \ifcase#4 % + \gre@debugmsg{hyphen}{No hyphen}% + \gre@attr@dash=1\relax % in this particular case where it is not the end of a word and we haven't put a dash, we set potentital dash to 1 + % we rebuild this box, in order it to have the attribute + \ifgre@showlyrics% + \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart}{#6}}}% + \else% + \setbox\gre@box@syllabletext=\box\voidb@x% + \fi% + \global\gre@possibleluahyphenafterthissyllabletrue % + \fi % + \fi% + % then we reuse temp, we assign to it the \gre@dimen@begindifference, but only if it is positive, else it is 0 + \gre@debugmsg{ifdim}{ begindifference > 0pt}% + \ifdim\gre@dimen@begindifference > 0 pt\relax% + \gre@skip@temp@one = \gre@dimen@begindifference\relax% + \kern\gre@skip@temp@one % + \fi% + #8\relax % + \raise\gre@dimen@textlower\relax% + \copy\gre@box@syllabletext % + \ifgre@mustdotranslationcenterend% + % case of end of translation centering, we do it after the typesetting of the text + \gre@dotranslationcenterend % + \gre@mustdotranslationcenterendfalse% + \fi % + \gre@skip@temp@one = -\wd\gre@box@syllabletext % + \kern\gre@skip@temp@one% + \gre@skip@temp@one = -\gre@dimen@begindifference\relax% + \kern\gre@skip@temp@one % + % here we need to unset \gre@attr@dash for the typesetting of notes + \gre@attr@dash=0\relax % + \GreNoBreak % no line breaks between text and notes + \ifgre@shownotes% + #9% we do that instead of \unhbox\Syllablnotes, because it would not set the \localrightbox + \fi% + \GreNoBreak % no line breaks between notes and end of syllable skips + \gre@debugmsg{ifdim}{ enddifference < 0pt}% + \ifdim\gre@dimen@enddifference <0pt\relax% + %% important, else we are not really at the end of the syllable + \kern -\gre@dimen@enddifference\relax% + \GreNoBreak % + \fi% + % we call end of syllable + \gre@syllable@end{#7}{\gre@nextfirstsyllablepart\gre@nextmiddlesyllablepart\gre@nextendsyllablepart}{#4}% + \global\gre@dimen@notesaligncenter=0pt\relax% very important, see flat and natural + \gre@unsetfixedtextformat % + \ifgre@blockeolcustos\ifnum\gre@insidediscretionary=0\relax % + \gre@localrightbox{}% + \fi\fi % + \relax % }% % #1 is the id of the euouae block (assigned by the C code) % #2 is whether there is a line break between here and the actuall beginning of % the euouae block. 1 if there is a linebreak, 0 in the general case. \def\GreNextSyllableBeginsEUOUAE#1#2{% - \GreNoBreak % - \ifgre@blockeolcustosbeforeeuouae % - \gre@usemanualeolcustos % - \fi % - \ifgre@raggedbreakbeforeeuouae % - \directlua{gregoriotex.save_pos(#1,1)}% - \ifcase#2\ifcase\directlua{gregoriotex.is_ypos_different(#1)}\relax% - \gre@newlinecommon{1}{1}% - \fi\fi % - \fi % - \relax % + \GreNoBreak % + \ifgre@blockeolcustosbeforeeuouae % + \gre@usemanualeolcustos % + \fi % + \ifgre@raggedbreakbeforeeuouae % + \directlua{gregoriotex.save_euouae(#1,1)}% + \ifcase#2\ifcase\directlua{gregoriotex.is_ypos_different(#1)}\relax% + \gre@newlinecommon{1}{1}% + \fi\fi % + \fi % + \relax % }% % #1 is the id of the euouae block (assigned by the C code) % #2 is whether there is a line break between here and the actuall beginning of % the euouae block. 1 if there is a linebreak, 0 in the general case. \def\GreLastSyllableBeforeEUOUAE#1#2{% - \ifcase#2\ifcase\directlua{gregoriotex.is_ypos_different(#1)}\relax% - \GreLastOfLine% - \fi\fi % + \ifcase#2\ifcase\directlua{gregoriotex.is_ypos_different(#1)}\relax% + \GreLastOfLine% + \fi\fi % }% %% @desc Macro to make a few checks and call the right macros between @@ -862,34 +908,34 @@ %% @arg#2 next syllable text %% @arg#3 end of word or not (#4 of \GreSyllable) \def\gre@syllable@end#1#2#3{% - \gre@debugmsg{syllablespacing}{ syllable@end with #1}% - % gre@count@temp@one holds 0 if next is a not bar, 1 if it is - \gre@count@temp@one=0% - \ifnum#1>9\relax % - \ifnum#1<20\relax % - \gre@count@temp@one=1% - \fi % - \fi % - \gre@debugmsg{syllablespacing}{ gre@count@temp@one = \the\gre@count@temp@one}% - \ifnum\gre@count@temp@one=1\relax % - \ifnum\gre@lastoflinecount=1\relax % - \gre@endofsyllable{0}{1}{1}% - \else % - % otherwise we call it with 1 only if there is no letters after (we can see it with nextbegindifference) - \setbox\gre@box@temp@width=\hbox{#2}% - \ifdim\wd\gre@box@temp@width=0pt\relax% - \gre@endofsyllable{0}{1}{1}% - \else % - \gre@endofsyllable{1}{1}{1}% - \fi % - \fi % - \else % - \ifnum\gre@lastoflinecount=1\relax % - \global\gre@lastoflinecount=2\relax % - \fi % - \gre@debugmsg{syllablespacing}{ calling endofsyllable with #3}% - \gre@endofsyllable{1}{#3}{0}% - \fi % + \gre@debugmsg{syllablespacing}{ syllable@end with #1}% + % gre@count@temp@one holds 0 if next is a not bar, 1 if it is + \gre@count@temp@one=0% + \ifnum#1>9\relax % + \ifnum#1<20\relax % + \gre@count@temp@one=1% + \fi % + \fi % + \gre@debugmsg{syllablespacing}{ gre@count@temp@one = \the\gre@count@temp@one}% + \ifnum\gre@count@temp@one=1\relax % + \ifnum\gre@lastoflinecount=1\relax % + \gre@endofsyllable{0}{1}{1}% + \else % + % otherwise we call it with 1 only if there is no letters after (we can see it with nextbegindifference) + \setbox\gre@box@temp@width=\hbox{#2}% + \ifdim\wd\gre@box@temp@width=0pt\relax% + \gre@endofsyllable{0}{1}{1}% + \else % + \gre@endofsyllable{1}{1}{1}% + \fi % + \fi % + \else % + \ifnum\gre@lastoflinecount=1\relax % + \global\gre@lastoflinecount=2\relax % + \fi % + \gre@debugmsg{syllablespacing}{ calling endofsyllable with #3}% + \gre@endofsyllable{1}{#3}{0}% + \fi % } %% @desc Macro called at end of a syllable, adds a penalty and a space @@ -898,65 +944,65 @@ %% @arg#3 1 if next syllable is a bar, 0 otherwise %% \def\gre@endofsyllable#1#2#3{% - \gre@debugmsg{syllablespacing}{ endofsyllable with #2}% - \ifgre@eolshiftsenabled% - %this shift will shorten the line somewhat to allow the lyrics to extend under the custos should TeX decide to insert a line break after the syllable being ended - \GreNoBreak% - \gre@calculate@eolshift{\gre@dimen@enddifference}% - \gre@debugmsg{eolshift}{End of line shift: \the\gre@dimen@eolshift}% - \kern -\gre@dimen@eolshift\relax% - \fi% - \ifnum#3=1\relax % - \GreNoBreak % - \gre@debugmsg{syllablespacing}{ set penalty \grenobreakpenalty}% - \else % - \ifnum#2=1\relax % - \gre@penalty{\greendofwordpenalty}% - \gre@debugmsg{syllablespacing}{ set penalty \greendofwordpenalty}% - \else % - \gre@penalty{\greendofsyllablepenalty}% - \gre@debugmsg{syllablespacing}{ set penalty \greendofsyllablepenalty}% - \fi % - \fi % - \ifgre@eolshiftsenabled% - %If the above penalties don't result in a line break, then we need to undo the eolshift to prevent the next syllable from overlapping with this one. If the line break did occur, then this shift will occur at the beginning of a line and thus will be ignored automatically by TeX. - \kern \gre@dimen@eolshift\relax% - \GreNoBreak% - \fi% - \ifnum#1=1\relax % - \ifgre@newbarspacing% - %the new bar spacing algorithms take care of this for us when the next syllable is a bar - \relax% - \else% - \gre@hskip\gre@skip@syllablefinalskip\relax% - \fi% - \ifnum#3=1\relax % - \GreNoBreak % - \else% - \ifgre@newbarspacing% - %the new bar spacing algorithm still needs the syllablefinalskip when the next syllable is not a bar - \gre@hskip\gre@skip@syllablefinalskip\relax% - \fi% - \fi % - \fi % - \relax% + \gre@debugmsg{syllablespacing}{ endofsyllable with #2}% + \ifgre@eolshiftsenabled% + %this shift will shorten the line somewhat to allow the lyrics to extend under the custos should TeX decide to insert a line break after the syllable being ended + \GreNoBreak% + \gre@calculate@eolshift{\gre@dimen@enddifference}% + \gre@debugmsg{eolshift}{End of line shift: \the\gre@dimen@eolshift}% + \kern -\gre@dimen@eolshift\relax% + \fi% + \ifnum#3=1\relax % + \GreNoBreak % + \gre@debugmsg{syllablespacing}{ set penalty \the\gre@space@count@nobreakpenalty}% + \else % + \ifnum#2=1\relax % + \gre@penalty{\the\gre@space@count@endofwordpenalty}% + \gre@debugmsg{syllablespacing}{ set penalty \the\gre@space@count@endofwordpenalty}% + \else % + \gre@penalty{\the\gre@space@count@endofsyllablepenalty}% + \gre@debugmsg{syllablespacing}{ set penalty \the\gre@space@count@endofsyllablepenalty}% + \fi % + \fi % + \ifgre@eolshiftsenabled% + %If the above penalties don't result in a line break, then we need to undo the eolshift to prevent the next syllable from overlapping with this one. If the line break did occur, then this shift will occur at the beginning of a line and thus will be ignored automatically by TeX. + \kern \gre@dimen@eolshift\relax% + \GreNoBreak% + \fi% + \ifnum#1=1\relax % + \ifgre@newbarspacing% + %the new bar spacing algorithms take care of this for us when the next syllable is a bar + \relax% + \else% + \gre@hskip\gre@skip@syllablefinalskip\relax% + \fi% + \ifnum#3=1\relax % + \GreNoBreak % + \else% + \ifgre@newbarspacing% + %the new bar spacing algorithm still needs the syllablefinalskip when the next syllable is not a bar + \gre@hskip\gre@skip@syllablefinalskip\relax% + \fi% + \fi % + \fi % + \relax% }% \def\gresetbarspacing#1{% - \IfStrEqCase{#1}{% - {new}% - {% - \gre@newbarspacingtrue% - \let\GreNoNoteSyllable\GreBarSyllable% - }% - {old}% - {% - \gre@newbarspacingfalse% - \let\GreNoNoteSyllable\GreSyllable% - }% - }[% all other cases - \gre@error{Unrecognized option "#1" for \protect\gresetbarspacing\MessageBreak Possible options are: 'new' and 'old'}% - ]% + \IfStrEqCase{#1}{% + {new}% + {% + \gre@newbarspacingtrue% + \let\GreNoNoteSyllable\GreBarSyllable% + }% + {old}% + {% + \gre@newbarspacingfalse% + \let\GreNoNoteSyllable\GreSyllable% + }% + }[% all other cases + \gre@error{Unrecognized option "#1" for \protect\gresetbarspacing\MessageBreak Possible options are: 'new' and 'old'}% + ]% }% % macro to save new lines in bar syllables. With the new bar spacing algorithm, we @@ -964,259 +1010,274 @@ % end of line for later. \xdef\gre@newlinearg{-1} \gdef\gre@newlinecommondelayed#1#2{% - \xdef\gre@newlinearg{#1}% + \xdef\gre@newlinearg{#1}% } %a macro to typeset a syllable with only a bar inside \def\GreBarSyllable#1#2#3#4#5#6#7#8#9{% - \gre@debugmsg{general}{New bar syllable}% - \gre@possibleluahyphenafterthissyllablefalse % - \gre@showhyphenafterthissyllablefalse % - % the algorithm of this function is *extremely* complex, and has been much painful to write... good luck to understand. - % the main goal is, when there is no text under the bar, to put the bar in the middle of the space between the last note of the previous syllable and the first note of the next syllable. But there are limits : a bar can't go very far above text. For example if there is "nuncncncncn" with a punctum on the u, the bar can't go above the fourth n, the most far position is the position where the end of the bar is above the end of the word. The same limitation applies for the syllable after the bar. - % there are two different cases that have almost nothing in common : the case where there is something written under the bar, and the case where there is nothing. - % first of all we need to calculate previousenddifference, begindifference, enddifference and nextbegindifference. - #1% - \gre@calculate@textaligncenter{\gre@firstsyllablepart}{\gre@middlesyllablepart}{0}% - \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart}{#6}}}% - \gre@debugmsg{barspacing}{Width of bar text: \the\wd\gre@box@syllabletext}% - \global\let\gre@newlinecommonsaved\gre@newlinecommon % - \global\let\gre@newlinecommon\gre@newlinecommondelayed % - \xdef\gre@newlinearg{-1}% - \gre@syllablenotes{#9}% - \gre@debugmsg{barspacing}{Width of bar line: \the\wd\gre@box@syllablenotes}% - \gre@dimen@notesaligncenter=\dimexpr(\wd\gre@box@syllablenotes / 2)\relax % - \gre@dimen@begindifference=\dimexpr(\gre@dimen@notesaligncenter - \gre@dimen@textaligncenter)\relax% - \gre@calculate@enddifference{\wd\gre@box@syllablenotes}{\wd\gre@box@syllabletext}{\gre@dimen@textaligncenter}{\gre@dimen@notesaligncenter}{1}% - #5% - \gre@calculate@nextbegindifference{\gre@nextfirstsyllablepart}{\gre@nextmiddlesyllablepart}{\gre@nextendsyllablepart}{#7}% - \gre@unsetfixednexttextformat % - \gre@debugmsg{barspacing}{previousenddifference: \the\gre@dimen@previousenddifference}% - \gre@debugmsg{barspacing}{begindifference: \the\gre@dimen@begindifference}% - \gre@debugmsg{barspacing}{enddifference: \the\gre@dimen@enddifference}% - \gre@debugmsg{barspacing}{nextbegindifference: \the\gre@skip@nextbegindifference}% - \ifgre@newbarspacing% - % - % New bar spacing algorithm - % - \gre@calculate@barposition{#4}{#7}% - %now we can place the text and bar - %we're going to use the bar line to control positioning, so we need to start by getting to the end of the notes of the previous syllable - \ifdim\gre@dimen@adjustedpreviousenddifference < 0pt\relax% - %we need to move back to where the previous notes ended - \kern\gre@dimen@adjustedpreviousenddifference\relax% - \GreNoBreak % - \fi% - %move to the beginning of the text - \gre@hskip\glueexpr(\gre@skip@bar@allocation/2% right from end of previous notes to nominal middle of bar line - +\gre@dimen@bar@shift% from nominal middle of bar line to actual middle - -\wd\gre@box@syllablenotes/2% back up to beginning of bar line - +\gre@dimen@begindifference% from beginning of bar line to beginning of text - +\gre@space@skip@bar@rubber)\relax % the rubber component - \GreNoBreak % - % all that extra stuff (translations and the like) - #8% - \GreNoBreak % - %print the text, the raise is in case of a translation - \raise\gre@dimen@textlower \copy\gre@box@syllabletext% - %and the code which handles translation centering - \ifgre@mustdotranslationcenterend% - % case of end of translation centering, we do it after the typesetting of the text - \gre@dotranslationcenterend % - \gre@mustdotranslationcenterendfalse% - \fi % - %move back to the beginning of the bar line - \kern\dimexpr(\gre@dimen@enddifference% move from end of text to end of bar line - -\wd\gre@box@syllablenotes)\relax % back up from end of bar line to beginning - \GreNoBreak% - #9% - \global\let\gre@newlinecommon\gre@newlinecommonsaved % - \GreNoBreak% - % get into position to place the penalty - \ifdim\gre@dimen@enddifference < 0pt\relax% - % the text extends past the notes, so we need to get to the end of the text - \kern-\gre@dimen@enddifference% - \GreNoBreak% - \fi% - \ifgre@eolshiftsenabled% - %this shift will shorten the line somewhat to allow the lyrics to extend under the custos should TeX decide to insert a line break after the syllable being ended - \gre@calculate@eolshift{\dimexpr(\gre@dimen@enddifference-\gre@skip@bar@lastskip)\relax }% - \gre@debugmsg{barspacing}{End of line shift: \the\gre@dimen@eolshift}% - \ifdim\gre@dimen@eolshift<\gre@skip@bar@lastskip % - \gre@dimen@eolshift=\gre@skip@bar@lastskip\relax % - \fi % - \kern\glueexpr(-\gre@dimen@eolshift)\relax% - \fi% - % gre@count@temp@one is "forced end of line or last of score" - \gre@count@temp@one=0\relax % - \ifnum\gre@newlinearg=-1\else % - \gre@count@temp@one=1\relax % - \fi % - \ifgre@endofscore % - \gre@count@temp@one=1\relax % - \fi % - % if no end of line or end of score - \ifnum\gre@count@temp@one=0\relax % - % add the penalty - \gre@debugmsg{barspacing}{after bar penalty: \greendafterbarpenalty}% - \gre@penalty{\greendafterbarpenalty}% - \ifgre@eolshiftsenabled% - %If the above penalties don't result in a line break, then we need to undo the eolshift to prevent the next syllable from overlapping with this one. If the line break did occur, then this shift will occur at the beginning of a line and thus will be ignored automatically by TeX. - \kern \dimexpr(\gre@dimen@eolshift)\relax% - \GreNoBreak% - \fi% - \ifdim\gre@dimen@enddifference < 0pt\relax% - %undo the earlier shift - \kern\gre@dimen@enddifference% - \GreNoBreak% - \fi% - %move to the beginning of the notes of the next syllable - \gre@hskip\glueexpr(-\wd\gre@box@syllablenotes/2% back up to middle of notes - -\gre@dimen@bar@shift% go back from actual middle to nominal middle of bar line - +\gre@skip@bar@allocation/2% go from nominal middle to the start of the next notes - +\gre@space@skip@bar@rubber)\relax % the rubber component - \ifdim\gre@skip@nextbegindifference < 0pt\relax% - %we need to move back to where the text for the next syllable should start - \GreNoBreak % - \kern\gre@skip@nextbegindifference\relax% - \fi% - \else % - \ifgre@endofscore % - \gre@localleftbox{}% - \gre@debugmsg{barspacing}{after bar penalty: \greendafterbarpenalty}% - \gre@penalty{\grefinalpenalty}% - \else % - \gre@debugmsg{barspacing}{calling new line with argument: \gre@newlinearg}% - \gre@newlinecommon{\gre@newlinearg}{1}% - \fi % - \fi% - \else% - % - % Old spacing algorithm - % - %This is the old algorithm. I've kept it in case people still want to use it. - % then we check if there is something to write - \global\let\gre@newlinecommon\gre@newlinecommonsaved % - \gre@debugmsg{ifdim}{ wd(gre@box@syllabletext) = 0pt}% - \ifdim\wd\gre@box@syllabletext = 0 pt\relax % - % the most difficult case : when there is nothing to write - % first we need to determine the real space that there will be between the notes. Here again it is not so simple... let's consider these two kinds of spaces : - %% 1/ the minimal space between a note and the bar + the width of the bar + the minimal space between the bar and the note (that's the global idea, in fact there are nuances) : we assign skip@temp@three to it - %% 2/ enddifference + begindifference + space between notes and word : we assign skip@temp@two to it - \gre@skip@temp@three=\glueexpr(\gre@space@skip@notebarspace % - + \gre@space@skip@notebarspace % - + \wd\gre@box@syllablenotes)\relax % - % now let's get skip@temp@two - \gre@debugmsg{ifdim}{ nextbegindifference < 0pt}% - \ifdim\gre@skip@nextbegindifference < 0 pt\relax% - \gre@skip@temp@two=-\gre@skip@nextbegindifference\relax% - \else % - \gre@skip@temp@two=0 pt\relax% - \fi % - \gre@debugmsg{ifdim}{ previousenddifference < 0pt}% - \ifdim\gre@dimen@previousenddifference < 0 pt\relax% - \advance\gre@skip@temp@two by % - \glueexpr(-\gre@dimen@previousenddifference % - + \gre@space@skip@interwordspacetext)\relax% - \else % - \advance\gre@skip@temp@two by \gre@space@skip@interwordspacenotes\relax% - \fi% - % we take the max of it, then we divide it by two and we substract half of the width of the bar - \gre@debugmsg{ifdim}{ temp@skip@three < temp@skip@two}% - \ifdim\gre@skip@temp@three <\gre@skip@temp@two % - \gre@skip@temp@three=\gre@skip@temp@two % - \fi % - \divide\gre@skip@temp@three by 2\relax % - \advance\gre@skip@temp@three by \dimexpr(\wd\gre@box@syllablenotes / -2)\relax % - % now we have our skipone - \gre@skip@temp@two=\gre@skip@temp@three % - \gre@debugmsg{ifdim}{ previousenddifference < 0pt}% - \ifdim\gre@dimen@previousenddifference < 0 pt\relax% - \advance\gre@skip@temp@two by \gre@dimen@previousenddifference\relax% - \fi % - \GreNoBreak % - \gre@debugmsg{ifdim}{ temp@skip@two > -wd(gre@box@syllablenotes)}% - \ifdim\gre@skip@temp@two > -\wd\gre@box@syllablenotes % - \kern\gre@skip@temp@two % - \else % - \gre@skip@temp@one = -\wd\gre@box@syllablenotes % - \kern\gre@skip@temp@one% - \fi % - \GreNoBreak % - #8\relax % - \ifgre@mustdotranslationcenterend% - % case of end of translation centering, we do it after the typesetting of the text - \gre@dotranslationcenterend % - \gre@mustdotranslationcenterendfalse% - \fi % - #9\relax % - \gre@penalty{\greendafterbaraltpenalty }% TODO: isn't it a bit buggy? - % end of same code as syllable - \ifnum\gre@lastoflinecount=1\relax % - \global\gre@lastoflinecount=2\relax % - \else % - \gre@debugmsg{ifdim}{ temp@skip@two < -wd(gre@box@syllablenotes)}% - \ifdim\gre@skip@temp@two < -\wd\gre@box@syllablenotes % - \gre@debugmsg{ifdim}{ nextbegindifference > 0pt}% - \ifdim\gre@skip@nextbegindifference > 0 pt\relax% - \gre@skip@temp@one = \gre@space@skip@interwordspacetext\relax% - \gre@hskip\gre@skip@temp@one % - \else % \ifdim\gre@skip@nextbegindifference > 0 pt - \gre@skip@temp@one = \gre@space@skip@interwordspacetext\relax% - \gre@hskip\gre@skip@temp@one % - \fi % - \else % - \gre@skip@temp@two=\gre@skip@temp@three % - \gre@debugmsg{ifdim}{ nextbegindifference < 0pt}% - \ifdim\gre@skip@nextbegindifference < 0 pt\relax% - \advance\gre@skip@temp@two by \gre@skip@nextbegindifference\relax% - \fi % - \gre@debugmsg{ifdim}{ temp@skip@two > -wd(gre@box@syllablenotes)}% - \ifdim\gre@skip@temp@two > -\wd\gre@box@syllablenotes % - \kern\gre@skip@temp@two % - \else % \ifdim\gre@dimen@temp@five > -\wd\gre@box@syllablenotes - \gre@skip@temp@one = -\wd\gre@box@syllablenotes % - \gre@hskip\gre@skip@temp@one % - \fi % - \fi % - \fi % - % then the most simple : the case where there is something to write under the bar. We just need to adjust the spaces. - \else %ifdim\wd\gre@box@syllabletext = 0 pt - #8\relax % - \raise\gre@dimen@textlower \copy\gre@box@syllabletext % - \ifgre@mustdotranslationcenterend% - % case of end of translation centering, we do it after the typesetting of the text - \gre@dotranslationcenterend % - \gre@mustdotranslationcenterendfalse% - \fi % - \gre@skip@temp@one = -\wd\gre@box@syllabletext % - \kern\gre@skip@temp@one % - \gre@skip@temp@one = -\gre@dimen@begindifference\relax% - \kern\gre@skip@temp@one % - #9% - \gre@debugmsg{ifdim}{ enddifference < 0pt}% - \ifdim\gre@dimen@enddifference <0pt\relax% - %% important, else we are not really at the end of the syllable - \gre@skip@temp@one = -\gre@dimen@enddifference\relax% - \kern\gre@skip@temp@one % - \fi% - % end of same code as syllable - \ifnum\gre@lastoflinecount=1\relax % - \global\gre@lastoflinecount=2\relax % - \gre@endafterbar{0}% - \else % - \global\gre@lastoflinecount=0\relax % - \gre@endafterbar{1}% - \fi % - %and that's it !! - \fi % - \fi% - \global\gre@dimen@notesaligncenter= 0 pt\relax % very important, see flat and natural - \gre@unsetfixedtextformat % - \ifgre@blockeolcustos\ifnum\gre@insidediscretionary=0\relax % - \gre@localrightbox{}% - \fi\fi % - \relax% + \gre@debugmsg{general}{New bar syllable}% + \gre@possibleluahyphenafterthissyllablefalse % + \gre@showhyphenafterthissyllablefalse % + % the algorithm of this function is *extremely* complex, and has been much painful to write... good luck to understand. + % the main goal is, when there is no text under the bar, to put the bar in the middle of the space between the last note of the previous syllable and the first note of the next syllable. But there are limits : a bar can't go very far above text. For example if there is "nuncncncncn" with a punctum on the u, the bar can't go above the fourth n, the most far position is the position where the end of the bar is above the end of the word. The same limitation applies for the syllable after the bar. + % there are two different cases that have almost nothing in common : the case where there is something written under the bar, and the case where there is nothing. + % first of all we need to calculate previousenddifference, begindifference, enddifference and nextbegindifference. + #1% + \gre@calculate@textaligncenter{\gre@firstsyllablepart}{\gre@middlesyllablepart}{0}% + \ifgre@showlyrics% + \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart}{#6}}}% + \else% + \setbox\gre@box@syllabletext=\box\voidb@x% + \fi% + \gre@debugmsg{barspacing}{Width of bar text: \the\wd\gre@box@syllabletext}% + \global\let\gre@newlinecommonsaved\gre@newlinecommon % + \global\let\gre@newlinecommon\gre@newlinecommondelayed % + \xdef\gre@newlinearg{-1}% + \gre@syllablenotes{#9}% + \gre@debugmsg{barspacing}{Width of bar line: \the\wd\gre@box@syllablenotes}% + \gre@dimen@notesaligncenter=\dimexpr(\wd\gre@box@syllablenotes / 2)\relax % + \gre@dimen@begindifference=\dimexpr(\gre@dimen@notesaligncenter - \gre@dimen@textaligncenter)\relax% + \gre@calculate@enddifference{\wd\gre@box@syllablenotes}{\wd\gre@box@syllabletext}{\gre@dimen@textaligncenter}{\gre@dimen@notesaligncenter}{1}% + #5% + \gre@calculate@nextbegindifference{\gre@nextfirstsyllablepart}{\gre@nextmiddlesyllablepart}{\gre@nextendsyllablepart}{#7}% + \gre@unsetfixednexttextformat % + \gre@debugmsg{barspacing}{previousenddifference: \the\gre@dimen@previousenddifference}% + \gre@debugmsg{barspacing}{begindifference: \the\gre@dimen@begindifference}% + \gre@debugmsg{barspacing}{enddifference: \the\gre@dimen@enddifference}% + \gre@debugmsg{barspacing}{nextbegindifference: \the\gre@skip@nextbegindifference}% + \ifgre@newbarspacing% + % + % New bar spacing algorithm + % + \gre@calculate@barposition{#4}{#7}% + %now we can place the text and bar + %we're going to use the bar line to control positioning, so we need to start by getting to the end of the notes of the previous syllable + \ifdim\gre@dimen@adjustedpreviousenddifference < 0pt\relax% + %we need to move back to where the previous notes ended + \kern\gre@dimen@adjustedpreviousenddifference\relax% + \GreNoBreak % + \fi% + %move to the beginning of the text + \gre@hskip\glueexpr(\gre@skip@bar@allocation/2% right from end of previous notes to nominal middle of bar line + +\gre@dimen@bar@shift% from nominal middle of bar line to actual middle + -\wd\gre@box@syllablenotes/2% back up to beginning of bar line + +\gre@dimen@begindifference% from beginning of bar line to beginning of text + +\gre@space@skip@bar@rubber)\relax % the rubber component + \GreNoBreak % + % all that extra stuff (translations and the like) + #8% + \GreNoBreak % + %print the text, the raise is in case of a translation + \raise\gre@dimen@textlower \copy\gre@box@syllabletext% + %and the code which handles translation centering + \ifgre@mustdotranslationcenterend% + % case of end of translation centering, we do it after the typesetting of the text + \gre@dotranslationcenterend % + \gre@mustdotranslationcenterendfalse% + \fi % + %move back to the beginning of the bar line + \kern\dimexpr(\gre@dimen@enddifference% move from end of text to end of bar line + -\wd\gre@box@syllablenotes)\relax % back up from end of bar line to beginning + \GreNoBreak% + \ifgre@shownotes% + #9% + \fi% + \global\let\gre@newlinecommon\gre@newlinecommonsaved % + \GreNoBreak% + % get into position to place the penalty + \ifdim\gre@dimen@enddifference < 0pt\relax% + % the text extends past the notes, so we need to get to the end of the text + \kern-\gre@dimen@enddifference% + \GreNoBreak% + \fi% + \ifgre@eolshiftsenabled% + %this shift will shorten the line somewhat to allow the lyrics to extend under the custos should TeX decide to insert a line break after the syllable being ended + \gre@calculate@eolshift{\dimexpr(\gre@dimen@enddifference-\gre@skip@bar@lastskip)\relax }% + \gre@debugmsg{barspacing}{End of line shift: \the\gre@dimen@eolshift}% + \ifdim\gre@dimen@eolshift<\gre@skip@bar@lastskip % + \gre@dimen@eolshift=\gre@skip@bar@lastskip\relax % + \fi % + \kern\glueexpr(-\gre@dimen@eolshift)\relax% + \fi% + % gre@count@temp@one is "forced end of line or last of score" + \gre@count@temp@one=0\relax % + \ifnum\gre@newlinearg=-1\else % + \gre@count@temp@one=1\relax % + \fi % + \ifnum\gre@lastoflinecount=1\relax % + \gre@count@temp@one=1\relax % + \fi % + \ifgre@endofscore % + \gre@count@temp@one=1\relax % + \fi % + % if no end of line or end of score + \ifnum\gre@count@temp@one=0\relax % + % add the penalty + \gre@debugmsg{barspacing}{after bar penalty: \the\gre@space@count@endafterbarpenalty}% + \gre@penalty{\the\gre@space@count@endafterbarpenalty}% + \ifgre@eolshiftsenabled% + %If the above penalties don't result in a line break, then we need to undo the eolshift to prevent the next syllable from overlapping with this one. If the line break did occur, then this shift will occur at the beginning of a line and thus will be ignored automatically by TeX. + \kern \dimexpr(\gre@dimen@eolshift)\relax% + \GreNoBreak% + \fi% + \ifdim\gre@dimen@enddifference < 0pt\relax% + %undo the earlier shift + \kern\gre@dimen@enddifference% + \GreNoBreak% + \fi% + %move to the beginning of the notes of the next syllable + \gre@hskip\glueexpr(-\wd\gre@box@syllablenotes/2% back up to middle of notes + -\gre@dimen@bar@shift% go back from actual middle to nominal middle of bar line + +\gre@skip@bar@allocation/2% go from nominal middle to the start of the next notes + +\gre@space@skip@bar@rubber)\relax % the rubber component + \ifdim\gre@skip@nextbegindifference < 0pt\relax% + %we need to move back to where the text for the next syllable should start + \GreNoBreak % + \kern\gre@skip@nextbegindifference\relax% + \fi% + \else % + \ifgre@endofscore % + \gre@localleftbox{}% + \gre@debugmsg{barspacing}{after bar penalty: \gre@space@count@endafterbarpenalty}% + \gre@penalty{\the\gre@space@count@finalpenalty}% + \else % + \ifnum\gre@newlinearg=-1\else % + \gre@debugmsg{barspacing}{calling new line with argument: \gre@newlinearg}% + \gre@newlinecommon{\gre@newlinearg}{1}% + \fi % + \fi % + \fi% + \else% + % + % Old spacing algorithm + % + %This is the old algorithm. I've kept it in case people still want to use it. + % then we check if there is something to write + \global\let\gre@newlinecommon\gre@newlinecommonsaved % + \gre@debugmsg{ifdim}{ wd(gre@box@syllabletext) = 0pt}% + \ifdim\wd\gre@box@syllabletext = 0 pt\relax % + % the most difficult case : when there is nothing to write + % first we need to determine the real space that there will be between the notes. Here again it is not so simple... let's consider these two kinds of spaces : + %% 1/ the minimal space between a note and the bar + the width of the bar + the minimal space between the bar and the note (that's the global idea, in fact there are nuances) : we assign skip@temp@three to it + %% 2/ enddifference + begindifference + space between notes and word : we assign skip@temp@two to it + \gre@skip@temp@three=\glueexpr(\gre@space@skip@notebarspace % + + \gre@space@skip@notebarspace % + + \wd\gre@box@syllablenotes)\relax % + % now let's get skip@temp@two + \gre@debugmsg{ifdim}{ nextbegindifference < 0pt}% + \ifdim\gre@skip@nextbegindifference < 0 pt\relax% + \gre@skip@temp@two=-\gre@skip@nextbegindifference\relax% + \else % + \gre@skip@temp@two=0 pt\relax% + \fi % + \gre@debugmsg{ifdim}{ previousenddifference < 0pt}% + \ifdim\gre@dimen@previousenddifference < 0 pt\relax% + \advance\gre@skip@temp@two by % + \glueexpr(-\gre@dimen@previousenddifference % + + \gre@space@skip@interwordspacetext)\relax% + \else % + \advance\gre@skip@temp@two by \gre@space@skip@interwordspacenotes\relax% + \fi% + % we take the max of it, then we divide it by two and we substract half of the width of the bar + \gre@debugmsg{ifdim}{ temp@skip@three < temp@skip@two}% + \ifdim\gre@skip@temp@three <\gre@skip@temp@two % + \gre@skip@temp@three=\gre@skip@temp@two % + \fi % + \divide\gre@skip@temp@three by 2\relax % + \advance\gre@skip@temp@three by \dimexpr(\wd\gre@box@syllablenotes / -2)\relax % + % now we have our skipone + \gre@skip@temp@two=\gre@skip@temp@three % + \gre@debugmsg{ifdim}{ previousenddifference < 0pt}% + \ifdim\gre@dimen@previousenddifference < 0 pt\relax% + \advance\gre@skip@temp@two by \gre@dimen@previousenddifference\relax% + \fi % + \GreNoBreak % + \gre@debugmsg{ifdim}{ temp@skip@two > -wd(gre@box@syllablenotes)}% + \ifdim\gre@skip@temp@two > -\wd\gre@box@syllablenotes % + \kern\gre@skip@temp@two % + \else % + \gre@skip@temp@one = -\wd\gre@box@syllablenotes % + \kern\gre@skip@temp@one% + \fi % + \GreNoBreak % + #8\relax % + \ifgre@mustdotranslationcenterend% + % case of end of translation centering, we do it after the typesetting of the text + \gre@dotranslationcenterend % + \gre@mustdotranslationcenterendfalse% + \fi % + \ifgre@shownotes% + #9\relax % + \fi% + \gre@penalty{\the\gre@space@count@endafterbaraltpenalty }% TODO: isn't it a bit buggy? + % end of same code as syllable + \ifnum\gre@lastoflinecount=1\relax % + \global\gre@lastoflinecount=2\relax % + \else % + \gre@debugmsg{ifdim}{ temp@skip@two < -wd(gre@box@syllablenotes)}% + \ifdim\gre@skip@temp@two < -\wd\gre@box@syllablenotes % + \gre@debugmsg{ifdim}{ nextbegindifference > 0pt}% + \ifdim\gre@skip@nextbegindifference > 0 pt\relax% + \gre@skip@temp@one = \gre@space@skip@interwordspacetext\relax% + \gre@hskip\gre@skip@temp@one % + \else % \ifdim\gre@skip@nextbegindifference > 0 pt + \gre@skip@temp@one = \gre@space@skip@interwordspacetext\relax% + \gre@hskip\gre@skip@temp@one % + \fi % + \else % + \gre@skip@temp@two=\gre@skip@temp@three % + \gre@debugmsg{ifdim}{ nextbegindifference < 0pt}% + \ifdim\gre@skip@nextbegindifference < 0 pt\relax% + \advance\gre@skip@temp@two by \gre@skip@nextbegindifference\relax% + \fi % + \gre@debugmsg{ifdim}{ temp@skip@two > -wd(gre@box@syllablenotes)}% + \ifdim\gre@skip@temp@two > -\wd\gre@box@syllablenotes % + \kern\gre@skip@temp@two % + \else % \ifdim\gre@dimen@temp@five > -\wd\gre@box@syllablenotes + \gre@skip@temp@one = -\wd\gre@box@syllablenotes % + \gre@hskip\gre@skip@temp@one % + \fi % + \fi % + \fi % + % then the most simple : the case where there is something to write under the bar. We just need to adjust the spaces. + \else %ifdim\wd\gre@box@syllabletext = 0 pt + #8\relax % + \raise\gre@dimen@textlower \copy\gre@box@syllabletext % + \ifgre@mustdotranslationcenterend% + % case of end of translation centering, we do it after the typesetting of the text + \gre@dotranslationcenterend % + \gre@mustdotranslationcenterendfalse% + \fi % + \gre@skip@temp@one = -\wd\gre@box@syllabletext % + \kern\gre@skip@temp@one % + \gre@skip@temp@one = -\gre@dimen@begindifference\relax% + \kern\gre@skip@temp@one % + \ifgre@shownotes% + #9% + \fi% + \gre@debugmsg{ifdim}{ enddifference < 0pt}% + \ifdim\gre@dimen@enddifference <0pt\relax% + %% important, else we are not really at the end of the syllable + \gre@skip@temp@one = -\gre@dimen@enddifference\relax% + \kern\gre@skip@temp@one % + \fi% + % end of same code as syllable + \ifnum\gre@lastoflinecount=1\relax % + \global\gre@lastoflinecount=2\relax % + \gre@endafterbar{0}% + \else % + \global\gre@lastoflinecount=0\relax % + \gre@endafterbar{1}% + \fi % + %and that's it !! + \fi % + \fi% + \global\gre@dimen@notesaligncenter= 0 pt\relax % very important, see flat and natural + \gre@unsetfixedtextformat % + \ifgre@blockeolcustos\ifnum\gre@insidediscretionary=0\relax % + \gre@localrightbox{}% + \fi\fi % + \relax% } \newif\ifgre@newbarspacing% @@ -1232,35 +1293,35 @@ %% #5 - Everything after the first letter of the syllable %% #6 - Macros to run after the text is emitted \def\gre@setfirstsyllabletext#1#2#3#4#5#6{% - \def\gre@opening@syllabletext{% - \GreSetThisSyllable{#1}{#2}{#3}% - {\GreFirstWord{\GreFirstSyllable{\GreFirstSyllableInitial{#4}}}}% - {\GreFirstWord{\GreFirstSyllable{#5}}}% - #6\relax % - }% + \def\gre@opening@syllabletext{% + \GreSetThisSyllable{#1}{#2}{#3}% + {\GreFirstWord{\GreFirstSyllable{\GreFirstSyllableInitial{#4}}}}% + {\GreFirstWord{\GreFirstSyllable{#5}}}% + #6\relax % + }% }% \def\gresetinitiallines#1{% - \IfInteger{#1}% - {% - \ifnum#1>-1\relax% - \ifnum#1<3\relax% - \def\gre@initiallines{#1}% - \else% - \gre@error{The argument for \protect\gresetinitiallines\space must be 0, 1, or 2}% - \fi% - \else% - \gre@error{The argument for \protect\gresetinitiallines\space must be positive}% - \fi% - }% - {\gre@error{\protect\gresetinitiallines\space takes a positive integer argument}}% + \IfInteger{#1}% + {% + \ifnum#1>-1\relax% + \ifnum#1<3\relax% + \def\gre@initiallines{#1}% + \else% + \gre@error{The argument for \protect\gresetinitiallines\space must be 0, 1, or 2}% + \fi% + \else% + \gre@error{The argument for \protect\gresetinitiallines\space must be positive}% + \fi% + }% + {\gre@error{\protect\gresetinitiallines\space takes a positive integer argument}}% }% \gresetinitiallines{1}% default to one-line initials -\def\GreSetInitialStyle#1{%%% DEPRECATED by 4.1 - \gre@deprecated{initial-style gabc header}{\protect\gresetinitiallines}%%% DEPRECATED by 4.1 - \def\gre@opening@initialstyle{#1}%%% DEPRECATED by 4.1 -}%%% DEPRECATED by 4.1 +\def\GreSetInitialStyle#1{%%% DEPRECATED for removal in 5.0 + \gre@deprecated{initial-style gabc header}{\protect\gresetinitiallines}%%% DEPRECATED for removal in 5.0 + \def\gre@opening@initialstyle{#1}%%% DEPRECATED for removal in 5.0 +}%%% DEPRECATED for removal in 5.0 %% sets the first syllable text %% #1 - Initial @@ -1270,31 +1331,31 @@ %% #5 - Three syllable parts where there is no separated initial %% #6 - Extra macros to run if there is an initial \def\GreSetFirstSyllableText#1#2#3#4#5#6{% - %%% DEPRECATED by 4.1: When \gre@opening@initialstyle is removed, use \gre@initiallines directly in the following line - \ifcase\gre@opening@initialstyle\relax % no initial - \gre@noinitial % - \gre@setfirstsyllabletext#5{#1}{#2#3}{}% - \or % regular intiial - \gre@setinitial{#1}% - \gre@setfirstsyllabletext#4{#2}{#3}{#6}% - \or % big initial - \gre@setbiginitial\gre@setinitial{#1}% - \gre@setfirstsyllabletext#4{#2}{#3}{#6}% - \fi % + %%% DEPRECATED for removal in 5.0: When \gre@opening@initialstyle is removed, use \gre@initiallines directly in the following line + \ifcase\gre@opening@initialstyle\relax % no initial + \gre@noinitial % + \gre@setfirstsyllabletext#5{#1}{#2#3}{}% + \or % regular intiial + \gre@setinitial{#1}% + \gre@setfirstsyllabletext#4{#2}{#3}{#6}% + \or % big initial + \gre@setbiginitial\gre@setinitial{#1}% + \gre@setfirstsyllabletext#4{#2}{#3}{#6}% + \fi % }% \def\GreSetNoFirstSyllableText{% - \gre@noinitial % - \gre@setfirstsyllabletext{}{}{}{}{}{}% + \gre@noinitial % + \gre@setfirstsyllabletext{}{}{}{}{}{}% }% \def\GreUpcomingNewLineForcesCustos#1{% - \ifcase#1\relax % 0 - forced off - \gre@usemanualeolcustos % - \or % 1 - forced on - \gre@useautoeolcustos % - \GreNextCustos{\gre@nextcustos}% - \fi % + \ifcase#1\relax % 0 - forced off + \gre@usemanualeolcustos % + \or % 1 - forced on + \gre@useautoeolcustos % + \GreNextCustos{\gre@nextcustospitch}{\gre@nextcustosalteration}% + \fi % }% %% opens a score @@ -1305,17 +1366,17 @@ %% #5 - macros rendering the first syllable; should emit the initial and %% populate \gre@opening@syllabletext (even if that should be empty) \def\GreScoreOpening#1#2#3#4#5{% - #3\relax % fixed styles, etc. - #5\relax % should emit the initial - \ifnum\gre@biginitial=1\relax % - \gre@debugmsg{general}{making adjustment NECESSARY}% - \gre@thirdlineadjustmentnecessarytrue % - \else % - \gre@debugmsg{general}{making adjustment unnecessary}% - \gre@thirdlineadjustmentnecessaryfalse % - \fi % - #1\relax % score reference, voice info, etc. - \gre@beginnotes\relax % - #2\relax % initial clef, etc. - #4{\gre@opening@syllabletext}% + #3\relax % fixed styles, etc. + #5\relax % should emit the initial + \ifnum\gre@biginitial=1\relax % + \gre@debugmsg{general}{making adjustment NECESSARY}% + \gre@thirdlineadjustmentnecessarytrue % + \else % + \gre@debugmsg{general}{making adjustment unnecessary}% + \gre@thirdlineadjustmentnecessaryfalse % + \fi % + #1\relax % score reference, voice info, etc. + \gre@beginnotes\relax % + #2\relax % initial clef, etc. + #4{\gre@opening@syllabletext}% }% diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.lua b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.lua index bf8bbe404a8..633e1397f6e 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.lua +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.lua @@ -19,7 +19,7 @@ -- this file contains lua functions to support signs used by GregorioTeX. --- GREGORIO_VERSION 4.1.1 +-- GREGORIO_VERSION 4.2.0-beta1 local err = gregoriotex.module.err local warn = gregoriotex.module.warn diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.tex index 79edaf7ad73..7b56622e351 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.tex +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.tex @@ -23,7 +23,7 @@ \def\gregoriotex@symbols@loaded{}% \gre@debugmsg{general}{Loading gregoriotex-symbols.tex}% -\gre@declarefileversion{gregoriotex-symbols.tex}{4.1.1}% GREGORIO_VERSION +\gre@declarefileversion{gregoriotex-symbols.tex}{4.2.0-beta1}% GREGORIO_VERSION \RequireLuaModule{gregoriotex}% @@ -34,8 +34,8 @@ % #2 = font name % #3 = glyph name or code point \def\gredefsymbol#1#2#3{% - \directlua{gregoriotex.init_variant_font([[#2]],false)}% - \directlua{gregoriotex.def_symbol([[#1]],[[#2]],[[#3]],false)}% + \directlua{gregoriotex.init_variant_font([[#2]],false)}% + \directlua{gregoriotex.def_symbol([[#1]],[[#2]],[[#3]],false)}% }% % Defines a symbol which takes a point size as argument @@ -43,8 +43,8 @@ % #2 = font name % #3 = glyph name or code point \def\gredefsizedsymbol#1#2#3{% - \directlua{gregoriotex.init_variant_font([[#2]],false)}% - \directlua{gregoriotex.def_symbol([[#1]],[[#2]],[[#3]],true)}% + \directlua{gregoriotex.init_variant_font([[#2]],false)}% + \directlua{gregoriotex.def_symbol([[#1]],[[#2]],[[#3]],true)}% }% %%%%%%%%%%%%% @@ -83,8 +83,8 @@ \gredefsizedsymbol{greVBarAlt}{greextra}{VBar.alt} \def\grebarredsymbol#1#2#3#4#5{% - \leavevmode\hbox to 0pt{}\kern #4\lower#5% - \hbox{\csname #2\endcsname{#3}}\kern -#4\relax #1% + \leavevmode\hbox to 0pt{}\kern #4\lower#5% + \hbox{\csname #2\endcsname{#3}}\kern -#4\relax #1% }% %% Intermediate version or barred glyph definition @@ -95,16 +95,16 @@ %% #5: the kern of the bar from the beggining of the glyph %% #6: greextra glyph lowering \def\gredefbarredsymbol#1#2#3#4#5#6{% - \expandafter\gdef\csname #1\endcsname {% - \grebarredsymbol{#2}{#3}{#4}{#5}{#6}% - }% + \expandafter\gdef\csname #1\endcsname {% + \grebarredsymbol{#2}{#3}{#4}{#5}{#6}% + }% }% %% Most simple version or barred glyph definition %% #1: A, R or V %% #2: the negative kern \def\gresimpledefbarredsymbol#1#2{% - \gredefbarredsymbol{#1bar}{#1}{gre#1Bar}{\f@size}{#2}{0pt}% + \gredefbarredsymbol{#1bar}{#1}{gre#1Bar}{\f@size}{#2}{0pt}% }% % defining \ABar, \VBar and \RBar for libertine font, define yours for your font @@ -113,44 +113,44 @@ \gresimpledefbarredsymbol{V}{.10em}% \gre@iflatex{% - \def\gre@latex@barredsymbol#1#2#3#4{% - \IfStrEq{\f@series/\f@shape}{#1}{\grebarredsymbol{#2}{#3}{\f@size}{#4}{0pt}}% - }% - - %% define a barred symbol that handles italic, slanted, and small cap shapes - %% simply (LaTeX-only) - %% Most simple version or barred glyph definition - %% #1: A, R or V - %% #2: the negative kern for upright shape - %% #3: idem, for italic/slanted shape - %% #4: idem, for bold shape - %% #5: idem, for bold and italic/slanted shape - \def\grelatexsimpledefbarredsymbol#1#2#3#4#5{% - \expandafter\gdef\csname #1bar\endcsname {% - \gre@latex@barredsymbol{m/n}{#1}{gre#1Bar}{#2}{% - \gre@latex@barredsymbol{m/it}{#1}{gre#1BarSlant}{#3}{% - \gre@latex@barredsymbol{m/sl}{#1}{gre#1BarSlant}{#3}{% - \gre@latex@barredsymbol{bx/n}{#1}{gre#1Bar}{#4}{% - \gre@latex@barredsymbol{bx/it}{#1}{gre#1BarSlant}{#5}{% - \gre@latex@barredsymbol{bx/sl}{#1}{gre#1BarSlant}{#5}{% - \gre@latex@barredsymbol{b/n}{#1}{gre#1Bar}{#4}{% - \gre@latex@barredsymbol{b/it}{#1}{gre#1BarSlant}{#5}{% - \gre@latex@barredsymbol{b/sl}{#1}{gre#1BarSlant}{#5}{% - }% - }% - }% - }% - }% - }% - }% - }% - }% - }% - }% - - \grelatexsimpledefbarredsymbol{A}{.30em}{.35em}{.30em}{.33em}% - \grelatexsimpledefbarredsymbol{R}{.35em}{.38em}{.45em}{.48em}% - \grelatexsimpledefbarredsymbol{V}{.10em}{.12em}{.14em}{.18em}% + \def\gre@latex@barredsymbol#1#2#3#4{% + \IfStrEq{\f@series/\f@shape}{#1}{\grebarredsymbol{#2}{#3}{\f@size}{#4}{0pt}}% + }% + + %% define a barred symbol that handles italic, slanted, and small cap shapes + %% simply (LaTeX-only) + %% Most simple version or barred glyph definition + %% #1: A, R or V + %% #2: the negative kern for upright shape + %% #3: idem, for italic/slanted shape + %% #4: idem, for bold shape + %% #5: idem, for bold and italic/slanted shape + \def\grelatexsimpledefbarredsymbol#1#2#3#4#5{% + \expandafter\gdef\csname #1bar\endcsname {% + \gre@latex@barredsymbol{m/n}{#1}{gre#1Bar}{#2}{% + \gre@latex@barredsymbol{m/it}{#1}{gre#1BarSlant}{#3}{% + \gre@latex@barredsymbol{m/sl}{#1}{gre#1BarSlant}{#3}{% + \gre@latex@barredsymbol{bx/n}{#1}{gre#1Bar}{#4}{% + \gre@latex@barredsymbol{bx/it}{#1}{gre#1BarSlant}{#5}{% + \gre@latex@barredsymbol{bx/sl}{#1}{gre#1BarSlant}{#5}{% + \gre@latex@barredsymbol{b/n}{#1}{gre#1Bar}{#4}{% + \gre@latex@barredsymbol{b/it}{#1}{gre#1BarSlant}{#5}{% + \gre@latex@barredsymbol{b/sl}{#1}{gre#1BarSlant}{#5}{% + }% + }% + }% + }% + }% + }% + }% + }% + }% + }% + }% + + \grelatexsimpledefbarredsymbol{A}{.30em}{.35em}{.30em}{.33em}% + \grelatexsimpledefbarredsymbol{R}{.35em}{.38em}{.45em}{.48em}% + \grelatexsimpledefbarredsymbol{V}{.10em}{.12em}{.14em}{.18em}% }% % the gothic R and V @@ -184,18 +184,15 @@ %#1 is the type of line (1-5) %#2 is the number of pt of the font it will use \def\greseparator#1#2{% - \ifcase#1\relax % - \or\greLineOne{#2}% - \or\greLineTwo{#2}% - \or\greLineThree{#2}% - \or\greLineFour{#2}% - \or\greLineFive{#2}% - \fi% + \ifcase#1\relax % + \or\greLineOne{#2}% + \or\greLineTwo{#2}% + \or\greLineThree{#2}% + \or\greLineFour{#2}% + \or\greLineFive{#2}% + \fi% }% -\def\gresep#1#2{%OBSOLETE - \gre@obsolete{\protect\gresep}{\protect\greseparator}% -} %%%%%%%%%%% %% Ornamentation @@ -205,10 +202,10 @@ \gredefsizedsymbol{greOrnamentTwo}{greextra}{Drawing2}% \def\greornamentation#1#2{% - \ifcase#1\relax% - \or\greOrnamentOne{#2}% - \or\greOrnamentTwo{#2}% - \fi% + \ifcase#1\relax% + \or\greOrnamentOne{#2}% + \or\greOrnamentTwo{#2}% + \fi% }% %% Specials diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua index 4f94d1a1f9b..e00885a3ca5 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua @@ -24,13 +24,13 @@ local hpack, traverse, traverse_id, has_attribute, count, remove, insert_after, gregoriotex = gregoriotex or {} local gregoriotex = gregoriotex -local internalversion = '4.1.1' -- GREGORIO_VERSION (comment used by VersionManager.py) +local internalversion = '4.2.0-beta1' -- GREGORIO_VERSION (comment used by VersionManager.py) local err, warn, info, log = luatexbase.provides_module({ name = "gregoriotex", - version = '4.1.1', -- GREGORIO_VERSION + version = '4.2.0-beta1', -- GREGORIO_VERSION greinternalversion = internalversion, - date = "2016/03/10", -- GREGORIO_DATE_LTX + date = "2016/04/27", -- GREGORIO_DATE_LTX description = "GregorioTeX module.", author = "The Gregorio Project (see CONTRIBUTORS.md)", copyright = "2008-2015 - The Gregorio Project", @@ -68,11 +68,14 @@ local line_heights = nil local new_line_heights = nil local score_heights = nil local new_score_heights = nil -local var_brace_positions = nil -local new_var_brace_positions = nil -local pos_saves = nil -local new_pos_saves = nil +local saved_positions = nil +local saved_lengths = nil +local new_saved_lengths = nil +local saved_newline_before_euouae = nil +local new_saved_newline_before_euouae = nil local auxname = nil +local snippet_filename = nil +local snippet_logname = nil local space_below_staff = 5 local space_above_staff = 13 @@ -134,7 +137,35 @@ local function keys_changed(tab1, tab2) return false end -local function heights_changed() +local function saved_computations_changed(tab1, tab2) + local score_ids = {} + local id,_ + for id,_ in pairs(tab1) do + score_ids[id] = true + end + for id,_ in pairs(tab2) do + score_ids[id] = true + end + for id,_ in pairs(score_ids) do + local inner1 = tab1[id] + local inner2 = tab2[id] + if inner1 == nil or inner2 == nil then return true end + local keys = {} + local index + for index,_ in pairs(inner1) do + keys[index] = true + end + for index,_ in pairs(inner2) do + keys[index] = true + end + for index,_ in pairs(keys) do + if inner1[index] ~= inner2[index] then return true end + end + end + return false +end + +local function is_greaux_write_needed() local id, tab for id, tab in pairs(new_line_heights) do if keys_changed(tab, line_heights[id]) then return true end @@ -142,30 +173,24 @@ local function heights_changed() for id, tab in pairs(line_heights) do if keys_changed(tab, new_line_heights[id]) then return true end end - for id, tab in pairs(new_var_brace_positions) do - if keys_changed(tab, var_brace_positions[id]) then return true end + if saved_computations_changed(saved_lengths, new_saved_lengths) then + return true end - for id, tab in pairs(var_brace_positions) do - if keys_changed(tab, new_var_brace_positions[id]) then return true end - end - for id, tab in pairs(new_pos_saves) do - if keys_changed(tab, pos_saves[id]) then return true end - end - for id, tab in pairs(pos_saves) do - if keys_changed(tab, new_pos_saves[id]) then return true end + if saved_computations_changed(saved_newline_before_euouae, new_saved_newline_before_euouae) then + return true end return false end local function write_greaux() - if heights_changed() then + if is_greaux_write_needed() then -- only write this if heights change; since table ordering is not -- predictable, this ensures a steady state if the heights are unchanged. local aux = io.open(auxname, 'w') if aux then log("Writing %s", auxname) aux:write('return {\n ["line_heights"]={\n') - local id, tab, id2, line + local id, tab, id2, line, value for id, tab in pairs(new_line_heights) do aux:write(string.format(' ["%s"]={\n', id)) for id2, line in pairs(tab) do @@ -174,25 +199,26 @@ local function write_greaux() end aux:write(' },\n') end - aux:write(' },\n ["var_brace_positions"]={\n') - for id, tab in pairs(new_var_brace_positions) do + aux:write(' },\n ["saved_lengths"]={\n') + for id, tab in pairs(new_saved_lengths) do aux:write(string.format(' ["%s"]={\n', id)) - for id2, line in pairs(tab) do - if line[1] ~= nil and line[2] ~= nil then - aux:write(string.format(' [%d]={%d,%d},\n', id2, line[1], - line[2])) + for id2, value in pairs(tab) do + if value ~= nil then + aux:write(string.format(' [%d]=%d,\n', id2, value)) end end aux:write(' },\n') end - aux:write(' },\n ["pos_saves"]={\n') - for id, tab in pairs(new_pos_saves) do + aux:write(' },\n ["saved_newline_before_euouae"]={\n') + for id, tab in pairs(new_saved_newline_before_euouae) do aux:write(string.format(' ["%s"]={\n', id)) - for id2, line in pairs(tab) do - if line[1] ~= nil and line[2] ~= nil and line[3] ~= nil and - line[4] ~= nil then - aux:write(string.format(' [%d]={%d,%d,%d,%d},\n', id2, line[1], - line[2], line[3], line[4])) + for id2, value in pairs(tab) do + if value ~= nil then + if value then + aux:write(string.format(' [%d]=true,\n', id2)) + else + aux:write(string.format(' [%d]=false,\n', id2)) + end end end aux:write(' },\n') @@ -221,8 +247,12 @@ local function init(arg, enable_height_computation) end if outputdir and lfs.isdir(outputdir) then auxname = outputdir..'/'..tex.jobname..'.gaux' + snippet_filename = outputdir..'/'..tex.jobname..'.gsnippet' + snippet_logname = outputdir..'/'..tex.jobname..'.gsniplog' else auxname = tex.jobname..'.gaux' + snippet_filename = tex.jobname..'.gsnippet' + snippet_logname = tex.jobname..'.gsniplog' end -- to get latexmk to realize the aux file is a dependency @@ -231,12 +261,12 @@ local function init(arg, enable_height_computation) log("Reading %s", auxname) local score_info = dofile(auxname) line_heights = score_info.line_heights or {} - var_brace_positions = score_info.var_brace_positions or {} - pos_saves = score_info.pos_saves or {} + saved_lengths = score_info.saved_lengths or {} + saved_newline_before_euouae = score_info.saved_newline_before_euouae or {} else line_heights = {} - var_brace_positions = {} - pos_saves = {} + saved_lengths = {} + saved_newline_before_euouae = {} end if enable_height_computation then @@ -262,8 +292,9 @@ local function init(arg, enable_height_computation) 'line heights. Remove or undefine \\greskipheightcomputation to '.. 'resume height computation.') end - new_var_brace_positions = {} - new_pos_saves = {} + saved_positions = {} + new_saved_lengths = {} + new_saved_newline_before_euouae = {} end -- node factory @@ -527,19 +558,43 @@ local function clean_old_gtex_files(file_withdir) end end -local function compile_gabc(gabc_file, gtex_file) +local function compile_gabc(gabc_file, gtex_file, glog_file, allow_deprecated) info("compiling the score %s...", gabc_file) local extra_args = '' if tex.count['gre@generate@pointandclick'] == 1 then - extra_args = ' -p' + extra_args = extra_args..' -p' + end + if not allow_deprecated then + extra_args = extra_args..' -D' end - res = os.execute(string.format("gregorio %s -o %s %s", extra_args, gtex_file, gabc_file)) + local cmd = string.format("gregorio %s -W -o %s -l %s %s", + extra_args, gtex_file, glog_file, gabc_file) + res = os.execute(cmd) if res == nil then - err("\nSomething went wrong when executing\n 'gregorio -o %s %s'.\n" - .."shell-escape mode may not be activated. Try\n\n%s --shell-escape %s.tex\n\nSee the documentation of gregorio or your TeX\ndistribution to automatize it.", gtex_file, gabc_file, tex.formatname, tex.jobname) + err("\nSomething went wrong when executing\n '%s'.\n" + .."shell-escape mode may not be activated. Try\n\n" + .."%s --shell-escape %s.tex\n\n" + .."See the documentation of gregorio or your TeX\n" + .."distribution to automatize it.", + cmd, tex.formatname, tex.jobname) elseif res ~= 0 then - err("\nAn error occured when compiling the score file\n'%s' with gregorio.\nPlease check your score file.", gabc_file) + local glog = io.open(glog_file, 'a+') + if glog == nil then + err("\n Unable to open %s", glog_file) + else + local size = glog:seek('end') + if size > 0 then + glog:seek('set') + local line + for line in glog:lines() do + warn(line) + end + end + glog:close() + end + err("\nAn error occured when compiling the score file\n" + .."'%s' with gregorio.\nPlease check your score file.", gabc_file) else -- open the gtex file for writing so that LuaTeX records output to it -- when the -recorder option is used @@ -549,10 +604,25 @@ local function compile_gabc(gabc_file, gtex_file) else gtex:close() end + local glog = io.open(glog_file, 'a+') + if glog == nil then + err("\n Unable to open %s", glog_file) + else + local size = glog:seek('end') + if size > 0 then + glog:seek('set') + local line + for line in glog:lines() do + warn(line) + end + warn("*** end of warnings for %s ***", gabc_file) + end + glog:close() + end end end -local function include_score(input_file, force_gabccompile) +local function include_score(input_file, force_gabccompile, allow_deprecated) local file_root if string.match(input_file:sub(-5), '%.gtex') then file_root = input_file:sub(1,-6) @@ -564,6 +634,7 @@ local function include_score(input_file, force_gabccompile) file_root = input_file end local gtex_file = file_root.."-"..internalversion:gsub("%.", "_")..".gtex" + local glog_file = file_root.."-"..internalversion:gsub("%.", "_")..".glog" local gabc_file = file_root..".gabc" if not lfs.isfile(gtex_file) then clean_old_gtex_files(file_root) @@ -576,7 +647,7 @@ local function include_score(input_file, force_gabccompile) else gabc:close() end - compile_gabc(gabc_file, gtex_file) + compile_gabc(gabc_file, gtex_file, glog_file, allow_deprecated) tex.print(string.format([[\input %s\relax]], gtex_file)) return else @@ -597,29 +668,57 @@ local function include_score(input_file, force_gabccompile) end if gtex_timestamp < gabc_timestamp then log("%s has been modified and %s needs to be updated. Recompiling the gabc file.", gabc_file, gtex_file) - compile_gabc(gabc_file, gtex_file) + compile_gabc(gabc_file, gtex_file, glog_file, allow_deprecated) elseif force_gabccompile then - compile_gabc(gabc_file, gtex_file) + compile_gabc(gabc_file, gtex_file, glog_file) end tex.print(string.format([[\input %s\relax]], gtex_file)) return end -local function direct_gabc(gabc, header) - tmpname = os.tmpname() - local f = io.open(tmpname, 'w') +local function direct_gabc(gabc, header, allow_deprecated) + info('Processing gabc snippet...') + local deprecated + if allow_deprecated then + deprecated = '' + else + deprecated = '-D ' + end + local f = io.open(snippet_filename, 'w') -- trims spaces on both ends (trim6 from http://lua-users.org/wiki/StringTrim) gabc = gabc:match('^()%s*$') and '' or gabc:match('^%s*(.*%S)') f:write('name:direct-gabc;\n'..(header or '')..'\n%%\n'..gabc:gsub('\\par ', '\n')) f:close() - local p = io.popen('gregorio -S '..tmpname, 'r') + local cmd = string.format('gregorio -W %s-S -l %s %s', deprecated, snippet_logname, + snippet_filename) + local p = io.popen(cmd, 'r') if p == nil then - err("\nSomething went wrong when executing\n gregorio -S "..tmpname..".\n" - .."shell-escape mode may not be activated. Try\n\n%s --shell-escape %s.tex\n\nSee the documentation of gregorio or your TeX\ndistribution to automatize it.", tex.formatname, tex.jobname) + err("\nSomething went wrong when executing\n %s\n" + .."shell-escape mode may not be activated. Try\n\n" + .."%s --shell-escape %s.tex\n\n" + .."See the documentation of gregorio or your TeX\n" + .."distribution to automatize it.", cmd, tex.formatname, tex.jobname) + else + tex.print(p:read("*a"):explode('\n')) + p:close() end - tex.print(p:read("*a"):explode('\n')) - p:close() - os.remove(tmpname) + local glog = io.open(snippet_logname, 'a+') + if glog == nil then + err("\n Unable to open %s", snippet_logname) + else + local size = glog:seek('end') + if size > 0 then + glog:seek('set') + local line + for line in glog:lines() do + warn(line) + end + warn("*** end of warnings/errors processing snippet ***") + end + glog:close() + end + os.remove(snippet_filename) + os.remove(snippet_logname) end local function get_gregorioversion() @@ -696,10 +795,9 @@ local function check_font_version() local gregoriofont = get_font_by_name('gre@font@music') if gregoriofont then local fontversion = gregoriofont.shared.rawdata.metadata.version - if fontversion ~= internalversion then + if fontversion and string.match(fontversion, "%d+%.%d+%.%d+") ~= string.match(internalversion, "%d+%.%d+%.%d+") then local fontname = gregoriofont.shared.rawdata.metadata.fontname - local fontfile = gregoriofont.shared.rawdata.metadata.origname - err("\nUncoherent file versions!\ngregoriotex.tex is version %s\nwhile %s.ttf is version %s\nplease update file\n%s", internalversion, fontname, fontversion, fontfile) + err("\nUncoherent file versions!\ngregoriotex.tex is version %s\nwhile %s.ttf is version %s\nplease reinstall one so that the\nversions match", string.match(internalversion, "%d+%.%d+%.%d+"), fontname, string.match(fontversion, "%d+%.%d+%.%d+")) end end end @@ -880,64 +978,97 @@ local function adjust_line_height(inside_discretionary) end end -local function var_brace_note_pos(brace, start_end) - tex.print(string.format([[\luatexlatelua{gregoriotex.late_brace_note_pos('%s', %d, %d, \number\pdflastxpos)}]], cur_score_id, brace, start_end)) +local function prep_save_position(index, fn) + if saved_positions[cur_score_id] == nil then + saved_positions[cur_score_id] = {} + end + saved_positions[cur_score_id][index] = { fn = fn } +end + +local function save_position(index, which) + tex.print(catcode_at_letter, string.format([[\luatexlatelua{gregoriotex.late_save_position('%s', %d, %d, \number\gre@lastxpos, \number\gre@lastypos)}]], cur_score_id, index, which)) end -local function late_brace_note_pos(score_id, brace, start_end, pos) - if new_var_brace_positions[score_id] == nil then - new_var_brace_positions[score_id] = {} +local function late_save_position(score_id, index, which, xpos, ypos) + info('saving %s, %d [%d] (%d,%d)', score_id, index, which, xpos, ypos) + local pos = saved_positions[score_id][index] + if pos == nil then + err('Attempting to use unprepared position save slot %d', index) + return + end + --[[ + if pos.fn == nil then + err('Attempting to reuse position save slot %d', index) + return end - if new_var_brace_positions[score_id][brace] == nil then - new_var_brace_positions[score_id][brace] = {} + --]] + pos['x'..which] = xpos + pos['y'..which] = ypos + if pos.x1 ~= nil and pos.y1 ~= nil and pos.x2 ~= nil and pos.y2 ~= nil then + pos.fn(score_id, index, pos) + --pos.fn = nil end - new_var_brace_positions[score_id][brace][start_end] = pos end -local function var_brace_len(brace) - if var_brace_positions[cur_score_id] ~= nil then - if var_brace_positions[cur_score_id][brace] ~= nil then - local posend = var_brace_positions[cur_score_id][brace][2] - local posstart = var_brace_positions[cur_score_id][brace][1] - if posend > posstart then - tex.print(string.format('%dsp', posend - posstart)) - else - warn('Dynamically sized braces spanning multiple lines unsupported, using length 2mm.') - tex.print('2mm') - end - return - end +local function compute_saved_length(score_id, index, pos) + if new_saved_lengths[score_id] == nil then + new_saved_lengths[score_id] = {} end - tex.print('2mm') + new_saved_lengths[score_id][index] = pos.x2 - pos.x1 + info('computed length for %s, %d: %d', score_id, index, + new_saved_lengths[score_id][index]) end -local function save_pos(index, which) - tex.print(string.format([[\pdfsavepos\luatexlatelua{gregoriotex.late_save_pos('%s', %d, %d, \number\pdflastxpos, \number\pdflastypos)}]], cur_score_id, index, which)) +local function save_length(index, which) + if which == 1 then + prep_save_position(index, compute_saved_length) + end + save_position(index, which) end -local function late_save_pos(score_id, index, which, xpos, ypos) - if new_pos_saves[score_id] == nil then - new_pos_saves[score_id] = {} +local function compute_saved_newline_before_euouae(score_id, index, pos) + if new_saved_newline_before_euouae[score_id] == nil then + new_saved_newline_before_euouae[score_id] = {} end - if new_pos_saves[score_id][index] == nil then - new_pos_saves[score_id][index] = {} + new_saved_newline_before_euouae[score_id][index] = pos.y2 ~= pos.y1 + info('computed euouae for %s, %d: %s', score_id, index, + new_saved_newline_before_euouae[score_id][index]) +end + +local function save_euouae(index, which) + if which == 1 then + prep_save_position(index, compute_saved_newline_before_euouae) + end + tex.sprint(catcode_at_letter, [[\gre@savepos]]) + save_position(index, which) +end + +local function var_brace_len(brace) + if saved_lengths[cur_score_id] ~= nil then + local length = saved_lengths[cur_score_id][brace] + if saved_lengths[cur_score_id][brace] ~= nil then + if length > 0 then + tex.print(string.format('%dsp', length)) + return + else + warn('Dynamically sized signs spanning multiple lines unsupported, using length 2mm.') + end + end end - new_pos_saves[score_id][index][(2 * which) - 1] = xpos - new_pos_saves[score_id][index][2 * which] = ypos + tex.print('2mm') end -- this function is meant to be used from \ifcase; prints 0 for true and 1 for false local function is_ypos_different(index) - if pos_saves[cur_score_id] ~= nil then - local saved_pos = pos_saves[cur_score_id][index] - if saved_pos == nil or saved_pos[2] == saved_pos[4] then - tex.sprint([[\number1\relax ]]) - else + if saved_newline_before_euouae[cur_score_id] ~= nil then + local newline_before_euouae = + saved_newline_before_euouae[cur_score_id][index] + if newline_before_euouae then tex.sprint([[\number0\relax ]]) + return end - else - tex.sprint([[\number1\relax ]]) end + tex.sprint([[\number1\relax ]]) end local function width_to_bp(width, value_if_star) @@ -1031,8 +1162,7 @@ gregoriotex.font_size = font_size gregoriotex.direct_gabc = direct_gabc gregoriotex.adjust_line_height = adjust_line_height gregoriotex.var_brace_len = var_brace_len -gregoriotex.var_brace_note_pos = var_brace_note_pos -gregoriotex.late_brace_note_pos = late_brace_note_pos +gregoriotex.save_length = save_length gregoriotex.mark_translation = mark_translation gregoriotex.mark_abovelinestext = mark_abovelinestext gregoriotex.width_to_bp = width_to_bp @@ -1041,11 +1171,11 @@ gregoriotex.rotation = rotation gregoriotex.scale_space = scale_space gregoriotex.set_header_capture = set_header_capture gregoriotex.capture_header = capture_header -gregoriotex.save_pos = save_pos -gregoriotex.late_save_pos = late_save_pos gregoriotex.is_ypos_different = is_ypos_different +gregoriotex.save_euouae = save_euouae gregoriotex.mode_part = mode_part gregoriotex.set_debug_string = set_debug_string +gregoriotex.late_save_position = late_save_position dofile(kpse.find_file('gregoriotex-nabc.lua', 'lua')) dofile(kpse.find_file('gregoriotex-signs.lua', 'lua')) diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.tex index ca9bf25334e..73bb165e3ec 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.tex +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.tex @@ -21,7 +21,7 @@ % This file needs to be marked with the version number. For now I've done this with the following comment, but we should check to see if PlainTeX has something similar to the version declaration of LaTeX and use that if it does. -% [2016/03/10 v4.1.1 GregorioTeX system.]% PARSE_VERSION_DATE_LTX +% [2016/04/27 v4.2.0-beta1 GregorioTeX system.]% PARSE_VERSION_DATE_LTX \edef\greoldcatcode{\the\catcode`@} @@ -33,6 +33,7 @@ \input luaotfload.sty% \input graphicx.tex % for \resizebox \input xstring.sty% +\input color.sty% \def\gre@error#1{\begingroup% \def\MessageBreak{^^J}% @@ -60,72 +61,80 @@ \ifcsname gre@debug\endcsname% \else% - \def\gre@debug{}% + \def\gre@debug{}% \fi% \ifcsname f@size\endcsname% \else% - \def\f@size{\directlua{gregoriotex.font_size()}}% + \def\f@size{\directlua{gregoriotex.font_size()}}% \fi% \newif\ifgre@allowdeprecated% \gre@allowdeprecatedtrue% \long\def\gre@metapost#1{{% - \gre@localleftbox{}% - \gre@localrightbox{}% - \mplibcode - #1 - \endmplibcode% + \gre@localleftbox{}% + \gre@localrightbox{}% + \mplibcode + #1 + \endmplibcode% }}% %% This is \strip@pt from LaTeX \begingroup% - \catcode`P=12% - \catcode`T=12% - \lowercase{% - \def\x{\def\gre@rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}}% - \expandafter\endgroup\x% + \catcode`P=12% + \catcode`T=12% + \lowercase{% + \def\x{\def\gre@rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}}% + \expandafter\endgroup\x% \def\gre@strip@pt{\expandafter\gre@rem@pt\the}% \long\def\gre@iflatex#1{}% \input gregoriotex-main.tex + +%%%%%%%%% +%% Color definitions +%%%%%%%%% + +\definecolor{grebackgroundcolor}{RGB}{255,255,255}% +\definecolor{gregoriocolor}{RGB}{229,53,44}% + %%%%%%%%% %% PlainTeX specific definitions for fonts %%%%%%%%% \def\GreBold#1{% - {\bf #1}% - \relax % + {\bf #1}% + \relax % }% \def\GreItalic#1{% - {\it #1}% - %\relax + {\it #1}% + %\relax }% \def\GreSmallCaps#1{% - {\sc #1}% - \relax % + {\sc #1}% + \relax % }% \def\GreTypewriter#1{% - {\tt #1}% - \relax % + {\tt #1}% + \relax % }% -% Note since underlining and coloring don’t exist in PlainTeX, but we need the following commands to maintain compatibility with LaTeX. -\def\GreUnderline#1{% - \gre@warning{Underlining cannot be done in PlainTeX}% - {#1}% - \relax % +\def\GreColored#1{% + {% + \color{gregoriocolor}#1% + }% }% -\def\GreColored#1{% - \gre@warning{Text color cannot be changed in PlainTeX}% - {#1}% - \relax % +% Note since underlining don’t exist in PlainTeX, we need the following command to maintain compatibility with LaTeX, but all it does is raise a warning. +\def\GreUnderline#1{% + \gre@warning{Underlining cannot be done in PlainTeX}% + {#1}% + \relax % }% %%%%%%%%%%%%%%% @@ -135,26 +144,9 @@ % Colors don't work in PlainTeX, but we need these functions for interoperability with LaTeX. \def\gresetlinecolor#1{% - \gre@warning{Line color cannot be changed in PlainTeX}% - \relax% -} - - -\def\grecoloredlines#1#2#3{%OBSOLETE - \gre@obsolete{\protect\grecoloredlines}{\protect\gresetlinecolor}% -} - -\def\greredlines{%OBSOLETE - \gre@obsolete{\protect\greredlines}{\protect\gresetlinecolor{gregoriocolor}}% -} - -\let\redlines\greredlines%OBSOLETE - -\def\grenormallines{%OBSOLETE - \gre@obsolete{\protect\grenormallines}{\protect\gresetlinecolor{black}}% + \gre@changestyle{normalstafflines}{\color{#1}}[\relax]% } -\let\normallines\grenormallines%OBSOLETE %%%%%%%%%%%%%%%%%%%% %% Formatting environments @@ -164,130 +156,130 @@ \font\gre@font@initial=pncr at 40pt\relax% \def\gre@style@initial{% - \begingroup% - \gre@font@initial% - \relax % + \begingroup% + \gre@font@initial% + \relax % }% \def\endgre@style@initial{\endgroup}% \def\gre@style@biginitial{%%% DEPRECATED for removal in 5.0 - \begingroup%%% DEPRECATED for removal in 5.0 - \gre@font@biginitial%%% DEPRECATED for removal in 5.0 - \relax %%% DEPRECATED for removal in 5.0 + \begingroup%%% DEPRECATED for removal in 5.0 + \gre@font@biginitial%%% DEPRECATED for removal in 5.0 + \relax %%% DEPRECATED for removal in 5.0 }%%% DEPRECATED for removal in 5.0 \def\endgre@style@biginitial{\endgroup}%%% DEPRECATED for removal in 5.0 \def\gre@style@translation{% - \begingroup% - \it% + \begingroup% + \it% }% \def\endgre@style@translation{\endgroup}% \def\gre@style@abovelinestext{% - \begingroup% - \it% + \begingroup% + \it% }% \def\endgre@style@abovelinestext{\endgroup}% \def\gre@style@normalstafflines{% - \begingroup% - \relax% + \begingroup% + \relax% }% \def\endgre@style@normalstafflines{\endgroup}% \def\gre@style@additionalstafflines{% - \begingroup% - \gre@style@normalstafflines% + \begingroup% + \gre@style@normalstafflines% }% \def\endgre@style@additionalstafflines{% - \endgre@style@normalstafflines% - \endgroup% + \endgre@style@normalstafflines% + \endgroup% }% \def\gre@style@lowchoralsign{% - \begingroup% - \relax% + \begingroup% + \relax% }% \def\endgre@style@lowchoralsign{\endgroup}% \def\gre@style@highchoralsign{% - \begingroup% - \relax% + \begingroup% + \relax% }% \def\endgre@style@highchoralsign{\endgroup}% \def\gre@style@firstsyllableinitial{% - \begingroup% - \relax% + \begingroup% + \relax% }% \def\endgre@style@firstsyllableinitial{\endgroup}% \def\gre@style@firstsyllable{% - \begingroup% - \relax% + \begingroup% + \relax% }% \def\endgre@style@firstsyllable{\endgroup}% \def\gre@style@firstword{% - \begingroup% - \relax% + \begingroup% + \relax% }% \def\endgre@style@firstword{\endgroup}% \def\gre@style@modeline{% - \begingroup% - \bf% - \sc% - \relax% + \begingroup% + \bf% + \sc% + \relax% }% \def\endgre@style@modeline{\endgroup}% \def\gre@style@modemodifier{% - \begingroup% - \bf% - \it% - \relax% + \begingroup% + \bf% + \it% + \relax% }% \def\endgre@style@modemodifier{\endgroup}% \def\gre@style@modedifferentia{% - \begingroup% - \bf% - \relax% + \begingroup% + \bf% + \relax% }% \def\endgre@style@modedifferentia{\endgroup}% \def\gre@style@commentary{% - \begingroup% - \it% - % footnotesize is LaTeX, but nothing here since changing font size is so hard - \relax% + \begingroup% + \it% + % footnotesize is LaTeX, but nothing here since changing font size is so hard + \relax% }% \def\endgre@style@commentary{\endgroup}% \def\gre@style@elision{% - \begingroup% - \it% - % small is LaTeX, but nothing here since changing font size is so hard - \relax% + \begingroup% + \it% + % small is LaTeX, but nothing here since changing font size is so hard + \relax% }% \def\endgre@style@elision{\endgroup}% \def\gre@style@annotation{% - \begingroup% - \relax% + \begingroup% + \relax% }% \def\endgre@style@annotation{\endgroup}% \def\gre@style@nabc{% - \begingroup% - \relax% we do nothing since colors are not implemented in PlainTeX + \begingroup% + \color{gregoriocolor}% } \def\endgre@style@nabc{\endgroup}% \def\gre@changestyle#1#2[#3]{% - \gdef\csname gre@style@#1\endcsname{\begingroup#2}% - \gdef\csname endgre@style@#1\endcsname{#3\endgroup}% + \expandafter\gdef\csname gre@style@#1\endcsname{\begingroup#2}% + \expandafter\gdef\csname endgre@style@#1\endcsname{#3\endgroup}% }% \catcode`\@=\greoldcatcode diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gsp-default.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gsp-default.tex index 2c2af57a84a..0426e613ced 100644 --- a/Master/texmf-dist/tex/luatex/gregoriotex/gsp-default.tex +++ b/Master/texmf-dist/tex/luatex/gregoriotex/gsp-default.tex @@ -22,51 +22,50 @@ %% First, the penalties % penalty to force a break on a new line -\xdef\grenewlinepenalty{-10001}% +\grechangecount{newlinepenalty}{-10001}% % penalty to prevent a line break -\xdef\grenobreakpenalty{10001}% +\grechangecount{nobreakpenalty}{10001}% % penalty at the end of a syllable which is the end of a word -\xdef\greendofwordpenalty{-100}% +\grechangecount{endofwordpenalty}{-100}% % penalty at the end of a syllable which is not the end of a word -\xdef\greendofsyllablepenalty{-50}% +\grechangecount{endofsyllablepenalty}{-50}% % penalty at the end of a syllable which is just a bar, with something printed % under it -\xdef\greendafterbarpenalty{-200}% +\grechangecount{endafterbarpenalty}{-200}% % penalty right after a bar with nothing printed -\xdef\greendafterbaraltpenalty{-200}% +\grechangecount{endafterbaraltpenalty}{-200}% % penalty at the end of the score -\xdef\grefinalpenalty{0}% +\grechangecount{finalpenalty}{0}% % penalty at the end of a breakable neumatic element (typically at a space % between elements) -\xdef\greendofelementpenalty{-50}% +\grechangecount{endofelementpenalty}{-50}% % hyphenpenalty will be used in discretionaries, in Gregorio this is used for % a bar with clef change for example. It also set \exhyphenpenalty. It should -% be close to \greendafterbarpenalty -\xdef\grehyphenpenalty{-200}% +% be close to endafterbarpenalty +\grechangecount{hyphenpenalty}{-200}% % broken penalty is the vertical penalty inserted after a break on a clef change % I'm not sure it should be set, but it might be useful... -\xdef\grebrokenpenalty{0}% +\grechangecount{brokenpenalty}{0}% %% These macro enable the tuning of linepenalty, tolerance, pretolerance %% and emergencystretch -\def\grelooseness{-1}% -\def\gretolerance{9000}% +\grechangecount{looseness}{-1}% +\grechangecount{tolerance}{9000}% % Workaround for bug 842 (http://tracker.luatex.org/view.php?id=842) % see http://tug.org/pipermail/luatex/2013-July/004516.html % The idea is that we use discretionaries (explicit hyphens, though more than hyphens in our case) for clef changes, and we need to give them a special penalty, which is not taken into account if pretolerance is > -1 on LuaTeX < 0.80. For a more detailed explanation see http://tug.org/pipermail/luatex/2013-July/004516.html. \ifnum\the\luatexversion < 78\relax % - \global\def\grepretolerance{-1}% + \grechangecount{pretolerance}{-1}% \else % - \global\def\grepretolerance{\pretolerance}% + \grechangecount{pretolerance}{\the\pretolerance}% \fi % -\def\greemergencystretch{\emergencystretch}% +\grecreatedim{emergencystretch}{\the\emergencystretch}{scalable}% % By default, we don't care if a line of score is alone on the page, % if you think it is bad, you can modify the two following values. Assigning % 10000 to them will prevent all orphaned lines (this will certainly improve % some spacings a lot). -\def\grewidowpenalty{0}% -\def\greclubpenalty{0}% - +\grechangecount{widowpenalty}{0}% +\grechangecount{clubpenalty}{0}% %%%%%%%%%%%%%%%%%%% @@ -109,7 +108,7 @@ % space between elements which has the size of a note \grecreatedim{glyphspace}{0.21877 cm plus 0.01822 cm minus 0.01822 cm}{scalable}% % space before in-line custos -\grecreatedim{spacebeforeinlinecustos}{0 cm plus 0 cm minus 0 cm}{scalable}% +\grecreatedim{spacebeforeinlinecustos}{0.10938 cm plus 0.01822 cm minus 0.00911 cm}{scalable}% % space before end-of-line custos \grecreatedim{spacebeforeeolcustos}{0.3 cm plus 0 cm minus 0 cm}{scalable}% % space before punctum mora and augmentum duplex @@ -131,12 +130,11 @@ % stretching added in the case where the text of two syllables of the same word are % separated with an automatic hyphen \grecreatedim{intersyllablespacestretchhyphen}{0cm plus 0.05cm}{scalable}% -% minimal space between letters of different words. Makes sense to have -% the same plus and minus as interwordspacenotes. -\grecreatedim{interwordspacetext}{0.38 cm plus 0.15 cm minus 0.05 cm}{scalable}% +% minimal space between letters of different words. +\grecreatedim{interwordspacetext}{1ex plus 0.15cm minus 0.05cm}{fixed}% % Versions of interword spaces for euouae blocks \grecreatedim{interwordspacenotes@euouae}{0.19 cm plus 0.1 cm minus 0.05 cm}{scalable}% -\grecreatedim{interwordspacetext@euouae}{0.27 cm plus 0.1 cm minus 0.05 cm}{scalable}% +\grecreatedim{interwordspacetext@euouae}{0.8ex plus 01.cm minus 0.05cm}{fixed}% % versions of note spaces when the first note of the second syllable is an alteration % those are used in euouae blocks \grecreatedim{interwordspacenotes@alteration}{0.1 cm plus 0.07 cm minus 0.01 cm}{scalable}% @@ -152,6 +150,8 @@ % % space between two punctum inclinatum \grecreatedim{punctuminclinatumshift}{-0.03918 cm plus 0.0009 cm minus 0.0009 cm}{scalable}% +% space between two unison punctum inclinatum +\grecreatedim{punctuminclinatumunisonshift}{0.05286 cm plus 0.00728 cm minus 0.00455 cm}{scalable}% % space before puncta inclinata \grecreatedim{beforepunctainclinatashift}{0.05286 cm plus 0.00728 cm minus 0.00455 cm}{scalable}% % space between a punctum inclinatum and a punctum inclinatum deminutus @@ -223,14 +223,14 @@ % % minimal space between letters of different syllable texts for text around bars % (new bar spacing algorithm only) -\grecreatedim{interwordspacetext@bars}{0.15 cm}{scalable}% +\grecreatedim{interwordspacetext@bars}{0.7ex}{fixed}% % minimal space between letters of different syllable texts for text around bars, % euouae context -\grecreatedim{interwordspacetext@bars@euouae}{0.15 cm}{scalable}% -\grecreatedim{interwordspacetext@bars@notext}{0.4 cm}{scalable}% +\grecreatedim{interwordspacetext@bars@euouae}{0.7ex}{fixed}% +\grecreatedim{interwordspacetext@bars@notext}{1ex}{fixed}% % minimal space between letters of different syllable texts for text around bars, % euouae context -\grecreatedim{interwordspacetext@bars@notext@euouae}{0.3 cm}{scalable}% +\grecreatedim{interwordspacetext@bars@notext@euouae}{0.7ex}{fixed}% % rubber length that will be added around bars in new bar spacing algorithm \grecreatedim{bar@rubber}{0 cm plus 0.22787 cm minus 0.02 cm}{scalable}% % additional space that will appear around bars that are preceded by a custos and followed by a key. @@ -280,7 +280,7 @@ % space at the beginning of the lines if there is no clef \grecreatedim{noclefspace}{0.1 cm}{scalable}% % space around a clef change -\grecreatedim{clefchangespace}{0.01768 cm plus 0.00175 cm minus 0.01768 cm}{scalable}% +\grecreatedim{clefchangespace}{0.27345 cm plus 0.14584 cm minus 0.01367 cm}{scalable}% % When \gre@clivisalignment is 2, this distance is the maximum length of the consonants after vowels for which the clivis will be aligned on its center. \grecreatedim{clivisalignmentmin}{0.3 cm}{scalable}% |