summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregorio-vowels.dat2
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-chars.tex31
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-common.tex111
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex695
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.lua124
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.tex36
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.lua31
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.tex897
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex1014
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-syllable.tex513
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.lua4
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.tex22
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua938
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.tex79
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gsp-default.tex159
15 files changed, 3179 insertions, 1477 deletions
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregorio-vowels.dat b/Master/texmf-dist/tex/luatex/gregoriotex/gregorio-vowels.dat
index f4b82d91715..005e1b86a2c 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregorio-vowels.dat
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregorio-vowels.dat
@@ -1,5 +1,5 @@
# Vowel rule file for Gregorio
-# Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md)
+# Copyright (C) 2015-2017 The Gregorio Project (see CONTRIBUTORS.md)
#
# This file is part of Gregorio.
#
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-chars.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-chars.tex
index 1dd96ed6bff..35563162d76 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-chars.tex
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-chars.tex
@@ -1,6 +1,6 @@
%GregorioTeX file.
%
-% Copyright (C) 2007-2016 The Gregorio Project (see CONTRIBUTORS.md)
+% Copyright (C) 2007-2017 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
@@ -17,8 +17,7 @@
% You should have received a copy of the GNU General Public License
% 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.5}% GREGORIO_VERSION
+\gre@declarefileversion{gregoriotex-chars.tex}{5.0.1}% GREGORIO_VERSION
\def\gre@char@fuse@punctum@one{\GreFuseTwo{\GreCPLeadingPunctumOne}{\GreCPPunctum}}%
\def\gre@char@fuse@quilisma@one{\GreFuseTwo{\GreCPLeadingQuilismaOne}{\GreCPPunctum}}%
@@ -31,6 +30,7 @@
% horizontal episema
\newbox\gre@box@hep%
\def\gre@def@char@he#1#2{%
+ \gre@trace{gre@def@char@he{#1}{#2}}%
\expandafter\def\csname gre@char@he@#1\endcsname##1{%
\ifx##1f\csname GreCPHEpisema#2\endcsname%
\else%
@@ -42,8 +42,10 @@
}%
\fi%
}%
+ \gre@trace@end%
}%
\def\gre@def@char@he@porr#1#2{%
+ \gre@trace{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%
@@ -53,6 +55,7 @@
\or\csname GreCPHEpisema#2Five\endcsname%
\fi%
}%
+ \gre@trace@end%
}%
\gre@def@char@he{punctum}{Punctum}%
\gre@def@char@he{punctum@line@br}{PunctumLineBR}%
@@ -61,7 +64,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 +77,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}%
@@ -183,19 +186,3 @@
\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}}%
-}%
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-common.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-common.tex
new file mode 100644
index 00000000000..70760e53d88
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-common.tex
@@ -0,0 +1,111 @@
+%GregorioTeX common file (stuff needed by both gregoriotex and gregoriosyms)
+%
+% Copyright (C) 2007-2017 The Gregorio Project (see CONTRIBUTORS.md)
+%
+% This file is part of Gregorio.
+%
+% Gregorio is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Gregorio is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Gregorio. If not, see <http://www.gnu.org/licenses/>.
+
+\gre@declarefileversion{gregoriotex-commonx.tex}{5.0.1}% GREGORIO_VERSION
+
+
+%%%%%%%%%
+%% 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}%
+ }%
+ }%
+ }%
+}%
+
+\def\gre@fixdebug{%
+ {% we're starting a group in order to localize \exploregroups
+ \exploregroups%
+ \StrRemoveBraces{\gre@debug}[\gre@debug]%
+ \xdef\gre@debug{,\gre@debug,}%
+ }%
+}%
+
+\IfStrEq{\gre@debug}{}{% then
+}{% else
+ \typeout{GregorioTeX is in debug mode}%
+ \typeout{\gre@debug\space messages will be printed to the log.}%
+ \gre@fixdebug\relax %
+}%
+
+%%%%%%%%%%%%%
+% Macros to handle deprecation path.
+%%%%%%%%%%%%%
+
+% #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%
+}%
+
+\def\gre@obsolete#1#2{%
+ \gre@error{#1\space is obsolete.\MessageBreak Use #2\space instead}%
+ \relax%
+}%
+
+%%%%%%%%%%%%%
+% Internal function tracing
+%%%%%%%%%%%%%
+
+% Each function in the internal name space (\gre@...) should have an invocation of
+% \gre@trace as its first line with the argument being the name of the function (without
+% the backslash) and the list of arguments.
+% The last line of these functions should be \gre@trace@end.
+% Macros which merely store a value are not considered to be functions and thus not
+% included in the trace stack.
+% We also exempt the internal aliases for functions defined elsewhere.
+% The tracing messages are turned on via the debug interface, keyword: trace.
+
+\def\gre@trace@prefix{GreTrace: }
+\def\gre@trace#1{%
+ \IfSubStr{\gre@debug}{,trace,}%
+ {%print tracing messages and increase indent
+ \gre@typeout{\gre@trace@prefix \unexpanded{#1}}%
+ \edef\gre@trace@prefix{\gre@trace@prefix| }%
+ }{}%do nothing if not tracing
+}%
+\def\gre@trace@end{%
+ \IfSubStr{\gre@debug}{,trace,}%
+ {%dedent trace messages and mark end
+ \StrGobbleRight{\gre@trace@prefix}{2}[\gre@trace@prefix]%
+ \gre@typeout{\gre@trace@prefix -----}%
+ }{}%do nothing if not tracing
+}
+
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex
index bca81c6860e..a9e7492452c 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-main.tex
@@ -1,6 +1,6 @@
%GregorioTeX main file.
%
-% Copyright (C) 2007-2016 The Gregorio Project (see CONTRIBUTORS.md)
+% Copyright (C) 2007-2017 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
@@ -19,6 +19,10 @@
% this file contains definitions for lines, initial, fonts, etc.
+% The version of gregorio. All gregoriotex*.tex files must have the same.
+% All gtex files must also have the same version.
+\xdef\gre@gregoriotexversion{5.0.1}% GREGORIO_VERSION - VersionManager.py
+
\ifluatex%
\ifnum\luatexversion<76%
\gre@error{Error: this document must be compiled with LuaTeX (lualatex) 0.76 or later}%
@@ -27,54 +31,23 @@
\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}%
- }%
- }%
- }%
-}%
-\gre@debugmsg{general}{Loading gregoriotex-main.tex}%
+% first some macros to allow checks for version:
+% Tests that all gregoriotex files are of the same version.
+% #1 is the name of the file
+% #2 is the version
-% Macro to handle deprecated macros.
-% #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%
+\def\gre@declarefileversion#1#2{%
+ \IfStrEq*{#2}{\gre@gregoriotexversion}{}{%else
+ \gre@error{Version Inconsistency!\MessageBreak gregoriotex-main.tex is in version \number\gre@gregoriotexversion \space\space while #1 is in version \number#2}}%
}%
-\def\gre@obsolete#1#2{%
- \gre@error{#1\space is obsolete.\MessageBreak Use #2\space instead}%
- \relax%
-}%
+\input gregoriotex-common.tex
-\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.}}}%
+\def\gre@nothing{}%
%%%%%%%%%%%%%%%
%% Backwards Compatibility
@@ -136,34 +109,23 @@
\newluatexattribute\gre@attr@glyph@top %
\newluatexattribute\gre@attr@glyph@bottom %
+% attribute for syllable tracking
+\newluatexattribute\gre@attr@syllable@id %
+
\newluatexcatcodetable\gre@atletter %
\setluatexcatcodetable\gre@atletter{%
\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.5}% GREGORIO_VERSION - VersionManager.py
-
-% first some macros to allow checks for version:
-% Tests that all gregoriotex files are of the same version.
-% #1 is the name of the file
-% #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}}%
-}%
-
% Macro called by scores.
% Tests the major version of gregorio (X.0.0) against the score. Fails
% if the major version (X) does not match.
% #1 is the version of GregorioTeX the score is made for.
\def\GregorioTeXAPIVersion#1{%
- \StrBefore{\gre@gregorioversion}{.}[\gre@gregoriomajorversion]%
+ \StrBefore{\gre@gregoriotexversion}{.}[\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}}%
+ \gre@error{Version Inconsistency!\MessageBreak GregorioTeX is in version \gre@gregoriotexversion \space\space while a score you included requires version #1. Please recompile your scores}}%
}%
\RequireLuaModule{gregoriotex}%
@@ -172,12 +134,13 @@
\else %
\directlua{gregoriotex.init(arg, true)}%
\fi %
+\directlua{gregoriotex.set_debug_string([[\gre@debug]])}%
-\xdef\gre@gregoriotexluaversion{\directlua{tex.write(gregoriotex.get_gregorioversion())}}%
+\xdef\gre@gregoriotexluaversion{\directlua{tex.write(gregoriotex.get_gregoriotexluaversion())}}%
% 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}}%
+\IfStrEq*{\gre@gregoriotexluaversion}{\gre@gregoriotexversion}{}{%else
+ \gre@error{Version Inconsistency!\MessageBreak gregoriotex-main.tex is in version \number\gre@gregoriotexversion \space\space while gregoriotex.lua is in version \gre@gregoriotexluaversion}}%
%%%%%%%%%%%%%%%%%%%%%%%%
@@ -224,7 +187,7 @@
\def\gre@pitch@n{16}%
\def\gre@pitch@p{17}%
-\let\gre@pitch@adjust@bottom\gre@pitch@c %
+\def\gre@pitch@adjust@bottom{\the\numexpr(\gre@space@count@noteadditionalspacelinestextthreshold + \gre@pitch@a)\relax} %
\let\gre@pitch@belowstaff\gre@pitch@c %
\let\gre@pitch@ledger@below\gre@pitch@b %
\let\gre@pitch@barvepisema\gre@pitch@c %
@@ -232,6 +195,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)
@@ -262,10 +226,17 @@
\relax%
}%
+
+% Eliminates the error for big initials where the second new line is at the end of the score
+\def\GreFinalNewLine{%
+ \global\advance\gre@knownline by 1\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{%
+ \gre@trace{gre@newlinecommon{#1}{#2}}%
\ifgre@blockeolcustos\ifnum\gre@insidediscretionary=0\relax %
\gre@localrightbox{}%
\fi\fi %
@@ -304,11 +275,21 @@
\gre@penalty{-10001}%
\fi %
\gre@adjustlineifnecessary\relax %
- \gre@reseteolcustos\relax %
+ %%
+ \GreResetEolCustos\relax %
+ \gre@trace@end%
}%
-\def\gre@mark@translation{\directlua{gregoriotex.mark_translation()}}%
-\def\gre@mark@abovelinestext{\directlua{gregoriotex.mark_abovelinestext()}}%
+\def\gre@mark@translation{%
+ \gre@trace{gre@mark@translation}%
+ \directlua{gregoriotex.mark_translation()}%
+ \gre@trace@end%
+}%
+\def\gre@mark@abovelinestext{%
+ \gre@trace{gre@mark@abovelinestext}%
+ \directlua{gregoriotex.mark_abovelinestext()}%
+ \gre@trace@end%
+}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% macros for the typesetting of text
@@ -319,9 +300,11 @@
\newbox\gre@box@temp@width%
\def\gre@widthof#1{%
+ \gre@trace{gre@widthof{#1}}%
\setbox\gre@box@temp@width=\hbox{#1}%
\global\gre@dimen@temp@three=\wd\gre@box@temp@width%
\relax%
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -340,61 +323,75 @@
% macro to call before the call of \initial
\def\gre@setbiginitial{%
- \gre@debugmsg{general}{setting BIG initial}%
+ \gre@trace{gre@setbiginitial}%
\global\gre@biginitial=1\relax %
\relax %
+ \gre@trace@end%
}%
% macro to cancel before the call of \initial
\def\gre@normalinitial{%
- \gre@debugmsg{general}{setting normal initial}%
+ \gre@trace{gre@normalinitial}%
\global\gre@biginitial=0\relax %
\relax %
+ \gre@trace@end%
}%
% macro to call before the first syllable, but after setinitialclef
\def\gre@adjustsecondline{%
+ \gre@trace{gre@adjustsecondline}%
\gre@dimen@additionalleftspace=\gre@dimen@initialwidth\relax%
\gre@updateleftbox %
\relax %
+ \gre@trace@end%
}%
% macro to call during the second line
\def\gre@adjustthirdline{%
+ \gre@trace{gre@adjustthirdline}%
\gre@dimen@additionalleftspace= 0 pt\relax%
\gre@updateleftbox %
\relax %
+ \gre@trace@end%
}%
\newif\ifgre@thirdlineadjustmentnecessary %
\def\gre@adjustlineifnecessary{%
+ \gre@trace{gre@adjustlineifnecessary}%
\ifgre@thirdlineadjustmentnecessary %
\gre@adjustthirdline %
\gre@thirdlineadjustmentnecessaryfalse %
\fi %
+ \gre@trace@end%
}%
\def\gre@updateleftbox{%
+ \gre@trace{gre@updateleftbox}%
\gre@updatelinewidth %
\gre@updatelinesclef %
+ \gre@trace@end%
}%
\def\gre@updatelinewidth{%
+ \gre@trace{gre@updatelinewidth}%
\gre@debugmsg{ifdim}{ additionalleftspace = 0pt}%
\ifdim\gre@dimen@additionalleftspace=0pt\relax%
+ \gre@generatelines %
\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@trace@end%
}%
\def\greillumination#1{%
\setbox\gre@box@initial=\hbox{#1}%
}%
-\def\gre@setinitial#1{%
+\def\gre@printcommentary{%
+ \gre@trace{gre@printcommentary}%
% see comments on this function to see what it does
\gre@debugmsg{commentary}{Time to calculate the true raise.}%
\gre@calculate@commentarytrueraise%
@@ -405,6 +402,11 @@
\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}\hss}%
\fi%
+ \gre@trace@end%
+}
+
+\def\gre@setinitial#1{%
+ \gre@trace{gre@setinitial{#1}}%
\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
@@ -416,21 +418,18 @@
\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 %
+ \gre@style@initial%
+ \ifdim\gre@dimen@initialwidth<\gre@space@dimen@minimalinitialwidth\relax%
+ \global\gre@dimen@initialwidth=\gre@space@dimen@minimalinitialwidth\relax%
+ \fi%
+ \endgre@style@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%
@@ -442,14 +441,7 @@
\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 %
@@ -460,81 +452,48 @@
+ \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
+ \setbox\gre@box@initial=\hbox{\gre@style@initial\gre@fixedtextformat{#1}\endgre@style@initial}%
\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 %
+ \gre@style@initial%
+ \ifdim\gre@dimen@initialwidth<\gre@space@dimen@minimalinitialwidth\relax%
+ \global\gre@dimen@initialwidth=\gre@space@dimen@minimalinitialwidth\relax%
+ \fi%
+ \endgre@style@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
+ \gre@style@initial%
+ \global\gre@dimen@initialwidth=\gre@space@dimen@manualinitialwidth\relax%
+ \endgre@style@initial%
\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
+ \gre@style@initial%
+ \global\gre@dimen@temp@four = \gre@space@dimen@beforeinitialshift\relax%
+ \endgre@style@initial%
\fi %
- \hskip\gre@dimen@temp@four %
+ \gre@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%
+ \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%
- \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
+ \gre@style@initial%
+ \global\gre@dimen@temp@four = \gre@space@dimen@afterinitialshift\relax%
+ \endgre@style@initial%
\fi%
- \hskip\gre@dimen@temp@four %
+ \gre@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.}%
@@ -544,7 +503,7 @@
\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 %
+ \gre@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%
@@ -552,12 +511,15 @@
\kern\gre@dimen@temp@five %
\fi %
\relax %
+ \gre@trace@end%
}%
\def\gre@noinitial{%
+ \gre@trace{gre@noinitial}%
\setbox\gre@box@initial=\box\voidb@x%
\global\gre@dimen@initialwidth=0pt\relax%
\relax %
+ \gre@trace@end%
}%
@@ -601,6 +563,7 @@
}%
\def\gre@annotation[#1]#2{%
+ \gre@trace{gre@annotation[#1]{#2}}%
\ifx l#1\relax%
\let\gre@rightfill\hfil%
\let\gre@leftfill\relax%
@@ -622,7 +585,7 @@
\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.}%
+ \gre@debugmsg{annotation}{Initial set point.}%
\ifcase\gre@count@annotationvalign\relax%
%case 0 = top of first line
\global\gre@dimen@annotationtrueraise=-\ht\gre@box@annotation\relax%
@@ -660,53 +623,26 @@
\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%
+ \gre@trace@end%
}%
-\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
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 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%
+\def\grescorereference#1{% OBSOLETE
+ \gre@error{\protect\grescorereference\space is obsolete.\MessageBreak It does nothing; stop using it.}%
\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.}%
-}%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% macros for the typesetting the things above the initial
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\gre@writemode#1#2#3{%
+ \gre@trace{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 %
@@ -714,6 +650,7 @@
\relax %
}%
\relax %
+ \gre@trace@end%
}%
\def\GreMode#1#2#3{%
@@ -737,7 +674,7 @@
\gre@error{Unrecognized option "#1" in \protect\gresetmodenumbersystem\MessageBreak Possible options are: 'roman-majuscule', 'roman-minuscule', and 'arabic'}%
]%
}%
-\gresetmodenumbersystem{roman-minuscule}%
+% defaults set differently for LaTeX and PlainTeX, so see gregoriotex.sty and gregoriotex.tex
\def\GreAnnotationLines#1#2{%
\ifvoid\gre@box@annotation%
@@ -750,12 +687,14 @@
%% 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@trace{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@trace@end%
}%
\newbox\gre@box@commentary
@@ -763,6 +702,7 @@
\def\grecommentary{\@ifnextchar[{\gre@commentary}{\gre@commentary[0pt]}}%
\def\gre@commentary[#1]#2{%
+ \gre@trace{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%
@@ -778,40 +718,29 @@
\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%
+ \gre@trace@end%
}
-\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@trace{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@trace@end%
}%
% we don't need space above any more
\def\gre@removespaceabove{%
+ \gre@trace{gre@removespaceabove}%
\global\gre@dimen@currentabovelinestextheight=0 sp%
- \gre@generatelines %
\relax %
+ \gre@trace@end%
}%
% the code is a bit strange here: we always execute \gre@space@skip@spaceabovelines at the beginning of a glyph. This will:
@@ -822,37 +751,46 @@
\def\GreSetTextAboveLines#1{%
\gdef\gre@currenttextabovelines{%
- \gre@typesettextabovelines{#1}%
+ \gre@typesettextabovelines{#1}{0}%
\gdef\gre@currenttextabovelines{}%
\relax %
}%
}%
-% typesets the text above the line
-\def\gre@typesettextabovelines#1{%
+% typesets the text or nabc neumes above the line
+\def\gre@typesettextabovelines#1#2{%
+ \gre@trace{gre@typesettextabovelines{#1}{#2}}%
\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
+ \ifnum#2=0\relax%
+ \gre@dimen@temp@five=\gre@dimen@additionaltopspacealt\relax%
+ \else%
+ \gre@dimen@temp@five=\gre@dimen@additionaltopspacenabc\relax%
+ \fi%
\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@dimen@temp@five %
+ \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@trace@end%
+}%
+
+% similarly, but for typesetting Nabc neumes above lines
+
+\def\GreSetNabcAboveLines#1{%
+ \gdef\gre@currenttextabovelines{%
+ \gre@typesettextabovelines{#1}{1}%
+ \gdef\gre@currenttextabovelines{}%
+ \relax %
+ }%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -874,26 +812,15 @@
]%
}
-\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{%
+ \gre@trace{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 %
@@ -945,6 +872,7 @@
}%
\gre@dimen@stafflinewidth=\gre@dimen@linewidth\relax%
\relax%
+ \gre@trace@end%
}%
%% box containing the stafflines for other lines than the first
@@ -952,13 +880,10 @@
% macro that must be called at each change of linewidth and gre@factor
\def\gre@generatelines{%
+ \gre@trace{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%
@@ -1005,6 +930,7 @@
\hss%
}%
\relax %
+ \gre@trace@end%
}%
% Macro for fusion of larger neumes
@@ -1025,15 +951,48 @@
\directlua{gregoriotex.change_score_glyph([[#1]],[[#2]],[[#3]])}%
}%
+% Changes a gregorio cavum code point to a variant glyph
+% #1 = the name of the gregorio code point
+% #2 = font name for the hollow shape
+% #3 = glyph name, glyph variant name (preceded by .), or code point for the hollow shape
+% optional #4 = font name for the hollow shape
+% optional #5 = glyph name, glyph variant name (preceded by .), or code point for the hollow shape
+\def\grechangecavumglyph#1#2#3{%
+ \directlua{gregoriotex.init_variant_font([[#2]], true, [[\the\gre@factor]])}%
+ \directlua{gregoriotex.change_score_glyph([[#1]],[[#2]],[[#3]], [[Hollow]])}%
+ \@ifnextchar[{\gre@changecavumhole{#1}}{}%
+}%
+\def\gre@changecavumhole#1[#2][#3]{%
+ \gre@trace{gre@changecavumhole{#1}[#2][#3]}%
+ \directlua{gregoriotex.init_variant_font([[#2]], true, [[\the\gre@factor]])}%
+ \directlua{gregoriotex.change_score_glyph([[#1]],[[#2]],[[#3]], [[Hole]])}%
+ \gre@trace@end%
+}%
+
% 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]])}%
}%
+\def\greresetcavumglyph#1{%
+ \directlua{
+ gregoriotex.reset_score_glyph([[#1]], [[Hollow]])
+ gregoriotex.reset_score_glyph([[#1]], [[Hole]])
+ }%
+}%
+
{%
- \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]])
+ gregoriotex.init_variant_font('greciliae-hollow', true, [[\the\gre@factor]])
+ gregoriotex.init_variant_font('greciliae-hole', true, [[\the\gre@factor]])
+ }%
+ \directlua{
+ gregoriotex.map_font('greciliae', 'CP')
+ gregoriotex.map_font('greciliae-hollow', 'HollowCP')
+ gregoriotex.map_font('greciliae-hole', 'HoleCP')
+ }%
}%
\input gregoriotex-chars.tex%
@@ -1060,10 +1019,6 @@
]%
}%
-\def\setgretranslationcenteringscheme#1{%OBSOLETE
- \gre@obsolete{\protect\setgretranslationcenteringscheme}{\protect\gresettranslationcentering}%
-}%
-
\newif\ifgre@breakintranslation%
\gre@breakintranslationfalse%
@@ -1079,10 +1034,6 @@
]%
}%
-\def\gresetnlbintranslation#1{%OBSOLETE
- \gre@obsolete{\protect\gresetnlbintranslation}{\protect\gresetbreakintranslation}%
-}%
-
\def\GreWriteTranslation#1{%
\ifgre@translationcentering %
\setbox\gre@box@temp@width=\hbox{#1}%
@@ -1090,18 +1041,10 @@
\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 %
}%
@@ -1112,10 +1055,6 @@
\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 %
}%
@@ -1129,6 +1068,7 @@
}%
\def\gre@dotranslationcenterend{%
+ \gre@trace{gre@dotranslationcenterend}%
\ifgre@breakintranslation\else%
\GreEndNLBArea{0}{1}%
\fi %
@@ -1136,6 +1076,7 @@
\raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{}%
\unsetluatexattribute{\gre@attr@center}%
\relax %
+ \gre@trace@end%
}%
@@ -1178,6 +1119,7 @@
\newif\ifgre@haslinefive%
\def\gre@setstafflines#1{%
+ \gre@trace{gre@setstafflines{#1}}%
\def\gre@stafflines{#1}%
\ifcase#1% 0
\gre@error{Invalid number of staff lines}%
@@ -1230,6 +1172,7 @@
\else %
\gre@error{Invalid number of staff lines}%
\fi %
+ \gre@trace@end%
}%
%macro called at the beginning of a score
@@ -1240,20 +1183,22 @@
% #5 is if 1 if we have space above the staff
% #6 is the point-and-click filename
% #7 is the number of staff lines
-\def\GreBeginScore#1#2#3#4#5#6#7{%
+% #8 is to set the initial clef position
+\def\GreBeginScore#1#2#3#4#5#6#7#8{%
% scores must be new paragraphs!
\ifhmode\par\fi %
\gre@beginningofscoretrue%
\global\gre@dimen@morawidth=0pt\relax %
- \gre@reseteolcustos%
+ \GreResetEolCustos%
\gre@resetledgerlineheuristics%
\global\setluatexattribute\gre@attr@glyph@id{0}%
+ \global\setluatexattribute\gre@attr@syllable@id{0}%
+ \let\gre@pitch@cleftop\gre@pitch@dummy %
+ \let\gre@pitch@clefbottom\gre@pitch@dummy %
\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}%
+ \xdef\gre@saved@parfillskip{\the\parfillskip}%
\parfillskip=0pt plus 0pt minus 0pt\relax%
\fi %
\ifgre@usestylefont%
@@ -1267,9 +1212,11 @@
\gre@generatelines %
\noindent%
\gre@calculate@additionalspaces{#2}{#3}{#4}{#5}%
+ #8%
\directlua{
- gregoriotex.atScoreBeginning([[#1]], #2, #3, #4, #5,
- \gre@pitch@adjust@top, \gre@pitch@adjust@bottom)
+ gregoriotex.at_score_beginning([[#1]], #2, #3, #4, #5,
+ \gre@pitch@adjust@top, \gre@pitch@adjust@bottom,
+ "\luatexluaescapestring{\gre@gregoriofontname}")
gregoriotex.adjust_line_height(1)
}%
%TODO do something like LaTeX's AtBeginDocument
@@ -1324,22 +1271,23 @@
\gre@skip@temp@four=0pt\relax%
\setbox\gre@box@annotation=\box\voidb@x%
\setbox\gre@box@commentary=\box\voidb@x%
- \directlua{gregoriotex.atScoreEnd()}%
+ \directlua{gregoriotex.at_score_end()}%
\unsetluatexattribute{\gre@attr@glyph@id}%
\unsetluatexattribute{\gre@attr@glyph@top}%
\unsetluatexattribute{\gre@attr@glyph@bottom}%
\unsetluatexattribute{\gre@attr@dash}%
+ \xdef\gre@bolshiftcleftypelocal{\gre@bolshiftcleftypeglobal}%
\ifgre@justifylastline%
- \parfillskip=\gre@save@parfillskip\relax%
+ \parfillskip=\gre@saved@parfillskip\relax%
\fi %
- \global\let\gre@lyriccentering\gre@save@englishcentering\relax % OBSOLETE
\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 %
+ \gre@trace{gre@endafterbar{#1}}%
+ \gre@penalty{\the\gre@space@count@endafterbarpenalty }\relax %
\ifnum#1=1\relax %
\gre@debugmsg{ifdim}{ enddifference > 0pt}%
\ifdim\gre@dimen@enddifference > 0 pt\relax%
@@ -1362,9 +1310,10 @@
\fi %
\fi %
\fi %
- %\gre@penalty{\greendafterbarpenalty }\relax
+ %\gre@penalty{\the\gre@space@count@endafterbarpenalty }\relax
%\global\gre@dimen@enddifference=0pt
\relax %
+ \gre@trace@end%
}%
\newcount\gre@lastoflinecount%
@@ -1389,7 +1338,7 @@
%blank line removing algorithm (in lua) will let some blank space after the
%last line... (see bug #20953)
\global\gre@endofscoretrue %
- \gre@usemanualeolcustos%
+ \GreSuppressEolCustos%
\gre@debugmsg{eolshift}{set lastoflinecount to 1}%
\relax%
}%
@@ -1423,33 +1372,28 @@
{disable}%
{\gre@eolshiftsenabledfalse}%
}[% all other cases
- \gre@error{Unrecognized option "#1" in \protect\greseteolshifts\MessageBreak Possible options are: 'enable' and 'diable'}%
+ \gre@error{Unrecognized option "#1" in \protect\greseteolshifts\MessageBreak Possible options are: 'enable' and 'disable'}%
]%
}%
-\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{%
+\def\GreSuppressEolCustos{%
\gre@blockeolcustostrue%
\gre@localrightbox{}%
}%
\def\gre@useautoeolcustos{%
+ \gre@trace{gre@useautoeolcustos}%
\gre@blockeolcustosfalse%
+ \gre@trace@end%
}%
\def\greseteolcustos#1{%
\IfStrEqCase{#1}{%
{manual}%
- {\global\let\gre@reseteolcustos\gre@usemanualeolcustos\relax}%
+ {\global\let\GreResetEolCustos\GreSuppressEolCustos\relax}%
{auto}%
- {\global\let\gre@reseteolcustos\gre@useautoeolcustos\relax}%
+ {\global\let\GreResetEolCustos\gre@useautoeolcustos\relax}%
}[% all other cases
\gre@error{Unrecognized option "#1" for \protect\greseteolcustos\MessageBreak Possible options are: 'manual' and 'auto'}%
]%
@@ -1482,17 +1426,13 @@
}%
\gresetbreakbeforeeuouae{justified}%
-% macro to suppress the custos
-\def\greblockcustos{%OBSOLETE
- \gre@obsolete{\protect\greblockcustos}{\protect\greseteolcustos{manual}}%
-}%
-
-\def\GreAdHocSpaceEndOfElement#1#2{%
+\def\GreAdHocSpaceEndOfElement#1#2#3{%
\gre@skip@temp@four = \gre@space@skip@interelementspace\relax %
\directlua{gregoriotex.scale_space(#1)}%
- \GreEndOfElement{4}{#2}%
+ \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
@@ -1500,11 +1440,30 @@
%% 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}%
+% #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%
@@ -1521,7 +1480,7 @@
\or% case 4
\gre@hskip\gre@skip@temp@four %
\fi%
- \ifnum #2=1\relax %
+ \ifgre@unbreakableendofelement %
\GreNoBreak %
\fi %
\relax%
@@ -1554,6 +1513,7 @@
%% 21: space between a punctum inclinatum and a "no-bar" glyph three or four pitches above
%% 22: half-space
\def\gre@get@spaceskip#1{%
+ \gre@trace{gre@get@spaceskip{#1}}%
\ifcase#1%
\gre@skip@temp@four = \gre@space@skip@interglyphspace\relax%
\or% case 1
@@ -1600,7 +1560,16 @@
\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%
+ \or% case 24
+ \gre@skip@temp@four = \gre@space@skip@descendingpunctuminclinatumascendingshift\relax%
+ \or% case 25
+ \gre@skip@temp@four = \gre@space@skip@ascendingpunctuminclinatumdescendingshift\relax%
+ \else%
+ \gre@error{Unrecognized spaceskip #1}%
\fi%
+ \gre@trace@end%
}%
% macro to end a glyph without ending the element
@@ -1619,6 +1588,13 @@
% 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{%
@@ -1635,20 +1611,21 @@
\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}%
+ \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 %
}%
@@ -1668,17 +1645,17 @@
% 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}%
+ \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{\greendofelementpenalty}%
+ \gre@penalty{\the\gre@space@count@endofelementpenalty}%
\or % 1
- \gre@penalty{\greendofsyllablepenalty}%
+ \gre@penalty{\the\gre@space@count@endofsyllablepenalty}%
\or % 2
% end of score, no penalty needs to be added
\or % 3
@@ -1722,7 +1699,7 @@
\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 %
+ \GreResetEolCustos %
}
\def\GreEndEUOUAE#1{%
@@ -1749,15 +1726,18 @@
\def\gresetgregoriofontscaled{\@ifnextchar[{\gre@setgregoriofontscaled}{\gre@setgregoriofontscaled[]}}%
\def\gre@setgregoriofont[#1]#2{%
+ \gre@trace{gre@setgregoriofont[#1]{#2}}%
\gre@setgregoriofontscaled[#1]{#2}{100000}%
\relax %
+ \gre@trace@end%
}%
\def\gre@setgregoriofontscaled[#1]#2#3{%
- \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
+ \gre@trace{gre@setgregoriofontscaled[#1]{#2}{#3}}%
+ \IfStrEq{#2}{parmesan}{%%% OBSOLETE
+ \gre@obsolete{'parmesan' font}{'granapadano' font}%%% OBSOLETE
+ }{%%% OBSOLETE
+ % keep this section
\if\relax\detokenize{#1}\relax %
\xdef\gre@gregoriofontname{#2}%
\expandafter\xdef\csname gre@fontfactor@#2\endcsname{#3}%
@@ -1769,18 +1749,36 @@
\gre@loadgregoriofont%
\gdef\GreCPVirgaReversaAscendensOnDLine##1{\GreCPVirgaReversaLongqueueAscendens}%
\fi %
- }%%% DEPRECATED for removal in 5.0
+ }%%% OBSOLETE
\relax %
+ \gre@trace@end%
}%
+\newif\ifgre@loadholehollowfonts%
+\gre@loadholehollowfontstrue%
+
+\def\greloadholehollowfonts#1{%
+ \IfStrEq{#1}{true}{%
+ \gre@loadholehollowfontstrue %
+ }{%
+ \gre@loadholehollowfontsfalse %
+ }%
+}
+
\def\gre@loadgregoriofont{%
+ \gre@trace{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]])}}%
+ \ifgre@loadholehollowfonts %
+ \global\font\gre@font@music@hollow={name:\gre@gregoriofontname-hollow} at \the\gre@count@temp@three sp\relax %
+ \global\font\gre@font@music@hole={name:\gre@gregoriofontname-hole} at \the\gre@count@temp@three sp\relax %
+ \fi %
+ \directlua{gregoriotex.check_font_version() gregoriotex.scale_score_fonts([[\the\gre@factor]])}%
\relax%
+ \gre@trace@end%
}%
% the default gregorio font
@@ -1791,51 +1789,21 @@
% gregoriostylefont is the font used for additional glyphs
\def\gre@setstylefont{%
+ \gre@trace{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]])}}%
+ {\gre@font@music\directlua{gregoriotex.check_font_version() gregoriotex.scale_score_fonts([[\the\gre@factor]])}}%
\relax%
+ \gre@trace@end%
}%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% 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 %
-}%
-\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
+ \IfStrEq{#1}{biginitial}{\gre@obsolete{biginitial style}{initial style}}{}%%% OBSOLETE
\@ifnextchar[{\gre@changestyle{#1}{#2}}{\gre@changestyle{#1}{#2}[\relax]}%
}%
@@ -1857,10 +1825,6 @@
\relax %
}%
-\def\setgrefactor#1{%OBSOLETE
- \gre@obsolete{\protect\setgrefactor}{\protect\grechangestaffsize}%
-}%
-
%%%%%%%%%%%%%%%%%%%
%% headers
%%%%%%%%%%%%%%%%%%%
@@ -1893,24 +1857,7 @@
]%
}%
-
-% 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.
%
@@ -1931,10 +1878,10 @@
\input #1%
\or% case 1, auto compile
\gre@debugmsg{compile}{Auto compile #1}%
- \directlua{gregoriotex.include_score([[#1]], nil)}%
+ \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)}%
+ \directlua{gregoriotex.include_score([[#1]], true, \gre@allowdeprecated@asboolean)}%
\fi%
\relax%
}%
@@ -1950,11 +1897,11 @@
\else%
\ifx #1f\relax%
\gre@debugmsg{compile}{Override force compiling #2}%
- \directlua{gregoriotex.include_score([[#2]], true)}%
+ \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)}%
+ \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%
@@ -1965,10 +1912,6 @@
% 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}%
}%
@@ -1990,18 +1933,10 @@
% 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#1{%
- \directlua{gregoriotex.direct_gabc("\luatexluaescapestring{\unexpanded\expandafter{#1}}")}%
+\long\def\gabcsnippet#1{%
+ \directlua{gregoriotex.direct_gabc("\luatexluaescapestring{\unexpanded\expandafter{#1}}", nil, \gre@allowdeprecated@asboolean)}%
}%
-%%% \gre@gabcsnipper@option is DEPRECATED by 4.1
-\def\gabcsnippet{\@ifnextchar[{\gre@gabcsnippet@option}{\gre@gabcsnippet}}%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% some hyphen definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -2035,14 +1970,6 @@
]%
}%
-\def\GreUseNormalHyphen{%OBSOLETE
- \gre@obsolete{\protect\GreUseNormalHyphen}{\protect\greseteolhyphen{normal}}%
-}%
-
-\def\GreUseZeroHyphen{%OBSOLETE
- \gre@obsolete{\protect\GreUseZeroHyphen}{\protect\greseteolhyphen{zero}}%
-}%
-
% macro to force hyphenation of all syllables.
\newif\ifgre@forcehyphen\gre@forcehyphenfalse%
\def\gresethyphen#1{%
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.lua b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.lua
index 14abe5637e4..108bdc6f185 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.lua
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.lua
@@ -1,6 +1,6 @@
--GregorioTeX Nabc Lua file.
--
---Copyright (C) 2014-2016 The Gregorio Project (see CONTRIBUTORS.md)
+--Copyright (C) 2014-2017 The Gregorio Project (see CONTRIBUTORS.md)
--
--This file is part of Gregorio.
--
@@ -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.5
+-- GREGORIO_VERSION 5.0.1
local catcode_at_letter = luatexbase.catcodetables['gre@atletter']
@@ -71,7 +71,7 @@ local gregallaliases = {
["pf!cl~ppt1"] = "cl!po>ppt1"
}
-local function gregallreadfont(font_id)
+local function gregallreadfont(fontname, font_id)
local tab = {}
local metrics = {}
local fontdata = font.getfont(font_id)
@@ -92,10 +92,12 @@ local function gregallreadfont(font_id)
metrics[name] = { width = g.width, height = g.height, depth = (g.depth and g.depth or 0) }
end
end
- for key, value in pairs(gregallaliases) do
- if tab[value] and not tab[key] then
- tab[key] = tab[value]
- metrics[key] = metrics[value]
+ if fontname ~= "grelaon" then
+ for key, value in pairs(gregallaliases) do
+ if tab[value] and not tab[key] then
+ tab[key] = tab[value]
+ metrics[key] = metrics[value]
+ end
end
end
return tab, metrics
@@ -105,12 +107,15 @@ local gregalltab = {}
local gregallmetrics = {}
local gregallneumekinds = { vi = 1, pu = 1, ta = 1, gr = 1, cl = 1, un = 1, pv = 1, pe = 1, po = 1, to = 1, ci = 1, sc = 1, pf = 1, sf = 1, tr = 1,
- st = 1, ds = 1, ts = 1, tg = 1, bv = 1, tv = 1, pr = 1, pi = 1, vs = 1, ["or"] = 1, sa = 1, pq = 1, qi = 1, ql = 1, pt = 1 }
+ st = 1, ds = 1, ts = 1, tg = 1, bv = 1, tv = 1, pr = 1, pi = 1, vs = 1, ["or"] = 1, sa = 1, pq = 1, qi = 1, ql = 1, pt = 1,
+ un = 1, oc = 1 }
local gregalllskinds = { c = 1, t = 1, s = 1, l = 1, x = 1, ["+"] = 1, a = 1, al = 1, am = 1, b = 1, cm = 1, co = 1, cw = 1, d = 1, e = 1, eq = 1,
ew = 1, f = 1, fid = 1, fr = 1, g = 1, h = 1, hp = 1, hn = 1, i = 1, im = 1, iv = 1, k = 1, lb = 1, lc = 1, len = 1,
lm = 1, lp = 1, lt = 1, m = 1, md = 1, moll = 1, n = 1, nl = 1, nt = 1, p = 1, par = 1, pfec = 1, pm = 1, q = 1,
sb = 1, sc = 1, sc = 1, simil = 1, simul = 1, sj = 1, sjc = 1, sjcm = 1, sm = 1, st = 1, sta = 1, su = 1, tb = 1,
- th = 1, tm = 1, tw = 1, v = 1, ve = 1, vol = 1 }
+ th = 1, tm = 1, tw = 1, v = 1, ve = 1, vol = 1,
+ ["eq-"] = 1, equ = 1, simp = 1, simpl = 1, sp = 1 }
+local grelaonltkinds = { i = 1, ["do"] = 1, dr = 1, dx = 1, ps = 1, qm = 1, sb = 1, se = 1, sj = 1, sl = 1, sn = 1, sp = 1, sr = 1, st = 1, us = 1 }
-- Parse a single base neume
local gregallparse_base = function (str, idx, len)
@@ -137,9 +142,9 @@ local gregallparse_base = function (str, idx, len)
end
-- Ambitus not handled yet, neither during parsing, nor when
-- typesetting.
- -- Optional height, h[a-m].
+ -- Optional height, h[a-np].
if idx < len and str:sub(idx, idx) == "h" then
- local p = string.find("abcdefghijklm", str:sub(idx + 1, idx + 1))
+ local p = string.find("abcdefghijklmnp", str:sub(idx + 1, idx + 1))
if not p then return 1 end
height = p - 1
idx = idx + 2
@@ -170,18 +175,27 @@ local gregallparse_neume = function (str, idx, len)
local v = str:sub(idx, idx + 1)
if v == "ls" then
local idx2 = idx + 2
- while idx2 <= len and not string.find("12346789", str:sub(idx2, idx2)) do
+ while idx2 <= len and not string.find("123456789", str:sub(idx2, idx2)) do
idx2 = idx2 + 1
end
if idx2 > len or not gregalllskinds[str:sub(idx + 2, idx2 - 1)] then return 1 end
ls[lsidx] = str:sub(idx, idx2)
lsidx = lsidx + 1
idx = idx2 + 1
+ elseif v == "lt" then
+ local idx2 = idx + 2
+ while idx2 <= len and not string.find("123456789", str:sub(idx2, idx2)) do
+ idx2 = idx2 + 1
+ end
+ if idx2 > len or not grelaonltkinds[str:sub(idx + 2, idx2 - 1)] then return 1 end
+ ls[lsidx] = str:sub(idx, idx2)
+ lsidx = lsidx + 1
+ idx = idx2 + 1
elseif v == "su" or v == "pp" then
local mod = ''
idx = idx + 2
local c = str:sub(idx, idx)
- if idx <= len and string.find("tuvwxy", c) then
+ if idx <= len and string.find("tuvwxyqnz", c) then
mod = mod .. c
idx = idx + 1
c = str:sub(idx, idx)
@@ -197,7 +211,7 @@ local gregallparse_neume = function (str, idx, len)
return 0, idx, bases, heights, ls, pp, su
end
-local add_ls = function(base, pre, ls, position, glyphbox, lsbox, baseraise, lwidths, curlwidths, scale)
+local add_ls = function(base, pre, post, ls, position, glyphbox, lsbox, baseraise, lwidths, curlwidths, scale)
local raise = 0
if position == 3 or position == 6 or position == 9 then
if position == 3 then
@@ -217,7 +231,7 @@ local add_ls = function(base, pre, ls, position, glyphbox, lsbox, baseraise, lwi
kern1 = kern1 * scale
kern2 = kern2 * scale
raise = raise * scale
- return base..'\\kern '..string.format("%.3f",kern1)..'sp\\raise '..string.format("%.3f",raise)..'sp\\hbox{'..ls..'}\\kern '..string.format("%.3f",kern2)..'sp', pre
+ return base, pre, post..'\\kern '..string.format("%.3f",kern1)..'sp\\raise '..string.format("%.3f",raise)..'sp\\hbox{'..ls..'}\\kern '..string.format("%.3f",kern2)..'sp'
elseif position == 2 or position == 8 then
if position == 2 then
raise = glyphbox.height + lsbox.depth + baseraise
@@ -235,7 +249,7 @@ local add_ls = function(base, pre, ls, position, glyphbox, lsbox, baseraise, lwi
kern1 = kern1 * scale
kern2 = kern2 * scale
raise = raise * scale
- return base..'\\kern '..string.format("%.3f",kern1)..'sp\\raise '..string.format("%.3f",raise)..'sp\\hbox{'..ls..'}\\kern '..string.format("%.3f",kern2)..'sp', pre
+ return base..'\\kern '..string.format("%.3f",kern1)..'sp\\raise '..string.format("%.3f",raise)..'sp\\hbox{'..ls..'}\\kern '..string.format("%.3f",kern2)..'sp', pre, post
else
if position == 1 then
raise = glyphbox.height - (lsbox.height-lsbox.depth)/2 + baseraise
@@ -254,23 +268,23 @@ local add_ls = function(base, pre, ls, position, glyphbox, lsbox, baseraise, lwi
kern1 = kern1 * scale
kern2 = kern2 * scale
raise = raise * scale
- return base, pre..'\\kern '..string.format("%.3f",kern1)..'sp\\raise '..string.format("%.3f",raise)..'sp\\hbox{'..ls..'}\\kern '..string.format("%.3f",kern2)..'sp'
+ return base, pre..'\\kern '..string.format("%.3f",kern1)..'sp\\raise '..string.format("%.3f",raise)..'sp\\hbox{'..ls..'}\\kern '..string.format("%.3f",kern2)..'sp', post
end
end
local add_spacing = function(str, len, idx, ret)
while idx <= len and (str:sub(idx, idx) == "/" or str:sub(idx, idx) == "`") do
if idx < len and str:sub(idx, idx + 1) == "//" then
- ret = ret .. "\\hskip \\gre@space@skip@nabclargerspace"
+ ret = ret .. "\\gre@hskip \\gre@space@skip@nabclargerspace"
idx = idx + 2
elseif idx < len and str:sub(idx, idx + 1) == "``" then
- ret = ret .. "\\hskip -\\gre@space@skip@nabclargerspace"
+ ret = ret .. "\\gre@hskip -\\gre@space@skip@nabclargerspace"
idx = idx + 2
elseif str:sub(idx, idx) == "/" then
- ret = ret .. "\\hskip \\gre@space@skip@nabcinterelementspace"
+ ret = ret .. "\\gre@hskip \\gre@space@skip@nabcinterelementspace"
idx = idx + 1
else
- ret = ret .. "\\hskip -\\gre@space@skip@nabcinterelementspace"
+ ret = ret .. "\\gre@hskip -\\gre@space@skip@nabcinterelementspace"
idx = idx + 1
end
end
@@ -293,46 +307,75 @@ local gregallparse_neumes = function(str, kind, scale)
local h = heights[i] - heights[0]
if h ~= 0 then
h = h + 5
- if h < 0 or h > 12 then
+ if h < 0 or h > 14 then
base = "ERR"
break
end
- base = base .. string.sub("abcdefghijklm", h + 1, h + 1)
+ base = base .. string.sub("abcdefghijklmnp", h + 1, h + 1)
end
i = i + 1
end
+ local ls5 = ''
lscount = 0
while ls[lscount] do
if not gregalltab[kind][ls[lscount]:sub(1, -2)] then base = "ERR" end
+ if tonumber(ls[lscount]:sub(-1, -1)) == 5 then
+ ls5 = ls5 .. ls[lscount]
+ ls[lscount] = ''
+ end
lscount = lscount + 1
end
if base ~= "ERR" then
local l = {}
- function l.try (kind, base, parts, pp, su, ls)
- if parts == 2 and pp ~= '' and su ~= '' and gregalltab[kind][base .. pp .. su .. ls] then return base .. pp .. su .. ls, '', '' end
+ function l.try (kind, base, parts, pp, su, ls5, ls)
+ if parts == 2 and pp ~= '' and su ~= '' and gregalltab[kind][base .. pp .. su .. ls5 .. ls] then return base .. pp .. su .. ls5 .. ls, '', '' end
-- Prefer subpunctis over prepunctis.
- if parts == 1 and su ~= '' and gregalltab[kind][base .. su .. ls] then return base .. su .. ls, pp, '' end
- if parts == 1 and pp ~= '' and gregalltab[kind][base .. pp .. ls] then return base .. pp .. ls, '', su end
+ if parts == 1 and su ~= '' and gregalltab[kind][base .. su .. ls5 .. ls] then return base .. su .. ls5 .. ls, pp, '' end
+ if parts == 1 and pp ~= '' and gregalltab[kind][base .. pp .. ls5 .. ls] then return base .. pp .. ls5 .. ls, '', su end
-- Prefer subpunctis over significative letters.
- if parts == 0 and su ~= '' and ls ~= '' and gregalltab[kind][base .. su] then return nil, pp, su end
- if parts == 0 and gregalltab[kind][base .. ls] then return base .. ls, pp, su end
+ if parts == 0 and su ~= '' and ls ~= '' and gregalltab[kind][base .. su .. ls5] then return nil, pp, su end
+ if parts == 0 and gregalltab[kind][base .. ls5 .. ls] then return base .. ls5 .. ls, pp, su end
return nil, pp, su
end
local r = nil
local ppsuparts = 0
if pp ~= '' then ppsuparts = 1 end
if su ~= '' then ppsuparts = ppsuparts + 1 end
- -- We assume here no character in the font has more than two
- -- significative letters.
+ -- We assume here no character in the font has more than three
+ -- significative letters. Significative letters with position 5
+ -- are always required to be in font and have preference over
+ -- pre/subpunctis and other significative letters.
local allparts = ppsuparts + lscount
- if lscount >= 2 then allparts = ppsuparts + 2 end
+ if lscount >= 3 then allparts = ppsuparts + 3 end
-- Try to match as many parts (ls sequences, pp string, su string) as possible
-- except that for ls accept any of ls sequences only if we have all of them.
for parts = allparts, 0, -1 do
+ if lscount == 3 and parts >= 3 and parts <= 3 + ppsuparts then
+ r, pp, su = l.try(kind, base, parts - 3, pp, su, ls5, ls[0] .. ls[1] .. ls[2])
+ if (not r) and ls[0] ~= '' and ls[1] ~= '' and ls[2] ~= '' then
+ local p0 = tonumber(ls[0]:sub(-1, -1))
+ local p1 = tonumber(ls[1]:sub(-1, -1))
+ local p2 = tonumber(ls[2]:sub(-1, -1))
+ if (p0 ~= p1) and (p0 ~= p2) and (p1 ~= p2) then
+ r, pp, su = l.try(kind, base, parts - 3, pp, su, ls5, ls[1] .. ls[0] .. ls[2])
+ if not r then r, pp, su = l.try(kind, base, parts - 3, pp, su, ls5, ls[0] .. ls[2] .. ls[1]) end
+ if not r then r, pp, su = l.try(kind, base, parts - 3, pp, su, ls5, ls[1] .. ls[2] .. ls[0]) end
+ if not r then r, pp, su = l.try(kind, base, parts - 3, pp, su, ls5, ls[2] .. ls[0] .. ls[1]) end
+ if not r then r, pp, su = l.try(kind, base, parts - 3, pp, su, ls5, ls[2] .. ls[1] .. ls[0]) end
+ end
+ end
+ if r then
+ ls[0] = ''
+ ls[1] = ''
+ ls[2] = ''
+ break
+ end
+ if r then break end
+ end
if lscount == 2 and parts >= 2 and parts <= 2 + ppsuparts then
- r, pp, su = l.try(kind, base, parts - 2, pp, su, ls[0] .. ls[1])
- if not r then
- r, pp, su = l.try(kind, base, parts - 2, pp, su, ls[1] .. ls[0])
+ r, pp, su = l.try(kind, base, parts - 2, pp, su, ls5, ls[0] .. ls[1])
+ if (not r) and ls[0] ~= '' and ls[1] ~= '' and (tonumber(ls[0]:sub(-1, -1)) ~= tonumber(ls[1]:sub(-1, -1))) then
+ r, pp, su = l.try(kind, base, parts - 2, pp, su, ls5, ls[1] .. ls[0])
end
if r then
ls[0] = ''
@@ -342,13 +385,13 @@ local gregallparse_neumes = function(str, kind, scale)
if r then break end
end
if lscount == 1 and parts >= 1 and parts <= 1 + ppsuparts then
- r, pp, su = l.try(kind, base, parts - 1, pp, su, ls[0])
+ r, pp, su = l.try(kind, base, parts - 1, pp, su, ls5, ls[0])
if r then
ls[0] = ''
break
end
end
- r, pp, su = l.try(kind, base, parts, pp, su, '')
+ r, pp, su = l.try(kind, base, parts, pp, su, ls5, '')
if r then break end
end
if not r or (pp ~= '' and not gregalltab[kind][pp]) or (su ~= '' and not gregalltab[kind][su]) then
@@ -392,15 +435,16 @@ local gregallparse_neumes = function(str, kind, scale)
lwidths[11] = math.max (lwidths[2], lwidths[8])
lwidths[12] = math.max (lwidths[3], lwidths[6], lwidths[9])
local pre = ''
+ local post = ''
for i = 0, lscount - 1 do
if ls[i] ~= '' then
local p = tonumber(ls[i]:sub(-1, -1))
local l = ls[i]:sub(1, -2)
local lstr = gregalltab[kind][l]
- base, pre = add_ls(base, pre, lstr, p, rmetrics, gregallmetrics[kind][l], baseraise, lwidths, curlwidths, scale)
+ base, pre, post = add_ls(base, pre, post, lstr, p, rmetrics, gregallmetrics[kind][l], baseraise, lwidths, curlwidths, scale)
end
end
- base = pre..base
+ base = pre..base..post
end
end
ret = ret .. base
@@ -411,7 +455,7 @@ end
local function init_font(fontname)
if not gregalltab[fontname] then
- gregalltab[fontname], gregallmetrics[fontname] = gregallreadfont(font.current())
+ gregalltab[fontname], gregallmetrics[fontname] = gregallreadfont(fontname, font.current())
end
end
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.tex
index 6c4934b9ef4..cd1a66f2821 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.tex
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.tex
@@ -1,6 +1,6 @@
%GregorioTeX file.
%
-% Copyright (C) 2014-2015 The Gregorio Project (see CONTRIBUTORS.md)
+% Copyright (C) 2014-2017 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
@@ -19,8 +19,7 @@
% this file contains macros for St. Gall ancient neume support
-\gre@debugmsg{general}{Loading gregoriotex-nabc.tex}%
-\gre@declarefileversion{gregoriotex-nabc.tex}{4.1.5}% GREGORIO_VERSION
+\gre@declarefileversion{gregoriotex-nabc.tex}{5.0.1}% GREGORIO_VERSION
\xdef\gre@nabcfontname{gregall}%
@@ -37,21 +36,40 @@
\gre@nabcfontloadedtrue%
}
-\def\grenabccharno#1#2#3{{\directlua{
- gregoriotex.print_nabc(gregoriotex.parse_nabc("#1", "\luatexluaescapestring{#2}", #3))
-}}}
+\def\gre@nabccharno#1#2#3{%
+ \gre@trace{gre@nabccharno{#1}{#2}{#3}}%
+ {\directlua{gregoriotex.print_nabc(gregoriotex.parse_nabc("#1", "\luatexluaescapestring{#2}", #3))}}%
+ \gre@trace@end%
+}
\def\GreNABCChar#1{{%
%\catcode`\~=12{}%
%\catcode`\@=11{}%
\gre@font@nabc %
\gre@style@nabc %
- \grenabccharno{#1}{\gre@nabcfontname}{1}%
+ \gre@nabccharno{#1}{\gre@nabcfontname}{1}%
\endgre@style@nabc%
}}
-\def\GreNABCNeumes#1#2{%
- \GreSetTextAboveLines{\GreNABCChar{#2}}%
+\newif\ifgre@nabcvoice@i@visible
+\gre@nabcvoice@i@visibletrue
+% define more of these when more voices are supported
+
+\def\gresetnabc#1#2{%
+ \IfStrEqCase{#2}{%
+ {visible}%
+ {\csname gre@nabcvoice@\romannumeral#1@visibletrue\endcsname}%
+ {invisible}%
+ {\csname gre@nabcvoice@\romannumeral#1@visiblefalse\endcsname}%
+ }[% all other cases
+ \gre@error{Unrecognized option "#2" for \protect\gresetnabc\MessageBreak Possible options are: 'visible' and 'invisible'}%
+ ]%
+}
+
+\def\GreNABCNeumes#1#2#3#4{%
+ \csname ifgre@nabcvoice@\romannumeral#1@visible\endcsname %
+ \GreSetNabcAboveLines{\GreNABCChar{#2}}%
+ \fi %
}
\newif\ifgre@nabcfontloaded%
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.lua b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.lua
index 12c9465bde0..c0cea8782c4 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.lua
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.lua
@@ -1,6 +1,6 @@
--GregorioTeX Signs Lua support file.
--
---Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md)
+--Copyright (C) 2015-2017 The Gregorio Project (see CONTRIBUTORS.md)
--
--This file is part of Gregorio.
--
@@ -19,12 +19,13 @@
-- this file contains lua functions to support signs used by GregorioTeX.
--- GREGORIO_VERSION 4.1.5
+-- GREGORIO_VERSION 5.0.1
local err = gregoriotex.module.err
local warn = gregoriotex.module.warn
local info = gregoriotex.module.info
local log = gregoriotex.module.log
+local debugmessage = gregoriotex.module.debugmessage
-- Note offset cases:
-- here are the common values for both hepisema (and consequently also for
@@ -111,8 +112,8 @@ local offset_cases = {
-- punctum inclinatum as last note
{
case = 'FinalInclinatum',
- v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctumInclinatum}{0}{30\the\gre@factor }{#2}{#3}{#4}]],
- h = [[\gre@hepisorlineaux{\GreCPPunctumInclinatum}{\gre@char@he@inclinatum{#4}}{2}{#3}]],
+ v = [[\gre@vepisemaorrareaux{0}{\GreCPDescendensPunctumInclinatum}{0}{30\the\gre@factor }{#2}{#3}{#4}]],
+ h = [[\gre@hepisorlineaux{\GreCPDescendensPunctumInclinatum}{\gre@char@he@inclinatum{#4}}{2}{#3}]],
},
-- punctum inclinatum deminutus as last note
{
@@ -135,8 +136,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 +156,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 +371,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,14 +408,14 @@ local offset_cases = {
-- least two
{
case = 'SalicusOriscusWide',
- v = [[\gre@vepisemaorrareaux{\GreCPVirgaStrataThreeNothing}{\GreCPSalicusOriscus}{3}{0}{#2}{#3}{#4}]],
- h = [[\gre@hepisorlineaux{\GreCPVirgaStrataThreeNothing}{\gre@char@he@salicus@oriscus{#4}}{4}{#3}]],
+ v = [[\gre@vepisemaorrareaux{\GreCPPesAscendensOriscusThreeNothing}{\GreCPAscendensOriscusLineBLTR}{3}{0}{#2}{#3}{#4}]],
+ h = [[\gre@hepisorlineaux{\GreCPPesAscendensOriscusThreeNothing}{\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}]],
- h = [[\gre@hepisorlineaux{\GreCPVirgaStrataOneNothing}{\gre@char@he@salicus@oriscus{#4}}{4}{#3}]],
+ v = [[\gre@vepisemaorrareaux{\GreCPPesAscendensOriscusOneNothing}{\GreCPAscendensOriscus}{3}{0}{#2}{#3}{#4}]],
+ h = [[\gre@hepisorlineaux{\GreCPPesAscendensOriscusOneNothing}{\gre@char@he@salicus@oriscus{#4}}{4}{#3}]],
},
-- punctum fused to the next note
{
@@ -431,8 +432,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
{
@@ -457,7 +458,7 @@ local offset_cases = {
local function emit_offset_macros()
local i, item
for i, item in ipairs(offset_cases) do
- log([[\def\GreOCase%s{%d}]], item.case, i)
+ debugmessage('offsetcase', [[\def\GreOCase%s{%d}]], item.case, i)
tex.sprint(string.format([[\def\GreOCase%s{%d}]], item.case, i))
end
tex.sprint([[\def\gre@v@case#1#2#3#4{]])
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.tex
index ef99b7cdeeb..f75dc7af463 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.tex
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-signs.tex
@@ -1,6 +1,6 @@
%GregorioTeX file.
%
-% Copyright (C) 2007-2016 The Gregorio Project (see CONTRIBUTORS.md)
+% Copyright (C) 2007-2017 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
@@ -22,15 +22,16 @@
\def\grebarbracewidth{.58879}%
-\gre@debugmsg{general}{Loading gregoriotex-signs.tex}%
-\gre@declarefileversion{gregoriotex-signs.tex}{4.1.5}% GREGORIO_VERSION
+\gre@declarefileversion{gregoriotex-signs.tex}{5.0.1}% GREGORIO_VERSION
\def\gre@usestylecommon{%
+ \gre@trace{gre@usestylecommon}%
\ifgre@usestylefont\else %
\gre@usestylefonttrue%
\gre@setstylefont %
\fi %
\relax %
+ \gre@trace@end%
}%
\gresetglyphstyle{default}%
@@ -44,6 +45,7 @@
\gre@disablemorafalse
\def\greprintsigns#1#2{%
+ \gre@trace{greprintsigns{#1}{#2}}%
\IfStrEqCase{#2}{%
{enable}%
{%
@@ -78,6 +80,7 @@
}[% all other cases
\gre@error{Unrecognized second argument for \protect\greprintsigns}%
]%
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -103,6 +106,10 @@
% #1 is the type of discretionary, for penalty assignment. Recognized types:
% - 0: clef change
\def\GreDiscretionary#1#2#3{%
+ \gre@trace{GreDiscretionary{#1}{#2}{#3}}%
+ \gre@save@additionalspaces %
+ \directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary, true)}%
+ \gre@restore@additionalspaces %
\global\let\gre@hskip\kern %
\global\let\gre@penalty\gre@falsepenalty %
\global\xdef\gre@insidediscretionary{\number 1}%
@@ -121,6 +128,7 @@
\global\let\gre@hskip\hskip %
\global\let\gre@penalty\gre@truepenalty %
\relax %
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -132,6 +140,7 @@
\gre@showcleftrue
\def\gresetclef#1{%
+ \gre@trace{gresetclef{#1}}%
\IfStrEqCase{#1}{%
{visible}%
{\gre@showcleftrue}%
@@ -140,22 +149,18 @@
}[% all other cases
\gre@error{Unrecognized option "#1" for \protect\gresetclef\MessageBreak Possible options are: 'visible' and 'invisible'}%
]%
+ \gre@trace@end%
}%
-
-\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
+%% macro to define the clef that will appear at the beginning of the lines
+%% #1 c or f: type of first clef
+%% #2 int: line of first clef
+%% #3 int: 0 if not space, 1 if normal space, 2 for short space
+%% #4 int: height of the flat of first clef, 3 for no flat
+%% #5, #6, #7 = #1, #2, #3 for second clef
\def\GreSetLinesClef#1#2#3#4#5#6#7{%
+ \gre@trace{GreSetLinesClef{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
+ \gre@save@clef{#1}{#2}{#4}{#5}{#6}{#7}%
\gre@localleftbox{%
\gre@skip@temp@four = \gre@dimen@additionalleftspace\relax%
\kern\gre@skip@temp@four %
@@ -163,7 +168,7 @@
\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}%
+ \hbox{\gre@typeclef{#1}{#2}{0}{#3}{#4}{#5}{#6}{#7}\gre@hskip\gre@skip@temp@four}%
\else %
\gre@skip@temp@four = \gre@space@dimen@noclefspace\relax%
\hbox{\kern\gre@skip@temp@four}%
@@ -172,37 +177,45 @@
\xdef\gre@clefflatheight{#4}%
\xdef\gre@cleftwoflatheight{#7}%
\relax%
+ \gre@trace@end%
+}%
+
+% defines the largest clef of the score
+% arguments are the same as \GreSetLinesClef except that the #3 of
+% \GreSetLineClef is removed (always 1)
+\def\GreSetLargestClef#1#2#3#4#5#6{%
+ \gre@trace{GreSetLargestClef{#1}{#2}{#3}{#4}{#5}{#6}}%
+ \gre@boxclef{#1}{#2}{0}{1}{#3}{#4}{#5}{#6}%
+ \gre@update@clefwidth@largest{\wd\gre@box@temp@width}%
+ \relax%
}%
\def\gre@save@clef#1#2#3#4#5#6{%
+ \gre@trace{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}%
+ \gre@trace@end%
}%
%% macro redrawing a key from clefnum, useful for vertical space changes
\def\gre@updatelinesclef{%
+ \gre@trace{gre@updatelinesclef}%
\GreSetLinesClef{\gre@clef}{\gre@clefheight}{1}{\gre@clefflatheight}%
{\gre@cleftwo}{\gre@cleftwoheight}{\gre@cleftwoflatheight}\relax %
+ \gre@trace@end%
}%
\newbox\gre@box@temp@clef%
\newbox\gre@box@temp@cleftwo%
-% macro that typesets the clef
-% arguments are :
-%% #1: the type of the clef : c or f
-%% #2: the line of the clef (1 is the lowest)
-%% #3: if we must use small clef characters (inside a line) or not 0: if not inside, 1 if inside
-%% #4: if we must type a space after or not
-%% #5: if 3, it means that we must not put a flat after the clef, otherwise it's the height of the flat
-%% #6: the type of the secondary clef : c or f
-%% #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{%
+
+% sets \gre@box@temp@width with the clef, the arguments are the same as \gre@typeclef
+\def\gre@boxclef#1#2#3#4#5#6#7#8{%
+ \gre@trace{gre@boxclef{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
+ \global\setbox\gre@box@temp@width=\hbox{%
\ifcase#7%
\gre@typesingleclef{#1}{#2}{#3}{#5}%
\else %
@@ -222,15 +235,111 @@
\fi %
\fi %
}%
+ \gre@trace@end%
+}
+
+\def\gre@saveclefextrema#1#2{%
+ \gre@trace{gre@saveclefextrema{#1}{#2}}%
+ % compute the clef extrema
+ \ifcase#1\or % first@1
+ \global\let\gre@pitch@cleftop\gre@pitch@e %
+ \global\let\gre@pitch@clefbottom\gre@pitch@c %
+ \ifcase#2\or\or % second@2
+ \global\let\gre@pitch@cleftop\gre@pitch@g %
+ \or % second@3
+ \global\let\gre@pitch@cleftop\gre@pitch@i %
+ \or % second@4
+ \global\let\gre@pitch@cleftop\gre@pitch@k %
+ \or % second@5
+ \global\let\gre@pitch@cleftop\gre@pitch@m %
+ \fi %
+ \or % first@2
+ \global\let\gre@pitch@cleftop\gre@pitch@g %
+ \global\let\gre@pitch@clefbottom\gre@pitch@e %
+ \ifcase#2\or % second@1
+ \global\let\gre@pitch@clefbottom\gre@pitch@c %
+ \or\or % second@3
+ \global\let\gre@pitch@cleftop\gre@pitch@i %
+ \or % second@4
+ \global\let\gre@pitch@cleftop\gre@pitch@k %
+ \or % second@5
+ \global\let\gre@pitch@cleftop\gre@pitch@m %
+ \fi %
+ \or % first@3
+ \global\let\gre@pitch@cleftop\gre@pitch@i %
+ \global\let\gre@pitch@clefbottom\gre@pitch@g %
+ \ifcase#2\or % second@1
+ \global\let\gre@pitch@clefbottom\gre@pitch@c %
+ \or % second@2
+ \global\let\gre@pitch@clefbottom\gre@pitch@e %
+ \or\or % second@4
+ \global\let\gre@pitch@cleftop\gre@pitch@k %
+ \or % second@5
+ \global\let\gre@pitch@cleftop\gre@pitch@m %
+ \fi %
+ \or % first@4
+ \global\let\gre@pitch@cleftop\gre@pitch@k %
+ \global\let\gre@pitch@clefbottom\gre@pitch@i %
+ \ifcase#2\or % second@1
+ \global\let\gre@pitch@clefbottom\gre@pitch@c %
+ \or % second@2
+ \global\let\gre@pitch@clefbottom\gre@pitch@e %
+ \or % second@3
+ \global\let\gre@pitch@clefbottom\gre@pitch@g %
+ \or\or % second@5
+ \global\let\gre@pitch@cleftop\gre@pitch@m %
+ \fi %
+ \or % first@5
+ \global\let\gre@pitch@cleftop\gre@pitch@m %
+ \global\let\gre@pitch@clefbottom\gre@pitch@k %
+ \ifcase#2\or % second@1
+ \global\let\gre@pitch@clefbottom\gre@pitch@c %
+ \or % second@2
+ \global\let\gre@pitch@clefbottom\gre@pitch@e %
+ \or % second@3
+ \global\let\gre@pitch@clefbottom\gre@pitch@g %
+ \or % second@4
+ \global\let\gre@pitch@clefbottom\gre@pitch@i %
+ \fi %
+ \fi %
+ \gre@trace@end%
+}%
+
+\def\GreInitialClefPosition#1#2{%
+ \gre@trace{GreInitialClefPosition{#1}{#2}}%
+ \ifgre@showclef %
+ \gre@saveclefextrema{#1}{#2}%
+ \fi %
+ \gre@trace@end%
+}%
+
+% macro that typesets the clef
+% arguments are :
+%% #1: the type of the clef : c or f
+%% #2: the line of the clef (1 is the lowest)
+%% #3: if we must use small clef characters (inside a line) or not 0: if not inside, 1 if inside
+%% #4: 0: no space after, 1: normal space after, 2: short space after
+%% #5: if 3, it means that we must not put a flat after the clef, otherwise it's the height of the flat
+%% #6: the type of the secondary clef : c or f
+%% #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{%
+ \gre@trace{gre@typeclef{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
+ \gre@saveclefextrema{#2}{#7}%
+ \gre@boxclef{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
\ifcase#3%
- \global\gre@dimen@clefwidth=\wd\gre@box@temp@width %
+ \gre@update@clefwidth@current{\wd\gre@box@temp@width}%
\fi %
\copy\gre@box@temp@width %
- \gre@skip@temp@two=\gre@space@skip@spaceafterlineclef\relax%
- \ifnum#4=0\relax %
+ \ifcase#4 %
\gre@skip@temp@two=\gre@space@skip@afterclefnospace\relax%
+ \or %
+ \gre@skip@temp@two=\gre@space@skip@spaceafterlineclef\relax%
+ \else %
+ \gre@skip@temp@two=\gre@space@skip@shortspaceafterlineclef\relax%
\fi %
\gre@hskip\gre@skip@temp@two %
+ \gre@trace@end%
}%
% macro that typesets one clef
@@ -240,6 +349,7 @@
%% #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{%
+ \gre@trace{gre@typesingleclef{#1}{#2}{#3}{#4}}%
\ifcase#2 %
\or%
\gre@calculate@glyphraisevalue{\gre@pitch@c}{0}{}%
@@ -272,15 +382,25 @@
\GreFlat{#4}{1}{}{}{}%
\fi %
\relax %
+ \gre@trace@end%
}%
% 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{%
+\def\GreSetInitialClef#1#2#3#4#5#6#7{%
+ \gre@trace{GreSetInitialClef{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
\gre@save@clef{#1}{#2}{#3}{#4}{#5}{#6}%
\ifgre@showclef%
- \gre@typeclef{#1}{#2}{0}{1}{#3}{#4}{#5}{#6}%
+ \ifnum\gre@initiallines=1\relax %
+ \ifnum#7=1\relax %
+ \gre@typeclef{#1}{#2}{0}{1}{#3}{#4}{#5}{#6}%
+ \else %
+ \gre@typeclef{#1}{#2}{0}{2}{#3}{#4}{#5}{#6}%
+ \fi %
+ \else %
+ \gre@typeclef{#1}{#2}{0}{1}{#3}{#4}{#5}{#6}%
+ \fi %
\else%
\gre@skip@temp@four = \gre@space@dimen@noclefspace\relax%
\hbox{\kern\gre@skip@temp@four}%
@@ -292,6 +412,7 @@
\gre@adjustsecondline %
\fi %
\relax%
+ \gre@trace@end%
}%
% macro called when the key changes
@@ -300,6 +421,7 @@
% 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{%
+ \gre@trace{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}%
@@ -310,28 +432,55 @@
\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 %
+ \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}%
- \gre@skip@temp@four = \gre@space@skip@clefchangespace\relax%
+ \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%
+ \gre@trace@end%
}%
% 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{%
+\def\GreCustos#1#2{%
+ \gre@trace{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@skip@temp@four = \gre@space@skip@spacebeforeinlinecustos\relax%
- \kern\gre@skip@temp@four%
+ \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}}%
+ \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 %
@@ -354,26 +503,30 @@
\kern\gre@skip@bar@lastskip %
\GreNoBreak %
\fi %
+ \directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}%
\relax %
+ \gre@trace@end%
}%
% typesets a custos for the end of the score
-\def\GreFinalCustos#1{%
+\def\GreFinalCustos#1#2{%
+ \gre@trace{GreFinalCustos{#1}{#2}}%
\GreNoBreak%
- \gre@dimen@temp@four = \glueexpr(\gre@space@skip@spacebeforeeolcustos)\relax%
- \kern\gre@dimen@temp@four %
- \GreNoBreak%
- \GreCustos{#1}%
+ \GreCustos{#1}{#2}%
\gre@endofglyphcommon %
+ \gre@trace@end%
}
% the argument is the height
-\edef\gre@nextcustos{\gre@pitch@dummy}%
-\def\GreNextCustos#1{%
- \gre@debugmsg{custos}{nextcustos = #1}%
+\edef\gre@nextcustospitch{\gre@pitch@dummy}%
+\edef\gre@nextcustosalteration{}%
+\def\GreNextCustos#1#2{%
+ \gre@trace{GreNextCustos{#1}{#2}}%
+ \gre@debugmsg{custos}{nextcustos = #1,#2}%
\ifnum\gre@insidediscretionary=0\relax %
\gre@debugmsg{custos}{not discretionary}%
- \edef\gre@nextcustos{#1}%
+ \edef\gre@nextcustospitch{#1}%
+ \edef\gre@nextcustosalteration{#2}%
\ifgre@blockeolcustos\else%
\gre@debugmsg{custos}{not blocked}%
\gre@calculate@glyphraisevalue{#1}{0}{}%
@@ -381,12 +534,19 @@
\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@custosalteration{#1}{#2}%
+ \GreNoBreak%
+ \raise \gre@dimen@glyphraisevalue%
+ \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@pickcustos{#1}\relax %
+ \gre@custosalteration{#1}{#2}%
+ \GreNoBreak%
+ \gre@pickcustos{#1}{0}\relax %
}%
\gre@localrightbox{%
\ifgre@showlines %
@@ -396,17 +556,18 @@
\gre@additionaltopcustoslineend %
\fi\fi %
\fi %
- \raise \gre@dimen@glyphraisevalue%
\copy\gre@box@temp@width %
}%
\fi %
\fi %
\relax%
+ \gre@trace@end%
}%
% macro that typesets an additional line at the top for custos at end of line
\def\gre@additionaltopcustoslineend{%
+ \gre@trace{gre@additionalaltopcustoslineend}%
\gre@dimen@temp@five=\dimexpr(\gre@dimen@staffheight %
+ \gre@space@dimen@spacebeneathtext %
+ \gre@space@dimen@spacelinestext %
@@ -416,10 +577,6 @@
\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 %
@@ -428,9 +585,11 @@
\endgre@style@additionalstafflines%
}%
\relax %
+ \gre@trace@end%
}%
\def\gre@additionalbottomcustoslineend{%
+ \gre@trace{gre@additionalbottomcustoslineend}%
\gre@dimen@temp@five=\dimexpr(\gre@space@dimen@spacebeneathtext %
+ \gre@space@dimen@spacelinestext %
+ \gre@dimen@additionalbottomspace %
@@ -440,10 +599,6 @@
\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 %
@@ -452,11 +607,13 @@
\endgre@style@additionalstafflines%
}%
\relax %
+ \gre@trace@end%
}%
% same macros, but for a custos in the middle
\def\gre@additionaltopcustoslinemiddle{%
+ \gre@trace{gre@additionaltopcustoslinemiddle}%
\gre@dimen@temp@five=\dimexpr(\gre@dimen@staffheight %
+ \gre@space@dimen@spacebeneathtext %
+ \gre@space@dimen@spacelinestext %
@@ -466,10 +623,6 @@
\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 %
@@ -478,9 +631,11 @@
\endgre@style@additionalstafflines%
}%
\relax %
+ \gre@trace@end%
}%
\def\gre@additionalbottomcustoslinemiddle{%
+ \gre@trace{gre@additionalbottomcustoslinemiddle}%
\gre@dimen@temp@five=\dimexpr(\gre@space@dimen@spacebeneathtext %
+ \gre@space@dimen@spacelinestext %
+ \gre@dimen@additionalbottomspace %
@@ -490,10 +645,6 @@
\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 %
@@ -502,9 +653,42 @@
\endgre@style@additionalstafflines%
}%
\relax %
+ \gre@trace@end%
+}%
+
+\newif\ifgre@usecustosalteration%
+\gre@usecustosalterationtrue%
+\def\gresetcustosalteration#1{%
+ \gre@trace{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'}%
+ ]%
+ \gre@trace@end%
+}%
+\def\gre@custosalteration#1#2{%
+ \gre@trace{gre@custosalteration{#1}{#2}}%
+ \ifgre@usecustosalteration %
+ \IfStrEq{#2}{}{}{\csname Gre#2\endcsname{#1}{0}{}{}{}}%
+ \fi %
+ \gre@trace@end%
}%
-\def\gre@pickcustos#1{%
+% #2 is 0 for measurement only, 1 in the normal case, 2 for the right box
+\def\gre@pickcustos#1#2{%
+ \gre@trace{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 %
@@ -566,6 +750,7 @@
\or\gre@fontchar@custosbottomlong %
\or\gre@fontchar@custosbottommiddle %
\fi%
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -580,24 +765,30 @@
\@ifnextchar[{\gre@setbracerendering}{\gre@setallbracerendering}%
}%
\def\gre@setallbracerendering#1{%
+ \gre@trace{gre@setallbracerendering{#1}}%
\gre@@setbracerendering{brace}{#1}%
\gre@@setbracerendering{underbrace}{#1}%
\gre@@setbracerendering{curlybrace}{#1}%
\gre@@setbracerendering{barbrace}{#1}%
+ \gre@trace@end%
}%
\def\gre@setbracerendering[#1]#2{%
+ \gre@trace{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'}]%
+ \gre@trace@end%
}%
\def\gre@@setbracerendering#1#2{%
+ \gre@trace{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'}]%
+ \gre@trace@end%
}%
\gdef\gre@fontchar@curlybrace{\gre@font@music\GreCPCurlyBrace}%
@@ -613,9 +804,11 @@
% #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{%
+ \gre@trace{GreOverCurlyBrace{#1}{#2}{#3}{#4}{#5}}%
\ifgre@boxing\else %
\gre@brace@common{#1}{#2}{#3}{#4}{#5}{\gre@pitch@overbraceglyph}{\gre@fontchar@curlybrace}%
\fi %
+ \gre@trace@end%
}%
% #1: the width
@@ -623,9 +816,11 @@
% #3: a horizontal shift
% #4: 1 if we shift to the beginning of the last glyph, 0 otherwise
\def\GreOverBrace#1#2#3#4{%
+ \gre@trace{GreOverBrace{#1}{#2}{#3}{#4}}%
\ifgre@boxing\else %
\gre@brace@common{#1}{#2}{#3}{#4}{0}{\gre@pitch@overbraceglyph}{\gre@fontchar@brace}%
\fi %
+ \gre@trace@end%
}%
% #1: the width
@@ -633,9 +828,11 @@
% #3: a horizontal shift
% #4: 1 if we shift to the beginning of the last glyph, 0 otherwise
\def\GreUnderBrace#1#2#3#4{%
+ \gre@trace{GreUnderBrace{#1}{#2}{#3}{#4}}%
\ifgre@boxing\else %
\gre@brace@common{#1}{#2}{#3}{#4}{0}{\gre@pitch@underbrace}{\gre@fontchar@underbrace}%
\fi %
+ \gre@trace@end%
}%
% #1: the width
@@ -646,6 +843,7 @@
% #6: the pitch at which to compute the height
% #7: the brace character
\def\gre@brace@common#1#2#3#4#5#6#7{%
+ \gre@trace{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 %
@@ -695,12 +893,15 @@
\kern\gre@dimen@temp@five %
\fi %
\relax %
+ \gre@trace@end%
}%
% #1 : the width
% #2 : the brace character
\def\gre@draw@fontbrace#1#2{%
+ \gre@trace{gre@draw@fontbrace{#1}{#2}}%
\setbox\gre@box@temp@sign=\hbox{#2}%
\gre@resizebox{#1}{\ht\gre@box@temp@sign}{#2}%
+ \gre@trace@end%
}%
% #1: the width, or * for the bar brace width
@@ -717,7 +918,7 @@
% #1: the width
\def\gre@draw@curlybrace#1{%
- \gre@debugmsg{general}{curly brace width = #1}%
+ \gre@trace{gre@draw@curlybrace{#1}}%
\gre@metapost{
\grebracemetapostpreamble{#1}
transform t;
@@ -765,10 +966,12 @@
transformed t;
endfig;
}%
+ \gre@trace@end%
}%
% #1: the width
\def\gre@draw@brace#1{%
+ \gre@trace{gre@draw@brace{#1}}%
\gre@draw@roundbrace{#1}{.89500}{
(-.00192,.70347) % start the top
.. controls (-.00192,.70525) and (-.00134,.70740)
@@ -788,10 +991,12 @@
.. controls (.01103,.69500) and (-.00192,.69508)
.. (-.00192,.70347) -- cycle
}%
+ \gre@trace@end%
}%
% #1: the width
\def\gre@draw@underbrace#1{%
+ \gre@trace{gre@draw@underbrace{#1}}%
\gre@draw@roundbrace{#1}{.25500}{
(-.00192,.24653) % start the bottom
.. controls (-.00192,.24475) and (-.00134,.24260)
@@ -811,12 +1016,14 @@
.. controls (.01103,.25500) and (-.00192,.25492)
.. (-.00192,.24653) -- cycle
}%
+ \gre@trace@end%
}%
% #1: the width
% #2: height of the bounding box
% #3: metapost commands to draw the outline
\def\gre@draw@roundbrace#1#2#3{%
+ \gre@trace{gre@draw@roundbrace{#1}{#2}{#3}}%
\gre@debugmsg{general}{round brace width = #1}%
\gre@metapost{
\grebracemetapostpreamble{#1}
@@ -838,12 +1045,14 @@
transformed t;
endfig;
}%
+ \gre@trace@end%
}%
% #1 : x-distance
% #2 : y-distance
% #3 : -1 for below, 1 for above
\def\gre@draw@slur#1#2#3{%
+ \gre@trace{gre@draw@slur{#1}{#2}{#3}}%
\gre@metapost{
\grebracemetapostpreamble{\directlua{gregoriotex.hypotenuse([[#1]],[[#2]])}}
transform t;
@@ -862,6 +1071,7 @@
) transformed t withpen pencircle scaled 0.3;
endfig;
}%
+ \gre@trace@end%
}%
\newdimen\greslurheight
@@ -872,6 +1082,7 @@
% #5 : y-distance
% #6 : end height if #6 not given
\def\GreSlur#1#2#3#4#5#6{%
+ \gre@trace{GreSlur{#1}{#2}{#3}{#4}{#5}{#6}}%
\ifgre@boxing\else %
\ifnum\number#2 > 0\relax %
\gre@calculate@glyphraisevalue{#1}{15}{}%
@@ -902,9 +1113,11 @@
}}%
\fi %
\relax %
+ \gre@trace@end%
}%
% #1: id of the variable length brace within the score
+% this function cannot be traced because doing so interferes with it producing something which TeX recognizes as a number
\def\GreVarBraceLength#1{%
\ifgre@boxing\else %
\directlua{gregoriotex.var_brace_len(#1)}%
@@ -915,6 +1128,7 @@
% #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{%
+ \gre@trace{GreVarBraceSavePos{#1}{#2}{#3}}%
\ifgre@boxing\else %
\ifcase#2 % 0
\gre@debugmsg{general}{save case 0}%
@@ -932,9 +1146,10 @@
\gre@savepos %
\kern.5\wd\gre@box@temp@sign %
\fi %
- \directlua{gregoriotex.var_brace_note_pos(#1, #3)}%
+ \directlua{gregoriotex.save_length(#1, #3)}%
\fi %
\relax %
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -951,10 +1166,11 @@
% #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{%
+ \gre@trace{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%
+ \gre@hskip\gre@skip@temp@four%
\or %
\gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax%
\kern\gre@skip@temp@four %
@@ -1022,35 +1238,36 @@
\fi %
\GreNoBreak %
\relax%
+ \gre@trace@end%
}%
\def\GrePunctumMora#1#2#3#4{%
+ \gre@trace{GrePunctumMora{#1}{#2}{#3}{#4}}%
\ifgre@disablemora\else %
\gre@punctum@mora{#1}{#2}{#3}{#4}%
\fi %
\relax %
+ \gre@trace@end%
}
% a function to typeset an augmentum duplex, easy enough to be understood...
\def\GreAugmentumDuplex#1#2#3{%
+ \gre@trace{GreAugmentumDuplex{#1}{#2}{#3}}%
\ifgre@boxing\else %
\GrePunctumMora{#1}{1}{#3}{0}%
\fi %
\GrePunctumMora{#2}{0}{0}{0}%
\relax %
+ \gre@trace@end%
}%
-\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{%
+ \gre@trace{GreLowChoralSign{#1}{#2}{#3}}%
\GreNoBreak %
\gre@skip@temp@four = \gre@space@skip@beforelowchoralsignspace\relax%
- \hskip\gre@skip@temp@four %
+ \gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\ifnum#3=1\relax %
\gre@calculate@glyphraisevalue{#1}{12}{}%
@@ -1058,30 +1275,16 @@
\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 %
+ \gre@trace@end%
}%
\def\GreHighChoralSign#1#2#3{%
+ \gre@trace{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 %
-}%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% macros for the typesetting of linea
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\def\GreLinea#1#2#3#4#5#6{%
- \GreGlyph{\GreCPLinea}{#1}{#2}{#3}{#4}{#5}{#6}%
\relax %
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1110,6 +1313,7 @@
% #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{%
+ \gre@trace{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}%
@@ -1150,6 +1354,7 @@
\advance\gre@dimen@temp@three by -2\gre@dimen@temp@two %
\kern\gre@dimen@temp@three%
\relax%
+ \gre@trace@end%
}%
\directlua{gregoriotex.emit_offset_macros()}%
@@ -1163,6 +1368,7 @@
% #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{%
+ \gre@trace{gre@vepisemaorrare{#1}{#2}{#3}{#4}{#5}}%
\ifgre@boxing\else %
\ifcase#4\or %
% if it is a vertical episema, we call the normal calculateglyphvalue
@@ -1185,22 +1391,28 @@
\gre@v@case{#2}{#3}{#4}{#5}%
\fi %
\relax%
+ \gre@trace@end%
}%
\def\GreVEpisema#1#2{%
+ \gre@trace{GreVEpisema{#1}{#2}}%
\ifgre@disablevepisema\else %
\gre@vepisemaorrare{#1}{#2}{\GreCPVEpisema}{1}{}%
\fi %
\relax %
+ \gre@trace@end%
}%
\def\GreBarBrace#1{%
+ \gre@trace{GreBarBrace{#1}}%
\gre@vepisemaorrare{\gre@pitch@overbraceglyph}{#1}{%
\gre@render@barbrace%
}{4}{}%
\relax %
+ \gre@trace@end%
}%
\def\gre@render@barbrace{%
+ \gre@trace{gre@render@barbrace}%
\hbox{%
\ifgre@metapost@barbrace %
\gre@draw@brace{*}%
@@ -1208,36 +1420,70 @@
\gre@fontchar@abovebarbrace %
\fi %
}%
+ \gre@trace@end%
}%
\def\GreBarVEpisema#1{%
+ \gre@trace{GreBarVEpisema{#1}}%
\gre@vepisemaorrare{\gre@pitch@barvepisema}{#1}{\GreCPVEpisema}{1}{}%
\relax %
+ \gre@trace@end%
}%
\def\GreAccentus#1#2{%
+ \gre@trace{GreAccentus{#1}{#2}}%
\gre@vepisemaorrare{#1}{#2}{\GreCPAccentus}{2}{}%
\relax %
+ \gre@trace@end%
}%
\def\GreSemicirculus#1#2{%
+ \gre@trace{GreSemicirculus{#1}{#2}}%
\gre@vepisemaorrare{#1}{#2}{\GreCPSemicirculus}{2}{}%
\relax %
+ \gre@trace@end%
}%
\def\GreCirculus#1#2{%
+ \gre@trace{GreCirculus{#1}{#2}}%
\gre@vepisemaorrare{#1}{#2}{\GreCPCirculus}{2}{}%
\relax %
+ \gre@trace@end%
}%
\def\GreReversedAccentus#1#2{%
+ \gre@trace{GreReversedAccentus{#1}{#2}}%
\gre@vepisemaorrare{#1}{#2}{\GreCPAccentusReversus}{2}{}%
\relax %
+ \gre@trace@end%
}%
\def\GreReversedSemicirculus#1#2{%
+ \gre@trace{GreReversedSemicirculus{#1}{#2}}%
\gre@vepisemaorrare{#1}{#2}{\GreCPSemicirculusReversus}{2}{}%
\relax %
+ \gre@trace@end%
+}%
+
+\def\GreMusicaFictaFlat#1#2{%
+ \gre@trace{GreMusicaFictaFlat{#1}{#2}}%
+ \gre@vepisemaorrare{#1}{#2}{\GreCPFlat}{2}{}%
+ \relax %
+ \gre@trace@end%
+}%
+
+\def\GreMusicaFictaNatural#1#2{%
+ \gre@trace{GreMusicaFictaNatural{#1}{#2}}%
+ \gre@vepisemaorrare{#1}{#2}{\GreCPNatural}{2}{}%
+ \relax %
+ \gre@trace@end%
+}%
+
+\def\GreMusicaFictaSharp#1#2{%
+ \gre@trace{GreMusicaFictaSharp{#1}{#2}}%
+ \gre@vepisemaorrare{#1}{#2}{\GreCPSharp}{2}{}%
+ \relax %
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1262,6 +1508,7 @@
% end of #1
% #4 argument is the same as in hepisorline
\def\gre@hepisorlineaux#1#2#3#4{%
+ \gre@trace{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%
@@ -1313,24 +1560,23 @@
\advance\gre@dimen@temp@three by -\gre@dimen@temp@two %
\kern\gre@dimen@temp@three %
\relax%
+ \gre@trace@end%
}%
% another dumb top function
\def\GreAdditionalLine#1#2#3{%
+ \gre@trace{GreAdditionalLine{#1}{#2}{#3}}%
\ifgre@showlines %
\ifgre@boxing\else %
- \xdef\gre@dimen@savedglyphraise{\the\gre@dimen@glyphraisevalue}%
+ \xdef\gre@saved@dimen@glyphraise{\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%
+ \gre@dimen@glyphraisevalue=\gre@saved@dimen@glyphraise\relax%
\fi %
\fi %
\relax %
+ \gre@trace@end%
}%
% #1 0 for over staff,
@@ -1345,20 +1591,19 @@
% 2 for #6 space after
% #6 custom space after, used if #4 is 2
\def\GreDrawAdditionalLine#1#2#3#4#5#6{%
+ \gre@trace{GreDrawAdditionalLine{#1}{#2}{#3}{#4}{#5}{#6}}%
\ifgre@showlines %
- \xdef\gre@dimen@savedglyphraise{\the\gre@dimen@glyphraisevalue}%
+ \xdef\gre@saved@dimen@glyphraise{\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%
+ \gre@dimen@glyphraisevalue=\gre@saved@dimen@glyphraise\relax%
\fi %
\relax %
+ \gre@trace@end%
}
\def\gre@drawadditionalline#1#2#3#4#5#6{%
+ \gre@trace{gre@drawadditionalline{#1}{#2}{#3}{#4}{#5}{#6}}%
\ifcase#3 % 0
\gre@dimen@temp@five=0pt\relax %
\or % 1
@@ -1399,6 +1644,7 @@
\vrule height \gre@dimen@stafflineheight %
width \gre@dimen@temp@two %
}%
+ \gre@trace@end%
}
% a function to typeset a horizontal line (additional line or episema).
@@ -1423,6 +1669,7 @@
%% 4 : low in space below note
%% 5 : high in space below note
\def\gre@hepisorline#1#2#3#4#5#6#7{{%
+ \gre@trace{gre@hepisorline{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
\ifcase#4 % 0
\gre@calculate@glyphraisevalue{#1}{9}{#7}%
\or % 1
@@ -1436,6 +1683,7 @@
\global\gre@dimen@glyphraisevalue=\dimexpr\gre@dimen@glyphraisevalue#6\relax %
\gre@h@case{#2}{#3}{#4}{#5}%
\relax%
+ \gre@trace@end%
}}%
% dumb top function
@@ -1451,6 +1699,7 @@
%% 4 : low in space below note
%% 5 : high in space below note
\def\GreHEpisema#1#2#3#4#5#6#7#8#9{%
+ \gre@trace{GreHEpisema{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}%
\ifgre@boxing\else\ifgre@disablehepisema\else %
\gre@prephepisemaledgerlineheuristics%
#7%
@@ -1462,20 +1711,14 @@
\gre@resetledgerlineheuristics%
\fi\fi %
\relax %
+ \gre@trace@end%
}%
\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{%
+ \gre@trace{gresethepisema{#1}}%
\IfStrEqCase{#1}{%
{bridge}%
{\gre@hepisemabridgetrue}%
@@ -1484,6 +1727,7 @@
}[% all other cases
\gre@error{Unrecognized option, #1, for \protect\gresethepisema\MessageBreak Possible options are: 'bridge' and 'break'}%
]%
+ \gre@trace@end%
}%
% 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,6 +1744,7 @@
%% 4 : low in space below note
%% 5 : high in space below note
\def\GreHEpisemaBridge#1#2#3#4#5#6{%
+ \gre@trace{GreHEpisemaBridge{#1}{#2}{#3}{#4}{#5}{#6}}%
\ifgre@hepisemabridge%
\ifgre@boxing\else %
\gre@prephepisemaledgerlineheuristics%
@@ -1532,6 +1777,7 @@
\fi %
\fi %
\relax %
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1540,119 +1786,156 @@
% 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}%
+\def\GreInVirgula#1#2#3{%
+ \gre@trace{GreInVirgula{#1}{#2}{#3}}%
+ \gre@writebar{0}{1}{#1}{#2}{#3}%
\relax%
+ \gre@trace@end%
}%
-\def\GreVirgula#1#2{%
- \gre@writebar{0}{0}{#1}{#2}%
+\def\GreVirgula#1#2#3{%
+ \gre@trace{GreVirgula{#1}{#2}{#3}}%
+ \gre@writebar{0}{0}{#1}{#2}{#3}%
\relax%
+ \gre@trace@end%
}%
-\def\GreInDivisioMinima#1#2{%
- \gre@writebar{1}{1}{#1}{#2}%
+\def\GreInDivisioMinima#1#2#3{%
+ \gre@trace{GreInDivisioMinima{#1}{#2}{#3}}%
+ \gre@writebar{1}{1}{#1}{#2}{#3}%
\relax%
+ \gre@trace@end%
}%
-\def\GreDivisioMinima#1#2{%
- \gre@writebar{1}{0}{#1}{#2}%
+\def\GreDivisioMinima#1#2#3{%
+ \gre@trace{GreDivisioMinima{#1}{#2}{#3}}%
+ \gre@writebar{1}{0}{#1}{#2}{#3}%
\relax%
+ \gre@trace@end%
}%
\def\GreInDivisioMinor#1#2{%
- \gre@writebar{2}{1}{#1}{#2}%
+ \gre@trace{GreInDivisioMinor{#1}{#2}}%
+ \gre@writebar{2}{1}{#1}{#2}{0}%
\relax%
+ \gre@trace@end%
}%
\def\GreDivisioMinor#1#2{%
- \gre@writebar{2}{0}{#1}{#2}%
+ \gre@trace{GreDivisioMinor{#1}{#2}}%
+ \gre@writebar{2}{0}{#1}{#2}{0}%
\relax%
+ \gre@trace@end%
}%
\def\GreInDivisioMaior#1#2{%
- \gre@writebar{3}{1}{#1}{#2}%
+ \gre@trace{GreInDivisioMaior{#1}{#2}}%
+ \gre@writebar{3}{1}{#1}{#2}{0}%
\relax%
+ \gre@trace@end%
}%
\def\GreDivisioMaior#1#2{%
- \gre@writebar{3}{0}{#1}{#2}%
+ \gre@trace{GreDivisioMaior{#1}{#2}}%
+ \gre@writebar{3}{0}{#1}{#2}{0}%
\relax%
+ \gre@trace@end%
}%
\def\GreDominica#1#2#3{%
+ \gre@trace{GreDominica{#1}{#2}{#3}}%
\ifcase#1\or %
- \gre@writebar{6}{0}{#2}{#3}%
+ \gre@writebar{6}{0}{#2}{#3}{0}%
\or %
- \gre@writebar{7}{0}{#2}{#3}%
+ \gre@writebar{7}{0}{#2}{#3}{0}%
\or %
- \gre@writebar{8}{0}{#2}{#3}%
+ \gre@writebar{8}{0}{#2}{#3}{0}%
\or %
- \gre@writebar{9}{0}{#2}{#3}%
+ \gre@writebar{9}{0}{#2}{#3}{0}%
\or %
- \gre@writebar{10}{0}{#2}{#3}%
+ \gre@writebar{10}{0}{#2}{#3}{0}%
\or %
- \gre@writebar{11}{0}{#2}{#3}%
+ \gre@writebar{11}{0}{#2}{#3}{0}%
\or %
- \gre@writebar{12}{0}{#2}{#3}%
+ \gre@writebar{12}{0}{#2}{#3}{0}%
\or %
- \gre@writebar{13}{0}{#2}{#3}%
+ \gre@writebar{13}{0}{#2}{#3}{0}%
\fi %
\relax%
+ \gre@trace@end%
}%
\def\GreInDominica#1#2#3{%
+ \gre@trace{GreInDominica{#1}{#2}{#3}}%
\ifcase#1\or %
- \gre@writebar{6}{1}{#2}{#3}%
+ \gre@writebar{6}{1}{#2}{#3}{0}%
\or %
- \gre@writebar{7}{1}{#2}{#3}%
+ \gre@writebar{7}{1}{#2}{#3}{0}%
\or %
- \gre@writebar{8}{1}{#2}{#3}%
+ \gre@writebar{8}{1}{#2}{#3}{0}%
\or %
- \gre@writebar{9}{1}{#2}{#3}%
+ \gre@writebar{9}{1}{#2}{#3}{0}%
\or %
- \gre@writebar{10}{1}{#2}{#3}%
+ \gre@writebar{10}{1}{#2}{#3}{0}%
\or %
- \gre@writebar{11}{1}{#2}{#3}%
+ \gre@writebar{11}{1}{#2}{#3}{0}%
\or %
- \gre@writebar{12}{1}{#2}{#3}%
+ \gre@writebar{12}{1}{#2}{#3}{0}%
\or %
- \gre@writebar{13}{1}{#2}{#3}%
+ \gre@writebar{13}{1}{#2}{#3}{0}%
\fi %
\relax%
+ \gre@trace@end%
}%
\def\GreInDivisioFinalis#1#2{%
+ \gre@trace{GreInDivisioFinalis{#1}{#2}}%
\ifgre@endofscore %
- \gre@writebar{5}{1}{#1}{#2}%
+ \gre@writebar{5}{1}{#1}{#2}{0}%
\else %
- \gre@writebar{4}{1}{#1}{#2}%
+ \gre@writebar{4}{1}{#1}{#2}{0}%
\fi %
\relax%
+ \gre@trace@end%
}%
\def\GreDivisioFinalis#1#2{%
+ \gre@trace{GreDivisioFinalis{#1}{#2}}%
\ifgre@endofscore %
- \gre@writebar{5}{0}{#1}{#2}%
+ \gre@writebar{5}{0}{#1}{#2}{0}%
\else %
- \gre@writebar{4}{0}{#1}{#2}%
+ \gre@writebar{4}{0}{#1}{#2}{0}%
\fi %
\relax%
+ \gre@trace@end%
}%
-% #1 is #2 of gre@writebar
-% #2 is #3 of gre@writebar
+% #1 is #2 of gre@writebar (@standalone or nothing)
+% #2 is #3 of gre@writebar (@text or @notext, only if standalone)
+% #3 is #5 of gre@writebar (@short or nothing)
% 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 %
+% this function cannot be traced because it appears inside \csname constructs
+\def\gre@bar@space@suffix#1#2#3{%
+ \ifgre@newbarspacing %
+ \ifcase#1 %
+ \ifcase#3 %
+ \ifcase#2 @standalone@notext\or @standalone@text\fi %
+ \or %
+ \ifcase#2 @standalone@notext@short\or @standalone@text@short\fi %
+ \fi %
+ \else %
+ \ifcase#3 \or @short\fi %
+ \fi %
+ \else %
+ \ifcase#3 \or @short\fi %
+ \fi %
}%
\newcount\gre@count@shiftaftermora
\gre@count@shiftaftermora=5
\def\gresetshiftaftermora#1{%
+ \gre@trace{gresetshiftaftermora{#1}}%
\IfStrEqCase{#1}{%
{always}%
{\gre@count@shiftaftermora=5}%
@@ -1669,6 +1952,7 @@
}[% all other cases
\gre@error{Unrecognized option "#1" in gresetshiftaftermora\MessageBreak Possible options are: 'always', 'barsonly', 'notesonly', 'barsnotextonly', 'barsinsideonly' and 'never'}%
]%
+ \gre@trace@end%
}%
% width of a punctum mora, reinitalized at each score
@@ -1681,6 +1965,7 @@
% - 1 for the general case
% - 2 when the punctum mora is before a bar
\def\gre@get@unkern@aftermora#1{%
+ \gre@trace{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 %
@@ -1691,9 +1976,11 @@
\global\gre@skip@punctummorashift=\glueexpr - \gre@dimen@morawidth - \gre@space@skip@spacebeforesigns + \gre@space@skip@moraadjustmentbar\relax %
\fi %
\relax %
+ \gre@trace@end%
}
\def\gre@unkern@bar@aftermora{%
+ \gre@trace{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
@@ -1711,6 +1998,7 @@
\kern\gre@skip@punctummorashift %
\fi%
\relax %
+ \gre@trace@end%
}
\newskip\gre@skip@bar@lastskip% skip after last bar
@@ -1720,38 +2008,19 @@
%% 2: is 0 if it is in a syllable containing only this bar, 1 otherwise
%% 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{%
+%% 5: 0 for the normal version of spaces, 1 for the short one (virgula and minima only)
+\def\gre@writebar#1#2#3#4#5{%
+ \gre@trace{gre@writebar{#1}{#2}{#3}{#4}{#5}}%
% 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
+ \ifnum\gre@count@shiftaftermora=0\else\ifnum\gre@count@shiftaftermora=4\else %
+ % if bar doesn’t has its own syllable, then we need to take care of the kern after a punctum mora here
+ \ifcase #2\or %
\gre@unkern@bar@aftermora %
\fi %
- \fi %
+ \fi\fi %
\fi %
\gre@newglyphcommon %
\gre@calculate@glyphraisevalue{\gre@pitch@bar}{0}{}% bar glyphs are made to be at this height
@@ -1768,7 +2037,7 @@
\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@skip@temp@four = \csname gre@space@skip@bar@virgula\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1777,12 +2046,12 @@
#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@skip@temp@four = \csname gre@space@skip@bar@virgula\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@minima\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1791,12 +2060,12 @@
#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@skip@temp@four = \csname gre@space@skip@bar@minima\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@minor\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1805,12 +2074,12 @@
#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@skip@temp@four = \csname gre@space@skip@bar@minor\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@maior\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1819,12 +2088,12 @@
#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@skip@temp@four = \csname gre@space@skip@bar@maior\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@finalis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1833,12 +2102,12 @@
\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@skip@temp@four = \csname gre@space@skip@bar@finalis\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@finalfinalis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1847,7 +2116,7 @@
\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@skip@temp@four = \csname gre@space@skip@bar@finalfinalis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1856,7 +2125,7 @@
% 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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1865,14 +2134,14 @@
#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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1881,12 +2150,12 @@
#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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1896,12 +2165,12 @@
#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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1911,14 +2180,14 @@
#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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1927,14 +2196,14 @@
#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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1943,14 +2212,14 @@
#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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1959,14 +2228,14 @@
#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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\GreNoBreak %
\fi %
@@ -1975,7 +2244,7 @@
#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@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax%
\gre@hskip\gre@skip@temp@four %
\fi %
\fi %
@@ -1984,7 +2253,9 @@
\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%
+ \gre@trace@end%
}%
\def\gre@fontchar@divisiomaior{%
@@ -2017,6 +2288,7 @@
%macro to end a line with a divisio finalis
\def\GreFinalDivisioFinalis#1{%
+ \gre@trace{GreFinalDivisioFinalis{#1}}%
\GreBarSyllable{\GreSetThisSyllable{}{}{}{}{}}{}{}{1}{\GreSetNextSyllable{}{}{}{}{}\GreLastOfLine}{}{16}{}{%
\ifgre@newbarspacing\else %
\gre@hskip\gre@space@skip@bar@finalfinalis %
@@ -2027,16 +2299,19 @@
#1%
}%
\relax%
+ \gre@trace@end%
}%
%macro to end a line with a divisio maior
\def\GreFinalDivisioMaior#1{%
+ \gre@trace{GreFinalDivisioMaior{#1}}%
\GreBarSyllable{\GreSetThisSyllable{}{}{}{}{}}{}{}{1}{\GreSetNextSyllable{}{}{}{}{}\GreLastOfLine}{}{16}{}{%
\GreLastOfScore %
\GreDivisioMaior{0}{}%
#1%
}%
\relax%
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -2050,6 +2325,7 @@
% macro for manipulating above flag
\def\gresetlinesbehindpunctumcavum#1{%
+ \gre@trace{gresetlinesbehindpunctumcavum{#1}}%
\IfStrEqCase{#1}{%
{visible}%
{\gre@hidepclinesfalse}%
@@ -2058,14 +2334,7 @@
}[% 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}}%
+ \gre@trace@end%
}%
% flag to indicate that lines behind an alteration should be hidden
@@ -2075,6 +2344,7 @@
% macro for manipulating above flag
\def\gresetlinesbehindalteration#1{%
+ \gre@trace{gresetlinesbehindalteration{#1}}%
\IfStrEqCase{#1}{%
{visible}%
{\gre@hidealtlinesfalse}%
@@ -2083,14 +2353,7 @@
}[% 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}}%
+ \gre@trace@end%
}%
% is last glyph a cavum?
@@ -2100,16 +2363,18 @@
% 2 if previous glyph is a cavum (which is the most interesting information)
\gre@count@lastglyphiscavum=0
-% the argument is the character with which we fill the hole, and we suppose that
+% #1 is the character with which we fill the hole, and we suppose that
% isonaline and glyphraisevalue are correctly set.
-\def\gre@fillhole#1{%
+% #2 is 0 for alteration or 1 for normal cavum
+\def\gre@fillhole#1#2{%
+ \gre@trace{gre@fillhole{#1}{#2}}%
\ifgre@boxing\else %
\global\gre@count@lastglyphiscavum=1\relax %
\setbox\gre@box@temp@sign=\hbox{#1}%
+ \ifcase#2\raise \gre@dimen@glyphraisevalue\fi%
\hbox to 0pt{%
{%
\color{grebackgroundcolor}%
- \raise \gre@dimen@glyphraisevalue%
\copy\gre@box@temp@sign %
}%
%\pdfliteral{}% this is a ugly hack for old versions of LuaTeX to work
@@ -2118,6 +2383,7 @@
\GreNoBreak %
\fi %
\relax %
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -2133,6 +2399,7 @@
% #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{%
+ \gre@trace{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 %
@@ -2145,7 +2412,7 @@
\kern-\gre@skip@temp@one %
\gre@calculate@glyphraisevalue{#1}{0}{}%
\ifgre@hidealtlines %
- \gre@fillhole{#3}%
+ \gre@fillhole{#3}{0}%
\fi %
\raise \gre@dimen@glyphraisevalue%
\copy\gre@box@temp@width%
@@ -2168,115 +2435,153 @@
\directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}%
\fi %
\relax %
+ \gre@trace@end%
}%
% 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@trace{GreFlat{#1}{#2}{#3}{#4}{#5}}%
\gre@alteration{#1}{\gre@fontchar@flat}{\gre@fontchar@flathole}{#2}{#3}{#4}{#5}%
\relax%
+ \gre@trace@end%
}%
% Same as the one before, but for naturals.
\def\GreNatural#1#2#3#4#5{%
+ \gre@trace{GreNatural{#1}{#2}{#3}{#4}{#5}}%
\gre@alteration{#1}{\gre@fontchar@natural}{\gre@fontchar@naturalhole}{#2}{#3}{#4}{#5}%
\relax%
+ \gre@trace@end%
}%
% Same as the one before, but for sharps.
\def\GreSharp#1#2#3#4#5{%
+ \gre@trace{GreSharp{#1}{#2}{#3}{#4}{#5}}%
\gre@alteration{#1}{\gre@fontchar@sharp}{\gre@fontchar@sharphole}{#2}{#3}{#4}{#5}%
\relax%
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% macros for typesetting punctum cavum
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\def\gre@fontchar@punctumcavum{\gre@font@music\GreCPPunctumCavum}%
-\def\gre@fontchar@lineapunctumcavum{\gre@font@music\GreCPLineaPunctumCavum}%
-\def\gre@fontchar@punctumcavumhole{\gre@font@music\GreCPPunctumCavumHole}%
-\def\gre@fontchar@lineapunctumcavumhole{\gre@font@music\GreCPLineaPunctumCavumHole}%
-
\def\gresetpunctumcavum#1{%
+ \gre@trace{gresetpunctumcavum{#1}}%
\IfStrEqCase{#1}{%
{alternate}%
{%
- \grechangeglyph{PunctumCavum}{greciliae}{.caeciliae}%
- \grechangeglyph{LineaPunctumCavum}{greciliae}{.caeciliae}%
- \grechangeglyph{PunctumCavumHole}{greciliae}{.caeciliae}%
- \grechangeglyph{LineaPunctumCavumHole}{greciliae}{.caeciliae}%
+ \grechangecavumglyph{Punctum}{greciliae-hollow}{.caeciliae}[greciliae-hole][.caeciliae]%
+ \grechangecavumglyph{LineaPunctum}{greciliae-hollow}{.caeciliae}[greciliae-hole][.caeciliae]%
}%
{normal}%
{%
- \greresetglyph{PunctumCavum}%
- \greresetglyph{LineaPunctumCavum}%
- \greresetglyph{PunctumCavumHole}%
- \greresetglyph{LineaPunctumCavumHole}%
+ \greresetcavumglyph{Punctum}%
+ \greresetcavumglyph{LineaPunctum}%
}%
}[% all other cases
\gre@error{Unrecognized option "#1" for \protect\gresetpunctumcavum\MessageBreak Possible options are: 'alternate' and 'normal'}%
]%
+ \gre@trace@end%
}%
-
-\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}{}%
+\def\GreCavum#1{%
+ \gre@trace{GreCavum{#1}}%
\ifgre@hidepclines%
- \gre@fillhole{#8}%
+ \gre@fillhole{{\gre@font@music@hole\csname GreHoleCP#1\endcsname}}{1}%
\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}%
-}%
-
-\def\GreLineaPunctumCavum#1#2#3#4#5#6{%
- \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}%
-}%
-
-\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}%
-}%
-
-\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\GreOriscusCavumAuctus#1#2#3#4#5#6{%
- \gre@char@cavum{#1}{#2}{#3}{#4}{#5}{#6}%
- {\gre@font@music\GreCPOriscusCavumReversus}{\gre@font@music\GreCPOriscusCavumReversusHole}%
+ {\gre@font@music@hollow\csname GreHollowCP#1\endcsname}%
+ \gre@trace@end%
}%
-\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}%
+% #1 is 0 for left or 1 for right bracket
+% #2 is the height of the lowest note within the brackets
+% #3 is the height of the highest note within the brackets
+% #4 is the point-and-click string
+\def\GreBracket#1#2#3#4{%
+ \gre@trace{GreBracket{#1}{#2}{#3}{#4}}%
+ \gre@newglyphcommon %
+ \ifcase\numexpr#1\relax\else\GreNoBreak\fi% no break before right bracket
+ \setbox\gre@box@temp@width=\hbox{\gre@pointandclick{\gre@font@music %
+ \csname GreCPBracket%
+ \ifcase\numexpr#1\relax Left\else Right\fi%
+ % Logic:
+ % if low pitch is on a line or below the staff:
+ % if high pitch is on a line or above the staff:
+ % use short bracket
+ % else:
+ % use normal bracket
+ % else:
+ % if high pitch is on a line or above the staff:
+ % use normal bracket
+ % else:
+ % use long bracket
+ \ifnum\numexpr#2\relax>\numexpr\gre@pitch@belowstaff\relax % low pitch not below staff
+ % numexpr+/ rounds rather than truncates
+ \ifnum\numexpr#2/2\relax=\numexpr(#2+1)/2\relax % =odd, low pitch not on a line
+ \ifnum\numexpr#3\relax<\numexpr\gre@pitch@abovestaff\relax % high pitch not above staff
+ \ifnum\numexpr#3/2\relax=\numexpr(#3+1)/2\relax % =odd, high pitch not on a line
+ Long%
+ \fi %
+ \fi %
+ \else % =even, low pitch on a line
+ \ifnum\numexpr#3\relax<\numexpr\gre@pitch@abovestaff\relax % high pitch not above staff
+ \ifnum\numexpr#3/2\relax=\numexpr(#3+1)/2\relax\else % =even, high pitch on a line
+ Short%
+ \fi %
+ \else % high pitch above staff
+ Short%
+ \fi %
+ \fi %
+ \else % low pitch below staff
+ % same as above!
+ \ifnum\numexpr#3\relax<\numexpr\gre@pitch@abovestaff\relax % high pitch not above staff
+ \ifnum\numexpr#3/2\relax=\numexpr(#3+1)/2\relax\else % =even, high pitch on a line
+ Short%
+ \fi %
+ \else % high pitch above staff
+ Short%
+ \fi %
+ \fi %
+ \ifcase\numexpr#3-#2\relax %
+ Zero%
+ \or One%
+ \or Two%
+ \or Three%
+ \or Four%
+ \or Five%
+ \or Six%
+ \or Seven%
+ \or Eight%
+ \or Nine%
+ \or Ten%
+ \or Eleven%
+ \or Twelve%
+ \or Thirteen%
+ \or Fourteen%
+ \fi%
+ \endcsname %
+ }{#4}}%
+ \global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width %
+ \gre@calculate@glyphraisevalue{#2}{17}{}%
+ \raise\gre@dimen@glyphraisevalue%
+ \copy\gre@box@temp@width%
+ \ifcase\numexpr#1\relax
+ \GreNoBreak% no break after left bracket
+ \ifgre@firstglyph%
+ \gre@debugmsg{bolshift}{making adjustments for leading bracket}%
+ \global\advance\gre@dimen@notesaligncenter by \wd\gre@box@temp@width\relax %
+ \global\gre@dimen@bolextra = \wd\gre@box@temp@width\relax%
+ \gre@debugmsg{bolshift}{bolextra: \the\gre@dimen@bolextra}%
+ \fi %
+ \GreNoBreak% no break after left bracket
+ \fi %
+ \directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}%
+ \gre@endofglyphcommon %
+ \relax%
+ \gre@trace@end%
}%
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex
index f95a73d9174..2fdcf1b864a 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex
@@ -1,6 +1,6 @@
%GregorioTeX file.
%
-% Copyright (C) 2007-2016 The Gregorio Project (see CONTRIBUTORS.md)
+% Copyright (C) 2007-2017 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
@@ -19,8 +19,7 @@
% this file contains definitions of spaces
-\gre@debugmsg{general}{Loading gregoriotex-spaces.tex}%
-\gre@declarefileversion{gregoriotex-spaces.tex}{4.1.5}% GREGORIO_VERSION
+\gre@declarefileversion{gregoriotex-spaces.tex}{5.0.1}% GREGORIO_VERSION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% macros for tuning penalties
@@ -29,41 +28,69 @@
%% 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%
+\newskip\gre@saved@parskip%
+\newskip\gre@saved@lineskip%
+\newskip\gre@saved@baselineskip%
+\newskip\gre@saved@lineskiplimit%
%% 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 %
+ \gre@trace{gre@cancelpenalties}%
+ \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 %
+ %
+ \global\gre@saved@parskip=\parskip%
+ \global\gre@saved@lineskip=\lineskip%
+ \global\gre@saved@baselineskip=\baselineskip%
+ \global\gre@saved@lineskiplimit=\lineskiplimit%
+ \hyphenpenalty=\gre@space@count@hyphenpenalty %
+ \exhyphenpenalty=\gre@space@count@hyphenpenalty %
\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 %
+ \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 %
+ \parskip=\gre@space@skip@parskip%
+ \lineskip=\gre@space@skip@lineskip%
+ \baselineskip=\gre@space@skip@baselineskip%
+ \lineskiplimit=\gre@space@skip@lineskiplimit%
+ \gre@trace@end%
}%
\def\gre@restorepenalties{%
+ \gre@trace{gre@restorepenalties}%
\hyphenpenalty=\gre@hyphenpenaltysave %
\exhyphenpenalty=\gre@exhyphenpenaltysave %
\doublehyphendemerits=\gre@doublehyphendemeritssave %
@@ -75,6 +102,11 @@
\emergencystretch=\gre@emergencystretchsave %
\widowpenalty=\gre@widowpenaltysave %
\clubpenalty=\gre@clubpenaltysave %
+ \parskip=\gre@saved@parskip%
+ \lineskip=\gre@saved@lineskip%
+ \baselineskip=\gre@saved@baselineskip%
+ \lineskiplimit=\gre@saved@lineskiplimit%
+ \gre@trace@end%
}%
@@ -91,21 +123,27 @@
% 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@trace{gre@calculate@textlower}%
\gre@dimen@textlower=\gre@space@dimen@spacebeneathtext\relax%
%\advance\gre@dimen@textlower by \translationheight
+ \gre@trace@end%
}%
% 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@trace{gre@calculate@stafflinewidth}%
\gre@dimen@stafflinewidth=\gre@dimen@linewidth\relax%
+ \gre@trace@end%
}%
% linewidth is the width of a line of a score (including the initial)
\newdimen\gre@dimen@linewidth\relax%
\def\gre@calculate@linewidth{%
+ \gre@trace{gre@calculate@linewidth}%
\gre@dimen@linewidth=\hsize %
+ \gre@trace@end%
}%
% Messing with the staff line thickness directly is messy, so we provide the following interface to make life easier on the user:
@@ -113,27 +151,33 @@
% = 1500 * stafflinefactor
\newdimen\gre@dimen@stafflineheight\relax%
\def\gre@calculate@stafflineheight{%
+ \gre@trace{gre@calculate@stafflineheight}%
\global\gre@dimen@stafflineheight=\dimexpr(1500 sp * \gre@stafflinefactor)\relax %
+ \gre@trace@end%
}%
% 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{%
+ \gre@trace{gre@calculate@interstafflinespace}%
\global\gre@dimen@interstafflinespace=\dimexpr((31500sp * \gre@factor) %
- \gre@dimen@stafflineheight)\relax%
+ \gre@trace@end%
}%
% 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{%
+ \gre@trace{gre@calculate@stafflinediff}%
\global\gre@dimen@stafflinediff = \dimexpr(%
( ( ( \gre@dimen@stafflineheight %
/ \gre@factor)%
- 1500sp)%
/ 2)%
* \gre@factor)\relax%
+ \gre@trace@end%
}%
% the default factor
@@ -149,14 +193,12 @@
\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{%
+ \gre@trace{gre@calculate@constantglyphraise}%
\global\gre@dimen@constantglyphraise = \dimexpr((-22000 sp * \gre@factor) %
+ \gre@dimen@additionalbottomspace %
+ \gre@space@dimen@spacebeneathtext %
@@ -169,16 +211,19 @@
% an adjustment in the case of big lines
+ \gre@dimen@stafflinediff)\relax%
\relax %
+ \gre@trace@end%
}%
%% Here is the function to compute some more vertical spaces from the basic values
\newdimen\gre@dimen@staffheight\relax%
\def\gre@calculate@staffheight{%
+ \gre@trace{gre@calculate@staffheight}%
\global\gre@dimen@staffheight = \dimexpr %
\gre@stafflines\gre@dimen@stafflineheight %
+ \gre@stafflines\gre@dimen@interstafflinespace %
- \gre@dimen@interstafflinespace\relax%
\relax %
+ \gre@trace@end%
}%
% A routine that simply aggregates the above global space calculating routines so we can easily update all when needed.
@@ -193,6 +238,7 @@
%% staffheight: stafflineheight & interstafflinespace
%% constantglyphraise: gre@factor, additionalbottomspace, spacebeneathtext, spacelinestext, interstafflinespace, stafflineheight, currenttranslationheight, stafflinediff
\def\gre@computespaces{%
+ \gre@trace{gre@computespaces}%
\gre@calculate@textlower%
\gre@calculate@linewidth%
\gre@calculate@stafflinewidth%
@@ -201,6 +247,7 @@
\gre@calculate@stafflinediff%
\gre@calculate@staffheight%
\gre@calculate@constantglyphraise%
+ \gre@trace@end%
}%
\newskip\gre@skip@syllablefinalskip
@@ -241,6 +288,7 @@
%% min_shift_notes = min_dist_notes - cur_dist_notes
%% shift = max(min_shift_text, min_shift_notes)
\def\gre@calculate@syllablefinalskip#1#2{%
+ \gre@trace{gre@calculate@syllablefinalskip{#1}{#2}}%
%% min_text_dist = prev_cur_word ? 0 : space_inter_words
\ifnum#1=1\relax %
\ifgre@in@euouae %
@@ -346,6 +394,7 @@
\fi %
\gre@debugmsg{syllablespacing}{ syllablefinalskip = \the\gre@skip@syllablefinalskip}%
\relax %
+ \gre@trace@end%
}
% dimen keeping the shift computed with next function
@@ -360,6 +409,7 @@
%%
%% @arg#1 \gre@dimen@begindifference of the first syllable of the line
\def\gre@calculate@bolshift#1{%
+ \gre@trace{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
@@ -370,6 +420,14 @@
\else%
\global\advance\gre@skip@temp@three by \gre@dimen@bolextra\relax%
\fi%
+ \gre@debugmsg{bolshift}{ clefwidthcurrent = \the\gre@dimen@clefwidth@current}%
+ \gre@debugmsg{bolshift}{ clefwidthbol = \the\gre@dimen@clefwidth@bol}%
+ % we ignore the current-bol adjustment if the clef is the first of the score and there is an initial on one line:
+ \ifnum\gre@initiallines=1\ifgre@beginningofscore\else %
+ \global\advance\gre@skip@temp@three by \dimexpr(\gre@dimen@clefwidth@current-\gre@dimen@clefwidth@bol)\relax %
+ \fi\else %
+ \global\advance\gre@skip@temp@three by \dimexpr(\gre@dimen@clefwidth@current-\gre@dimen@clefwidth@bol)\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%
@@ -381,7 +439,7 @@
% 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@skip@temp@one = \glueexpr(\gre@dimen@clefwidth@current %
+ \gre@space@skip@spaceafterlineclef %
- \gre@space@dimen@minimalspaceatlinebeginning)\relax %
\ifdim\gre@skip@temp@three < \gre@skip@temp@one %
@@ -392,61 +450,180 @@
\fi%
\gre@debugmsg{bolshift}{ bolshift = \the\gre@dimen@bolshift}%
\relax %
+ \gre@trace@end%
}
-% dimen keeping the shift computed with next function
-\newdimen\gre@dimen@eolshift
-\newcount\gre@count@protrusion@hyphen@eol %
+% the width of the current
+\newdimen\gre@dimen@clefwidth@current\relax%
+% the width of the max clef
+\newdimen\gre@dimen@clefwidth@largest\relax%
+% the width to compute bolshift with
+\newdimen\gre@dimen@clefwidth@bol\relax%
+
+\def\gre@update@clefwidth@current#1{%
+ \gre@trace{gre@update@clefwidth@current{#1}}%
+ \gre@debugmsg{bolshift}{ updating clefwidthcurrent to \the\gre@dimen@clefwidth@current}%
+ \global\gre@dimen@clefwidth@current=#1\relax %
+ \ifnum\gre@bolshiftcleftypelocal=2\relax %
+ \global\gre@dimen@clefwidth@bol=#1\relax %
+ \fi %
+ \relax %
+ \gre@trace@end%
+}
-% protrusion for hyphens inerted by Lua
-\gre@count@protrusion@hyphen@eol = 50\relax
+\def\gre@update@clefwidth@largest#1{%
+ \gre@trace{gre@update@clefwidth@largest{#1}}%
+ \global\gre@dimen@clefwidth@largest=#1\relax %
+ \ifnum\gre@bolshiftcleftypelocal=1\relax %
+ \global\gre@dimen@clefwidth@bol=#1\relax %
+ \fi %
+ \gre@trace@end%
+}
-\def\gresethyphenprotrusion#1{%
- \gre@count@protrusion@hyphen@eol = #1\relax %
- \relax %
+\def\gre@update@clefwidth@forced#1{%
+ \gre@trace{gre@update@clefwidth@forced{#1}}%
+ \global\gre@dimen@clefwidth@bol=#1\relax %
+ \gre@trace@end%
}
+% 1 for largest, 2 for current and 3 for forced
+\xdef\gre@bolshiftcleftypeglobal{1}
+\xdef\gre@bolshiftcleftypelocal{1}
+
+\def\grebolshiftcleftype#1{
+ \IfStrEqCase{#1}{%
+ {largest}%
+ {\xdef\gre@bolshiftcleftypeglobal{1}\xdef\gre@bolshiftcleftypelocal{1}}%
+ {current}%
+ {\xdef\gre@bolshiftcleftypeglobal{2}\xdef\gre@bolshiftcleftypelocal{2}}%
+ }[% all other cases
+ \gre@error{Unrecognized option "#1" for \protect\grebolshiftcleftype\MessageBreak Possible options are: 'largest' and 'current'.}%
+ ]%
+}
+
+\def\grelocalbolshiftcleftype#1{
+ \IfStrEqCase{#1}{%
+ {largest}%
+ {\xdef\gre@bolshiftcleftypelocal{1}%
+ \global\gre@dimen@clefwidth@bol=\gre@dimen@clefwidth@largest\relax }%
+ {current}%
+ {\xdef\gre@bolshiftcleftypelocal{2}%
+ \global\gre@dimen@clefwidth@bol=\gre@dimen@clefwidth@current\relax }%
+ {c}%
+ {\gre@boxclef{c}{3}{0}{1}{3}{c}{0}{3}%
+ \xdef\gre@bolshiftcleftypelocal{3}%
+ \gre@update@clefwidth@forced{\wd\gre@box@temp@width}}%
+ {f}%
+ {\gre@boxclef{f}{3}{0}{1}{3}{c}{0}{3}%
+ \xdef\gre@bolshiftcleftypelocal{3}%
+ \gre@update@clefwidth@forced{\wd\gre@box@temp@width}}%
+ {cb}%
+ {\gre@boxclef{c}{3}{0}{1}{8}{c}{0}{3}%
+ \xdef\gre@bolshiftcleftypelocal{3}%
+ \gre@update@clefwidth@forced{\wd\gre@box@temp@width}}%
+ {fb}%
+ {\gre@boxclef{f}{3}{0}{1}{8}{c}{0}{3}%
+ \xdef\gre@bolshiftcleftypelocal{3}%
+ \gre@update@clefwidth@forced{\wd\gre@box@temp@width}}%
+ }[% all other cases
+ \gre@error{Unrecognized option "#1" for \protect\grelocalbolshiftcleftype\MessageBreak Possible options are: 'largest', 'current', 'c', 'f', 'cb' and 'fb'.}%
+ ]%
+}
+
+\def\GreProtrusionFactor#1{\csname gre@protrusionfactor@#1\endcsname}%
+
+\def\gresetprotrusionfactor#1#2{%
+ \IfStrEqCase{#1}{%
+ {,}{\def\gre@protrusionfactor@comma{#2}}%
+ {;}{\def\gre@protrusionfactor@semicolon{#2}}%
+ {:}{\def\gre@protrusionfactor@colon{#2}}%
+ {.}{\def\gre@protrusionfactor@period{#2}}%
+ {eolhyphen}{\def\gre@protrusionfactor@eolhyphen{#2}}%
+ {default}{\def\gre@protrusionfactor@default{#2}}%
+ }[%
+ \gre@error{Unrecognized protrusion "#1" for \protect\gresetprotrusionfactor\MessageBreak Possible options are: ',', ';', ':', '.', 'eolhyphen', and\MessageBreak 'default'}%
+ ]%
+}%
+
+\def\GreProtrusion#1#2{%
+ \gre@widthof{#2}%
+ \IfStrEq{#1}{d}{% d = default
+ \gre@dimen@temp@four=\dimexpr(\gre@dimen@temp@three-\gre@protrusionfactor@default\gre@dimen@temp@three)\relax %
+ }{%
+ \gre@dimen@temp@four=\dimexpr(\gre@dimen@temp@three-#1\gre@dimen@temp@three)\relax %
+ }%
+ \ifdim\gre@dimen@temp@four<0pt\relax %
+ \gre@warning{protrusion factor may not be more than 1}%
+ \gre@dimen@temp@four=0pt\relax %
+ \fi %
+ \ifdim\gre@dimen@temp@four>\gre@dimen@temp@three\relax %
+ \gre@warning{protrusion factor may not be less than 0}%
+ \gre@dimen@temp@four=\gre@dimen@temp@three\relax %
+ \fi %
+ \hbox to \gre@dimen@temp@four{#2\hss}%
+}%
+
+\def\gresethyphenprotrusion#1{% DEPRECATED for removal in 5.1
+ \gre@deprecated{\protect\gresethyphenprotrusion{percentage}}{\protect\gresetprotrusionfactor{eolhyphen}{factor}}% DEPRECATED for removal in 5.1
+ \gresetprotrusionfactor{eolhyphen}{\directlua{tex.print(string.format(string.char(37)..'g', #1 / 100.0))}}% DEPRECATED for removal in 5.1
+}% DEPRECATED for removal in 5.1
+
+% dimen keeping the shift computed with next function
+\newdimen\gre@dimen@eolshift
+
%% @desc Macro used in \GreSyllable. Sets \gre@dimen@eolshift to the right kern
%% that should appear before an end of line. When active this prevents
%% text from going under the custos.
%%
%% @arg#1 The \gre@dimen@enddifference of the corresponding syllable
\def\gre@calculate@eolshift#1{%
+ \gre@trace{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 %
+ % dimen@temp@three is the length of the hyphen at the end of the syllable
+ \gre@dimen@temp@three=0pt\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}%
+ \gre@dimen@temp@three=\dimexpr(\wd\gre@box@temp@width-\gre@protrusionfactor@eolhyphen\wd\gre@box@temp@width)\relax%
+ \gre@debugmsg{eolshift}{widthof the potential hyphen: \the\gre@dimen@temp@three}%
+ \fi %
+ % The basic value for the eol shift is -enddifference + width of the hyphen
+ \gre@skip@temp@two=\glueexpr(\gre@dimen@temp@three-\the #1)\relax%
+ \gre@debugmsg{eolshift}{adjusted enddifference: \the\gre@skip@temp@two}%
+ % if tex+hyphen goes further than the notes:
+ \ifdim\gre@skip@temp@two>0pt\relax%
+ \gre@skip@temp@three = 0pt%
+ \ifgre@blockeolcustos\else%
% 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}}%
+ \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 %
+ \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 = \glueexpr(\gre@skip@temp@three-\gre@dimen@temp@three)\relax %
+ \else%
+ \ifdim\gre@skip@temp@two<\gre@dimen@temp@three %
+ \global\gre@dimen@eolshift = \gre@skip@temp@two\relax %
+ \else %
+ \global\gre@dimen@eolshift = \glueexpr(\gre@skip@temp@two-\gre@dimen@temp@three)\relax %
+ \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 %
+ \gre@trace@end%
}
%%%%%%%%%%%%%%%%%%%
@@ -480,14 +657,18 @@
\ifgre@useledgerlineheuristic\gre@ledgerline@belowtrue\fi %
}%
\def\gre@resetledgerlineheuristics{%
+ \gre@trace{gre@resetledgerlineheuristics}%
\gre@ledgerline@abovetrue\gre@ledgerline@belowtrue %
+ \gre@trace@end%
}%
\def\gre@prephepisemaledgerlineheuristics{%
+ \gre@trace{gre@prephepisemaledgerlineheuristics}%
\ifgre@useledgerlineheuristic %
\gre@ledgerline@abovefalse\gre@ledgerline@belowfalse %
\else %
\gre@ledgerline@abovetrue\gre@ledgerline@belowtrue %
\fi %
+ \gre@trace@end%
}%
% 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.
@@ -508,6 +689,7 @@
%% 14: punctum mora in a space with a note on the line below it
%% 15: over slur
%% 16: under slur
+%% 17: bracket
% #3, for horizontal episemata, is the interline position:
%% 0: auto
%% 1: middle
@@ -516,6 +698,7 @@
%% 4: low in space below note
%% 5: high in space below note
\def\gre@calculate@glyphraisevalue#1#2#3{%
+ \gre@trace{gre@calculate@glyphraisevalue{#1}{#2}{#3}}%
\global\gre@isonalinefalse%
\ifcase#1%
% the first two cases are special cases for episemae on the lowest note
@@ -691,8 +874,19 @@
\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%
+ \or% 17: bracket
+ \ifgre@isonaline %
+ \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@bracketupshift\relax%
+ \else %
+ \ifnum#1>\gre@pitch@belowstaff\relax % #1 is not below staff
+ \global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@bracketdownshift\relax%
+ \else % #1 is below staff
+ \global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@bracketupshift\relax%
+ \fi %
+ \fi %
\fi%
\global\advance\gre@dimen@glyphraisevalue by \the\gre@dimen@constantglyphraise\relax%
+ \gre@trace@end%
}%
% two dimensions for the additionalspaces
@@ -701,34 +895,110 @@
\newdimen\gre@dimen@additionaltopspace\relax%
% the one taken into account for above lines text height
\newdimen\gre@dimen@additionaltopspacealt\relax%
+% the one taken into account for above lines nabc height
+\newdimen\gre@dimen@additionaltopspacenabc\relax%
+
+% backup demensions for the previous
+\newdimen\gre@saved@dimen@additionalbottomspace\relax%
+\newdimen\gre@saved@dimen@additionaltopspace\relax%
+\newdimen\gre@saved@dimen@additionaltopspacealt\relax%
+\newdimen\gre@saved@dimen@additionaltopspacenabc\relax%
+\newdimen\gre@saved@dimen@currenttranslationheight\relax%
+\newdimen\gre@saved@dimen@textlower\relax%
+\newdimen\gre@saved@dimen@currentabovelinestextheight\relax%
+\newdimen\gre@saved@dimen@constantglyphraise\relax%
\newcount\gre@space@count@additionaltopspacethreshold\relax%
\gre@space@count@additionaltopspacethreshold=2
\newcount\gre@space@count@additionaltopspacealtthreshold\relax%
-\gre@space@count@additionaltopspacethreshold=0
+\gre@space@count@additionaltopspacealtthreshold=0
+
+\newcount\gre@space@count@additionaltopspacenabcthreshold\relax%
+\gre@space@count@additionaltopspacenabcthreshold=4
+
+\newcount\gre@space@count@noteadditionalspacelinestextthreshold\relax%
+\gre@space@count@noteadditionalspacelinestextthreshold=2
+
+\def\gre@num@min#1#2{%
+ \gre@trace{gre@num@min{#1}{#2}}%
+ \ifnum#1 < #2\relax %
+ \gre@count@temp@one=#1\relax %
+ \else %
+ \gre@count@temp@one=#2\relax %
+ \fi %
+ \gre@trace@end%
+}%
+\def\gre@num@max#1#2{%
+ \gre@trace{gre@num@max{#1}{#2}}%
+ \ifnum#1 > #2\relax %
+ \gre@count@temp@one=#1\relax %
+ \else %
+ \gre@count@temp@one=#2\relax %
+ \fi %
+ \gre@trace@end%
+}%
+
+\def\gre@save@additionalspaces{%
+ \gre@trace{gre@save@additionalspaces}%
+ \global\gre@saved@dimen@additionalbottomspace=\gre@dimen@additionalbottomspace\relax%
+ \global\gre@saved@dimen@additionaltopspace=\gre@dimen@additionaltopspace\relax%
+ \global\gre@saved@dimen@additionaltopspacealt=\gre@dimen@additionaltopspacealt\relax%
+ \global\gre@saved@dimen@additionaltopspacenabc=\gre@dimen@additionaltopspacenabc\relax%
+ \global\gre@saved@dimen@currenttranslationheight=\gre@dimen@currenttranslationheight\relax%
+ \global\gre@saved@dimen@textlower=\gre@dimen@textlower\relax%
+ \global\gre@saved@dimen@currentabovelinestextheight=\gre@dimen@currentabovelinestextheight\relax%
+ \global\gre@saved@dimen@constantglyphraise=\gre@dimen@constantglyphraise\relax%
+ \gre@trace@end%
+}%
+
+\def\gre@restore@additionalspaces{%
+ \gre@trace{gre@restore@additionalspaces}%
+ \global\gre@dimen@additionalbottomspace=\gre@saved@dimen@additionalbottomspace\relax%
+ \global\gre@dimen@additionaltopspace=\gre@saved@dimen@additionaltopspace\relax%
+ \global\gre@dimen@additionaltopspacealt=\gre@saved@dimen@additionaltopspacealt\relax%
+ \global\gre@dimen@additionaltopspacenabc=\gre@saved@dimen@additionaltopspacenabc\relax%
+ \global\gre@dimen@currenttranslationheight=\gre@saved@dimen@currenttranslationheight\relax%
+ \global\gre@dimen@textlower=\gre@saved@dimen@textlower\relax%
+ \global\gre@dimen@currentabovelinestextheight=\gre@saved@dimen@currentabovelinestextheight\relax%
+ \global\gre@dimen@constantglyphraise=\gre@saved@dimen@constantglyphraise\relax%
+ \gre@trace@end%
+}%
+
+\let\gre@pitch@cleftop\gre@pitch@dummy %
+\let\gre@pitch@clefbottom\gre@pitch@dummy %
% #1 is the high height
% #2 is the low height
% #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 %
+ \gre@trace{gre@calculate@additionalspaces{#1}{#2}{#3}{#4}}%
+ \gre@num@max{#1}{\gre@pitch@cleftop}%
+ \gre@count@temp@one=\numexpr(\gre@count@temp@one - \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 %
+ \gre@num@max{#1}{\gre@pitch@cleftop}%
+ \gre@count@temp@one=\numexpr(\gre@count@temp@one - \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 %
+ \gre@num@max{#1}{\gre@pitch@cleftop}%
+ \gre@count@temp@one=\numexpr(\gre@count@temp@one - \gre@pitch@adjust@top - \gre@space@count@additionaltopspacenabcthreshold)\relax %
\ifnum\gre@count@temp@one>0\relax %
- \global\gre@dimen@additionalbottomspace=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax %
+ \global\gre@dimen@additionaltopspacenabc=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax %
+ \else %
+ \global\gre@dimen@additionaltopspacenabc=0 sp%
+ \fi %
+ \gre@num@min{#2}{\gre@pitch@clefbottom}%
+ \gre@count@temp@one=\numexpr(\gre@pitch@adjust@bottom - \gre@count@temp@one)\relax %
+ \ifnum\gre@count@temp@one>0\relax %
+ \global\gre@dimen@additionalbottomspace=\dimexpr(\gre@space@dimen@noteadditionalspacelinestext * \gre@count@temp@one)\relax %
\else %
\global\gre@dimen@additionalbottomspace=0 sp%
\fi %
@@ -745,6 +1015,7 @@
\gre@generatelines %
\gre@calculate@constantglyphraise %
\relax %
+ \gre@trace@end%
}%
%% 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
@@ -754,21 +1025,23 @@
\newdimen\gre@dimen@textaligncenter\relax%
-\def\gre@calculate@textaligncenter#1#2#3{%
- \ifnum#3=0\relax%
- \gre@widthof{\gre@fixedtextformat{#1#2}}%
+\def\gre@calculate@textaligncenter#1#2#3#4{%
+ \gre@trace{gre@calculate@textaligncenter{#1}{#2}{#3}{#4}}%
+ \ifnum#4=0\relax%
+ \gre@widthof{\gre@save@fixedtextformat{#1}\gre@fixedtextformat{#2#3}}%
\else %
- \gre@widthof{\gre@fixednexttextformat{#1#2}}%
+ \gre@widthof{\gre@fixedtextformat{#1}\gre@fixednexttextformat{#2#3}}%
\fi %
\global\gre@dimen@textaligncenter=\the\gre@dimen@temp@three %
- \ifnum#3=0\relax%
- \gre@widthof{\gre@fixedtextformat{#2}}%
+ \ifnum#4=0\relax%
+ \gre@widthof{\gre@fixedtextformat{#3}}%
\else %
- \gre@widthof{\gre@fixednexttextformat{#2}}%
+ \gre@widthof{\gre@fixednexttextformat{#3}}%
\fi %
\divide\gre@dimen@temp@three by 2 %
\global\advance\gre@dimen@textaligncenter by -\the\gre@dimen@temp@three%
\relax%
+ \gre@trace@end%
}%
% 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 +1059,13 @@
% #4: notesaligncenter (defined above too)
% #5: if we have to set previousenddifference or not
\def\gre@calculate@enddifference#1#2#3#4#5{%
+ \gre@trace{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%
+ \gre@trace@end%
}%
% temporary value for space for the translation, beneath the text
@@ -798,51 +1073,52 @@
% macro to tell gregorio to set space for the translation
\def\gre@addtranslationspace{%
+ \gre@trace{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@trace@end%
}%
\def\gre@removetranslationspace{%
+ \gre@trace{gre@removetranslationspace}%
\global\gre@dimen@currenttranslationheight=0 sp%
\global\gre@dimen@textlower=\gre@space@dimen@spacebeneathtext\relax%
- \gre@generatelines %
- \gre@calculate@constantglyphraise %
\relax %
+ \gre@trace@end%
}%
%nextbegindifference is the begindifference of the next syllable
\newskip\gre@skip@nextbegindifference\relax%
% macro to set nextbegindifference
-%% 1 : the first letters of the next syllable
-%% 2 : the middle letters of the next syllable
-%% 3 : the end letters of the next syllable
-%% 4 : the type of notes alignment
-\def\gre@calculate@nextbegindifference#1#2#3#4{%
+%% 1 : the carry-over letters for the next syllable
+%% 2 : the first letters of the next syllable
+%% 3 : the middle letters of the next syllable
+%% 4 : the end letters of the next syllable
+%% 5 : the type of notes alignment
+\def\gre@calculate@nextbegindifference#1#2#3#4#5{%
+ \gre@trace{gre@calculate@nextbegindifference{#1}{#2}{#3}{#4}{#5}}%
\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}%
+ \gre@calculate@textaligncenter{#1}{#2}{#3}{1}%
+ \gre@dimen@temp@four=\gre@dimen@notesaligncenter\relax%
\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
+ % caution: calculate@nextnotesaligncenter needs a properly set \gre@dimen@textaligncenter
+ % (corresponding to the text align center of the next syllable)
+ \gre@calculate@nextnotesaligncenter{#5}% idem
\global\advance\gre@skip@nextbegindifference by \the\gre@dimen@notesaligncenter\relax%
- \global\gre@dimen@notesaligncenter=\gre@dimen@temp@two %
+ \global\gre@dimen@textaligncenter=\gre@dimen@temp@two %
+ \global\gre@dimen@notesaligncenter=\gre@dimen@temp@four %
\fi %
\relax %
+ \gre@trace@end%
}%
%The distance from the baseline of the line to the baseline of the annotations
@@ -850,7 +1126,7 @@
% 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.}%
+ \gre@trace{gre@calculate@annotationtrueraise}%
\global\advance\gre@dimen@annotationtrueraise by %
\dimexpr(\gre@dimen@staffheight %
+ \gre@space@dimen@spacebeneathtext %
@@ -859,15 +1135,17 @@
+ \gre@dimen@additionalbottomspace)\relax%
\gre@style@annotation%
\global\advance\gre@dimen@annotationtrueraise by \gre@space@dimen@annotationraise\relax%
- \gre@debugmsg{annnotation}{Added user raise.}%
+ \gre@debugmsg{annotation}{Added user raise.}%
\endgre@style@annotation%
\relax %
+ \gre@trace@end%
}%
%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@trace{gre@calculate@commentarytrueraise}%
\gre@style@commentary%
\gre@debugmsg{commentary}{Calculating the raise.}%
\global\advance\gre@dimen@commentarytrueraise by %
@@ -878,6 +1156,7 @@
+ \gre@dimen@additionalbottomspace %
+ \gre@space@dimen@commentaryraise)\relax%
\endgre@style@commentary%
+ \gre@trace@end%
}%
% spaces for new bar positioning algorithm
@@ -888,7 +1167,9 @@
\newskip\gre@skip@text@allocation% amount of space allocated to the text
\newdimen\gre@dimen@text@shift% displacement from center of the text’s position
\newdimen\gre@dimen@adjustedpreviousenddifference% previousenddifference adjusted to account for the presence of a punctum mora at the end of the pervious syllable
+\newdimen\gre@skip@adjustednextbegindifference% idem, nextbegindifference taking into account the presence of an alteration at the beginning of next syllable
\newskip\gre@skip@punctummorashift% displacement of whole syllable to account for the presence of a punctum mora at the end of the previous syllable
+\newskip\gre@skip@alterationshift % idem for alteration at the beginning of next syllable
%
% New bar spacing algorithm
@@ -897,46 +1178,13 @@
% #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{%
+ \gre@trace{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 %
+ \gre@punctummoraadjustment%
+ % recomputing \gre@dimen@nextbegindifference into \gre@dimen@adjustednextdifference
+ \gre@alterationadjustment{#2}%
\ifdim\gre@dimen@adjustedpreviousenddifference > 0pt\relax%
% the notes ended after the text in the previous syllable
\gre@skip@text@allocation = \gre@dimen@adjustedpreviousenddifference\relax%
@@ -946,14 +1194,14 @@
\gre@skip@text@allocation = 0pt\relax%
\gre@skip@bar@allocation = -\gre@dimen@adjustedpreviousenddifference\relax%
\fi%
- \ifdim\gre@skip@nextbegindifference > 0pt\relax%
+ \ifdim\gre@skip@adjustednextbegindifference > 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@text@allocation by \gre@skip@adjustednextbegindifference\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%
+ \advance\gre@skip@bar@allocation by -\gre@skip@adjustednextbegindifference\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}%
@@ -999,8 +1247,11 @@
\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@requirement=0pt\relax % no notes
+ \gre@skip@bar@requirement=\gre@space@skip@interwordspacenotes %
+ \fi %
+ \gre@debugmsg{barspacing}{bar width: \the\gre@skip@bar@requirement}%
\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%
@@ -1032,6 +1283,11 @@
\gre@dimen@temp@three=\gre@space@dimen@maxbaroffsettextleft@eol\relax%
\gre@dimen@temp@two=\gre@space@dimen@maxbaroffsettextright@eol\relax%
\fi%
+ % If the bar syllable is to be cleared from overlapping the previous syllable then we force the text and bar to be exactly aligned.
+ \ifgre@textcleared%
+ \gre@dimen@temp@three=0pt\relax%
+ \gre@dimen@temp@two=0pt\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,
@@ -1118,6 +1374,129 @@
\gre@debugmsg{barspacing}{Correcting syllablefinalskip}%
\gre@calculate@syllablefinalskip{#1}{\gre@count@temp@one}%
\gre@debugmsg{barspacing}{syllablefinalskip: \the\gre@skip@syllablefinalskip}%
+ \gre@trace@end%
+}%
+
+% alteration adjustment calculations
+\def\gre@alterationadjustment#1{%
+ \gre@trace{gre@alterationadjustment{#1}}%
+ % taking into account the punctum mora shift
+ \global\gre@skip@adjustednextbegindifference=\gre@skip@nextbegindifference %
+ % gre@skip@alterationshift is 0 or the punctum mora shift
+ \global\gre@skip@alterationshift=0pt\relax %
+ \ifnum#1>19\ifnum\gre@insidediscretionary=0\relax % next is a flat, we're not in a clef change
+ \advance\gre@skip@adjustednextbegindifference by -\gre@space@dimen@alterationadjustmentbar %
+ \global\gre@skip@alterationshift=\gre@space@dimen@alterationadjustmentbar\relax %
+ \gre@debugmsg{barspacing}{adjustment for alteration: \gre@space@dimen@alterationadjustmentbar}%
+ \gre@debugmsg{barspacing}{adjusted next begindifference (for alteration): \the\gre@skip@adjustednextbegindifference}%
+ \fi\fi %
+ \gre@trace@end%
+}
+
+%punctum mora adjustment calculations for bars
+\def\gre@punctummoraadjustment{%
+ \gre@trace{gre@punctummoraadjustment}%
+ % taking into account the punctum mora shift
+ \global\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 %
+ \gre@trace@end%
+}%
+
+% Clearing a syllable so it doesn't overlap with the previous one
+\def\gre@clearsyllable#1{%
+ \gre@trace{gre@clearsyllable{#1}}%
+ % because the way mora shifts are implemented is different for bars and
+ % notes, we have to use a different set of dimensions depending on which
+ % kind of syllable we're dealing with. We know this by looking at the
+ % argument of this function, which should be 'bar' for a bar syllable and 'note'
+ % for a note syllable.
+ \IfStrEq{#1}{bar}%
+ {%
+ \gre@debugmsg{clear}{adjustedpreviousenddifference = \the\gre@dimen@adjustedpreviousenddifference}%
+ \gre@dimen@temp@one=\gre@dimen@adjustedpreviousenddifference%
+ }%
+ {%
+ \gre@debugmsg{clear}{previousenddifference = \the\gre@dimen@previousenddifference}%
+ \gre@dimen@temp@one=\gre@dimen@previousenddifference%
+ }%
+ \gre@debugmsg{clear}{begindifference = \the\gre@dimen@begindifference}%
+ \gre@debugmsg{clear}{syllablefinalskip = \the\gre@skip@syllablefinalskip}%
+ \ifdim\gre@dimen@temp@one > 0pt\relax%
+ \ifdim\gre@dimen@begindifference < 0pt\relax%
+ \ifdim\gre@dimen@temp@one > -\gre@dimen@begindifference\relax%
+ \gre@debugmsg{clear}{Case 1}%
+ \kern -\gre@dimen@begindifference\relax%
+ \else%
+ \gre@debugmsg{clear}{Case 2}%
+ \kern \gre@dimen@temp@one\relax%
+ \fi%
+ \IfStrEq{#1}{note}%
+ {% when dealing with notes we may have already skipped
+ % forward some, in which case we need to account for that
+ \ifdim\gre@skip@syllablefinalskip > 0pt\relax%
+ \gre@debugmsg{clear}{undo syllablefinalskip}%
+ \kern -\gre@skip@syllablefinalskip\relax%
+ \fi%
+ }{}%
+ \else%
+ \gre@debugmsg{clear}{Syllable already clear}%
+ \fi%
+ \else%
+ \ifdim\gre@dimen@begindifference > 0pt\relax%
+ \ifdim-\gre@dimen@temp@one > \gre@dimen@begindifference\relax%
+ \gre@debugmsg{clear}{Case 3}%
+ \kern \gre@dimen@begindifference\relax%
+ \else%
+ \gre@debugmsg{clear}{Case 4}%
+ \kern -\gre@dimen@temp@one\relax%
+ \fi%
+ \IfStrEq{#1}{note}%
+ {% when dealing with notes we may have already skipped
+ % forward some, in which case we need to account for that
+ \ifdim\gre@skip@syllablefinalskip > 0pt\relax%
+ \gre@debugmsg{clear}{undo syllablefinalskip}%
+ \kern -\gre@skip@syllablefinalskip\relax%
+ \fi%
+ }{}%
+ \else%
+ \gre@debugmsg{clear}{Syllable already clear}%
+ \fi%
+ \fi%
+ \gre@trace@end%
}%
%%%%%%%%%%%%%%%%%%%
@@ -1129,9 +1508,6 @@
% begindifference is the difference between the beginning of the text and the beginning of the notes. Warning : it can be negative.
\newdimen\gre@dimen@begindifference\relax%
-% the width of the clef
-\newdimen\gre@dimen@clefwidth\relax%
-
% the width of the last glyph
\newdimen\gre@dimen@lastglyphwidth\relax%
@@ -1173,25 +1549,20 @@
%% 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}}%
+ {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{%
@@ -1206,49 +1577,53 @@
\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}}%
+ {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' and 'fixed'}]%
+ }[\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
+ \IfStrEqCase{#1}{% OBSOLETE
+ {spacearoundsmallbars}% OBSOLETE
+ {% OBSOLETE
+ \gre@obsolete{spacearoundsmallbars}{bar@virgula or bar@minima}% OBSOLETE
+ }% OBSOLETE
+ {spacearoundminor}% OBSOLETE
+ {% OBSOLETE
+ \gre@obsolete{spacearoundminor}{bar@minor}% OBSOLETE
+ }% OBSOLETE
+ {spacearoundmaior}% OBSOLETE
+ {% OBSOLETE
+ \gre@obsolete{spacearoundmaior}{bar@maior}% OBSOLETE
+ }% OBSOLETE
+ {spacearoundfinalis}% OBSOLETE
+ {% OBSOLETE
+ \gre@obsolete{spacearoundfinalis}{bar@finalis}% OBSOLETE
+ }% OBSOLETE
+ {spacebeforefinalfinalis}% OBSOLETE
+ {% OBSOLETE
+ \gre@obsolete{spacebeforfinalfinalis}{bar@finalfinalis}% OBSOLETE
+ }% OBSOLETE
+ }[% OBSOLETE
\gre@error{#1 is not a recognized distance.}% keep this line
- ]% DEPRECATED
+ ]% OBSOLETE
\fi%
}%
@@ -1258,63 +1633,173 @@
}
% 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.}%
+\def\gre@dimension#1#2#3{%
+ \gre@trace{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%
- \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}%
+ \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}}%
+ \directlua{gregoriotex.hash_spaces("\luatexluaescapestring{#1}", "\luatexluaescapestring{inherited from #2}")}%
+ }{%
+ \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%
- }{}%
- \expandafter\edef\csname gre@space@\gre@prefix @#1\endcsname{#2}%
- \relax %
+ \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}%
+ \directlua{gregoriotex.hash_spaces("\luatexluaescapestring{#1}", "\luatexluaescapestring{#2}")}%
+ \relax %
+ }%
+ \gre@trace@end%
}
%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}}%
+% same arguments as \grechangedim, but used for setting the dimension for a
+% single line
+\def\gre@changedimforline#1#2#3{%
+ \gre@trace{gre@changedimforline{#1}{#2}{#3}}%
+ \gre@rubberpermit{#1}%
+ \ifgre@rubber%
+ \def\gre@prefix{skip}%
+ \else%
+ \def\gre@prefix{dimen}%
+ \fi%
+ \directlua{%
+ gregoriotex.save_dim(%
+ "\luatexluaescapestring{#1}",%
+ "\luatexluaescapestring{\expandafter\unexpanded%
+ \expandafter\expandafter\expandafter{%
+ \csname gre@space@\gre@prefix @#1\endcsname%
+ }%
+ }",%
+ "\csname ifgre@scale@#1\endcsname scalable\else fixed\fi"%
+ )%
+ }%
+ \grechangedim{#1}{#2}{#3}%
+ \gre@trace@end%
+}%
+
+% #1 : line number
+% #2-#4 : same as #1-#3 of \grechangedim
+\def\grechangenextscorelinedim#1#2#3#4{%
+ \directlua{%
+ gregoriotex.change_next_score_line_dim(%
+ "\luatexluaescapestring{#1}",%
+ "\luatexluaescapestring{#2}",%
+ "\luatexluaescapestring{#3}",%
+ "\luatexluaescapestring{#4}"%
+ )%
+ }%
+}%
+
+% same arguments as \grechangecount, but used for setting the dimension for a
+% single line
+\def\gre@changecountforline#1#2{%
+ \gre@trace{gre@changecountforline{#1}{#2}}%
+ \directlua{%
+ gregoriotex.save_count(%
+ "\luatexluaescapestring{#1}",%
+ "\luatexluaescapestring{\expandafter\unexpanded%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\the\csname gre@space@count@#1\endcsname%
+ }%
+ }"%
+ )%
+ }%
+ \grechangecount{#1}{#2}%
+ \gre@trace@end%
+}%
+
+% #1 : line number
+% #2-#3 : same as #1-#2 of \grechangecount
+\def\grechangenextscorelinecount#1#2#3{%
+ \directlua{%
+ gregoriotex.change_next_score_line_count(%
+ "\luatexluaescapestring{#1}",%
+ "\luatexluaescapestring{#2}",%
+ "\luatexluaescapestring{#3}"%
+ )%
+ }%
}%
+\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 %
@@ -1339,6 +1824,7 @@
% 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{%
+ \gre@trace{gre@rubberpermit{#1}}%
% is length one that cannot be rubber?
\IfStrEqCase*{#1}{%
{additionallineswidth}{\gre@rubberfalse}%
@@ -1349,6 +1835,7 @@
{beforeinitialshift}{\gre@rubberfalse}%
{minimalspaceatlinebeginning}{\gre@rubberfalse}%
{manualinitialwidth}{\gre@rubberfalse}%
+ {minimalinitialwidth}{\gre@rubberfalse}%
{annotationseparation}{\gre@rubberfalse}%
{intersyllablespacenotes}{\gre@rubberfalse}%
{intersyllablespacenotes@alteration}{\gre@rubberfalse}%
@@ -1395,11 +1882,17 @@
{spaceporrectuspunctummorashift}{\gre@rubberfalse}%
{raresignshift}{\gre@rubberfalse}%
{divisiofinalissep}{\gre@rubberfalse}%
+ {alterationadjustmentbar}{\gre@rubberfalse}%
+ {bracketupshift}{\gre@rubberfalse}%
+ {bracketdownshift}{\gre@rubberfalse}%
+ {noteadditionalspacelinestext}{\gre@rubberfalse}%
}[\gre@rubbertrue]%
+ \gre@trace@end%
}%
%% an aux function adapting the value #1 from the factor #2 to the factor #3
\def\gre@changeonedimenfactor#1#2#3{%
+ \gre@trace{gre@changeonedimenfactor{#1}{#2}{#3}}%
% Math
\gre@rubberpermit{#1}%
\ifgre@rubber%
@@ -1416,21 +1909,24 @@
\gre@consistentunits{\gre@convert}{\gre@scaledist}%
\gre@dimension{#1}{\gre@stringdist}%
\relax %
+ \gre@trace@end%
}%
% 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)}%
+ \gre@trace{gre@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@trace@end%
}%
% 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@trace{gre@consistentunits{#1}{#2}}%
\gre@stretchfalse%
\gre@shrinkfalse%
\IfSubStr{#1}{plus}{\gre@stretchtrue}{\relax}%
@@ -1476,6 +1972,7 @@
\gre@convertto{\gre@shrinkunit}{\glueshrink#2}%
\edef\gre@stringdist{\gre@stringdist minus \gre@converted}%
\fi%
+ \gre@trace@end%
}%
@@ -1483,6 +1980,7 @@
%% 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{%
+ \gre@trace{gre@changedimenfactor{#1}{#2}}%
\ifgre@scale@additionallineswidth%
\gre@changeonedimenfactor{additionallineswidth}{#1}{#2}%
\fi%
@@ -1540,6 +2038,9 @@
\ifgre@scale@spaceafterlineclef%
\gre@changeonedimenfactor{spaceafterlineclef}{#1}{#2}%
\fi%
+ \ifgre@scale@shortspaceafterlineclef%
+ \gre@changeonedimenfactor{shortspaceafterlineclef}{#1}{#2}%
+ \fi%
\ifgre@scale@interwordspacenotes%
\gre@changeonedimenfactor{interwordspacenotes}{#1}{#2}%
\fi%
@@ -1633,9 +2134,15 @@
\ifgre@scale@bar@virgula%
\gre@changeonedimenfactor{bar@virgula}{#1}{#2}%
\fi%
+ \ifgre@scale@bar@virgula@short%
+ \gre@changeonedimenfactor{bar@virgula@short}{#1}{#2}%
+ \fi%
\ifgre@scale@bar@minima%
\gre@changeonedimenfactor{bar@minima}{#1}{#2}%
\fi%
+ \ifgre@scale@bar@minima@short%
+ \gre@changeonedimenfactor{bar@minima@short}{#1}{#2}%
+ \fi%
\ifgre@scale@bar@minor%
\gre@changeonedimenfactor{bar@minor}{#1}{#2}%
\fi%
@@ -1654,9 +2161,15 @@
\ifgre@scale@bar@virgula@standalone@text%
\gre@changeonedimenfactor{bar@virgula@standalone@text}{#1}{#2}%
\fi%
+ \ifgre@scale@bar@virgula@standalone@text@short%
+ \gre@changeonedimenfactor{bar@virgula@standalone@text@short}{#1}{#2}%
+ \fi%
\ifgre@scale@bar@minima@standalone@text%
\gre@changeonedimenfactor{bar@minima@standalone@text}{#1}{#2}%
\fi%
+ \ifgre@scale@bar@minima@standalone@text@short%
+ \gre@changeonedimenfactor{bar@minima@standalone@text@short}{#1}{#2}%
+ \fi%
\ifgre@scale@bar@minor@standalone@text%
\gre@changeonedimenfactor{bar@minor@standalone@text}{#1}{#2}%
\fi%
@@ -1672,9 +2185,15 @@
\ifgre@scale@bar@virgula@standalone@notext%
\gre@changeonedimenfactor{bar@virgula@standalone@notext}{#1}{#2}%
\fi%
+ \ifgre@scale@bar@virgula@standalone@notext@short%
+ \gre@changeonedimenfactor{bar@virgula@standalone@notext@short}{#1}{#2}%
+ \fi%
\ifgre@scale@bar@minima@standalone@notext%
\gre@changeonedimenfactor{bar@minima@standalone@notext}{#1}{#2}%
\fi%
+ \ifgre@scale@bar@minima@standalone@notext@short%
+ \gre@changeonedimenfactor{bar@minima@standalone@notext@short}{#1}{#2}%
+ \fi%
\ifgre@scale@bar@minor@standalone@notext%
\gre@changeonedimenfactor{bar@minor@standalone@notext}{#1}{#2}%
\fi%
@@ -1714,6 +2233,9 @@
\ifgre@scale@manualinitialwidth%
\gre@changeonedimenfactor{manualinitialwidth}{#1}{#2}%
\fi%
+ \ifgre@scale@minimalinitialwidth%
+ \gre@changeonedimenfactor{minimalinitialwidth}{#1}{#2}%
+ \fi%
\ifgre@scale@annotationseparation%
\gre@changeonedimenfactor{annotationseparation}{#1}{#2}%
\fi%
@@ -1780,6 +2302,15 @@
\ifgre@scale@bar@rubber%
\gre@changeonedimenfactor{bar@rubber}{#1}{#2}%
\fi%
+ \ifgre@scale@moraadjustment%
+ \gre@changeonedimenfactor{moraadjustment}{#1}{#2}%
+ \fi%
+ \ifgre@scale@moraadjustmentbar%
+ \gre@changeonedimenfactor{moraadjustment}{#1}{#2}%
+ \fi%
+ \ifgre@scale@alterationadjustmentbar%
+ \gre@changeonedimenfactor{alterationadjustmentbar}{#1}{#2}%
+ \fi%
\ifgre@scale@divisiofinalissep%
\gre@changeonedimenfactor{divisiofinalissep}{#1}{#2}%
\fi%
@@ -1787,38 +2318,9 @@
\gre@count@temp@two = \numexpr((\gre@stafflinefactor * #2) / #1)\relax%
\xdef\gre@stafflinefactor{\the\gre@count@temp@two}%
\fi%
+ \ifgre@scale@noteadditionalspacelinestext%
+ \gre@changeonedimenfactor{noteadditionalspacelinestext}{#1}{#2}%
+ \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}}%
+ \gre@trace@end%
}%
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-syllable.tex b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-syllable.tex
index 40588a3705e..22c5dea2e24 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-syllable.tex
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-syllable.tex
@@ -1,6 +1,6 @@
%GregorioTeX file.
%
-% Copyright (C) 2007-2016 The Gregorio Project (see CONTRIBUTORS.md)
+% Copyright (C) 2007-2017 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
@@ -19,8 +19,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.5}% GREGORIO_VERSION
+\gre@declarefileversion{gregoriotex-syllable.tex}{5.0.1}% GREGORIO_VERSION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% macros for the typesetting of the different glyphs
@@ -65,6 +64,7 @@
}%
\def\gre@pointandclick#1#2{%
+ \gre@trace{gre@pointandclick{#1}{#2}}%
\def\gre@@arg{#2}%
\ifx\gre@@arg\gre@nothing %
#1%
@@ -85,9 +85,11 @@
\fi %
\fi %
\fi %
+ \gre@trace@end%
}%
\def\gre@newglyphcommon{%
+ \gre@trace{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 %
@@ -103,19 +105,22 @@
\global\gre@lastendswithmorafalse %
\ifgre@boxing\else\ifgre@firstin@euouae %
\ifgre@raggedbreakbeforeeuouae %
- \directlua{gregoriotex.save_pos(\the\gre@lasteuouaeindex,2)}%
+ \directlua{gregoriotex.save_euouae(\the\gre@lasteuouaeindex,2)}%
\fi %
\gre@firstin@euouaefalse %
\fi\fi %
\relax %
+ \gre@trace@end%
}%
\def\gre@endofglyphcommon{%
+ \gre@trace{gre@endofglyphcommon}%
\ifgre@endofscore %
- \gre@penalty{\grefinalpenalty}%
+ \gre@penalty{\the\gre@space@count@finalpenalty}%
\gre@localleftbox{}%
\gre@localrightbox{}%
\fi %
+ \gre@trace@end%
}
% passes the glyph height limits:
@@ -132,7 +137,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
@@ -160,7 +165,7 @@
\raise\gre@dimen@glyphraisevalue%
\copy\gre@box@temp@width%
\ifgre@endofscore\else\ifgre@boxing\else %
- \GreNextCustos{#3}%
+ #3%
\fi\fi %
\ifgre@firstglyph% we check if it is the first glyph
\gre@calculate@notesaligncenter{#4}%
@@ -195,6 +200,7 @@
% 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{%
+ \gre@trace{gre@calculate@simplenotesaligncenter{#1}{#2}}%
\ifcase#1%
%case of punctum
\global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}%
@@ -212,10 +218,10 @@
\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}%
+ \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}%
+ \global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDescendensPunctumInclinatum}%
\or %
%case of a stropha
\global\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPStropha}%
@@ -253,6 +259,7 @@
\fi%
\fi%
\relax%
+ \gre@trace@end%
}%
% aux function to previous one: sets \gre@box@temp@width to \hbox{#1} or \hbox{#2}
@@ -270,6 +277,7 @@
%
% #3 is the same as #2 of previous function
\def\gre@handleclivisspecialalignment#1#2#3{%
+ \gre@trace{gre@handleclivisspecialalignment{#1}{#2}{#3}}%
\ifcase\gre@clivisalignment%
\global\setbox\gre@box@temp@width=\hbox{#1}%
\or%
@@ -290,9 +298,11 @@
\fi%
\else% vowel or first-letter centering
\ifcase#3%
+ % *always* emit end syllable part for proper determination of
+ % clivis alignment
\gre@widthof{\gre@endsyllablepart}%
\else%
- \gre@widthof{\gre@nextendsyllablepart}%
+ \gre@widthof{\gre@evaluatenextsyllable{\gre@nextendsyllablepart}}%
\fi%
\gre@debugmsg{ifdim}{ temp@three > clivisalignmentmin}%
\ifdim\gre@dimen@temp@three >\gre@space@dimen@clivisalignmentmin\relax%
@@ -303,18 +313,22 @@
\fi%
\fi%
\fi%
+ \gre@trace@end%
}%
% 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@trace{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@trace@end%
}%
% 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{%
+ \gre@trace{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 %
@@ -343,15 +357,41 @@
\global\gre@dimen@notesaligncenter=\gre@dimen@temp@five %
\fi %
\relax %
+ \gre@trace@end%
}%
% 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@trace{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 %
@@ -359,7 +399,11 @@
\global\gre@boxingtrue%
\let\ifgre@lastendswithmorasave\ifgre@lastendswithmora%
\xdef\gre@savedlastoflinecount{\number\gre@lastoflinecount\relax }%
- \setbox\gre@box@syllablenotes=\hbox{#1}%
+ \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 %
@@ -380,6 +424,7 @@
\global\gre@skip@bar@lastskip=0pt\relax %
\global\gre@endofscorefalse %
\relax %
+ \gre@trace@end%
}%
@@ -452,7 +497,9 @@
% a function to cancel the previous one
\def\gre@unsetfixedtextformat{%
+ \gre@trace{gre@unsetfixedtextformat}%
\global\let\gre@fixedtextformat\gre@textnormal %
+ \gre@trace@end%
}%
\let\gre@fixedtextformat\gre@textnormal %
@@ -479,7 +526,9 @@
% a function to cancel the previous one
\def\gre@unsetfixednexttextformat{%
+ \gre@trace{gre@unsetfixednexttextformat}%
\global\let\gre@fixednexttextformat\gre@textnormal %
+ \gre@trace@end%
}%
\let\gre@fixednexttextformat\gre@textnormal %
@@ -594,13 +643,6 @@
\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:
@@ -627,17 +669,6 @@
]%
}%
-\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%
@@ -648,12 +679,29 @@
{force}%
{\gre@forceemptyfirstsyllablehyphentrue}%
}[% all other cases
- \gre@error{Unrecognized option "#1" for \protect\gresetlyriccentering\MessageBreak Possible options are 'auto' and 'force'}%
+ \gre@error{Unrecognized option "#1" for \protect\gresetemptyfirstsyllablehyphen\MessageBreak Possible options are 'auto' and 'force'}%
]%
}%
+\newif\ifgre@evaluatingnextsyllable%
+\gre@evaluatingnextsyllablefalse%
+\def\gre@evaluatenextsyllable#1{%
+ \gre@trace{gre@evaluatenextsyllable{#1}}%
+ \gre@evaluatingnextsyllabletrue%
+ #1%
+ \gre@evaluatingnextsyllablefalse%
+ \gre@trace@end%
+}%
+
\newif\ifgre@showhyphenafterthissyllable%
-\def\GreForceHyphen{\global\gre@showhyphenafterthissyllabletrue\gre@debugmsg{hyphen}{Forcing hyphen in gabc}}
+\def\GreForceHyphen{%
+ \ifgre@evaluatingnextsyllable%
+ -%
+ \else%
+ \global\gre@showhyphenafterthissyllabletrue%
+ \gre@debugmsg{hyphen}{Forcing hyphen in gabc}%
+ \fi%
+}%
\def\GreEmptyFirstSyllableHyphen{\ifgre@forceemptyfirstsyllablehyphen\GreForceHyphen\fi}%
% if an hyphen maybe be added by lua for this syllable. When syllable is not end of word and
@@ -661,6 +709,130 @@
\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 %
+}%
+
+\newif\ifgre@rewritesyllables %
+\gre@rewritesyllablestrue %
+\def\gresetsyllablerewriting#1{%
+ \IfStrEqCase{#1}{%
+ {auto}%
+ {\gre@rewritesyllablestrue}%
+ {off}%
+ {\gre@rewritesyllablesfalse}%
+ }[% all other cases
+ \gre@error{Unrecognized option "#1" for \protect\gresetsyllablerewriting\MessageBreak Possible options are 'auto' and 'off'}%
+ ]%
+}%
+
+% Performs #1 if the syllable should be rewitten, else #2
+\newif\ifgre@rewritethissyllable %
+\def\gre@if@rewritesyllable#1#2{%
+ \gre@trace{gre@if@rewritesyllable{#1}{#2}}%
+ \gre@rewritethissyllablefalse %
+ \ifgre@rewritesyllables\relax %
+ \gre@debugmsg{syllablerewriting}{1}%
+ \ifnum\gre@insidediscretionary=0\relax %
+ \gre@debugmsg{syllablerewriting}{2}%
+ \ifgre@showhyphenafterthissyllable\else %
+ \gre@debugmsg{syllablerewriting}{3}%
+ \ifgre@possibleluahyphenafterthissyllable\relax %
+ \gre@debugmsg{syllablerewriting}{4}%
+ \ifx\gre@syllable@next\GreSyllable %
+ \gre@debugmsg{syllablerewriting}{5}%
+ \ifcase\directlua{gregoriotex.is_last_syllable_on_line()}\else %
+ \gre@debugmsg{syllablerewriting}{6}%
+ \gre@rewritethissyllabletrue %
+ \fi %
+ \fi %
+ \fi %
+ \fi %
+ \fi %
+ \fi %
+ \gre@debugmsg{syllablerewriting}{X}%
+ \ifgre@rewritethissyllable %
+ #1%
+ \else %
+ #2%
+ \fi %
+ \gre@trace@end%
+}%
+
+\let\gre@save@endsyllablepart\gre@nothing\relax %
+\let\gre@save@fixedtextformat\gre@textnormal\relax %
+\let\gre@save@pointandclick\gre@nothing\relax %
+\def\gre@push@endsyllable#1{%
+ \gre@trace{gre@push@endsyllable{#1}}%
+ \let\gre@save@endsyllablepart\gre@nothing\relax %
+ \let\gre@save@fixedtextformat\gre@textnormal\relax %
+ \let\gre@save@pointandclick\gre@nothing\relax %
+ \gre@if@rewritesyllable{%
+ \let\gre@save@endsyllablepart\gre@endsyllablepart\relax %
+ \let\gre@save@fixedtextformat\gre@fixedtextformat\relax %
+ \xdef\gre@save@pointandclick{#1}%
+ }{}%
+ \relax %
+ \gre@trace@end%
+}%
+
+\def\gre@emit@syllabletext#1{%
+ \gre@trace{gre@emit@syllabletext{#1}}%
+ \ifx\gre@save@endsyllablepart\gre@nothing %
+ \gre@fixedtextformat{#1}%
+ \else %
+ \ifx\gre@save@fixedtextformat\gre@fixedtextformat %
+ \gre@debugmsg{syllablerewriting}{merging format when prepending previous last syllable part}%
+ \gre@fixedtextformat{\gre@pointandclick{\gre@save@endsyllablepart}{\gre@save@pointandclick}#1}%
+ \else %
+ \gre@debugmsg{syllablerewriting}{prepending previous last syllable part}%
+ \gre@save@fixedtextformat{\gre@pointandclick{\gre@save@endsyllablepart}{\gre@save@pointandclick}}%
+ \gre@fixedtextformat{#1}%
+ \fi %
+ \fi %
+ \relax %
+ \gre@trace@end%
+}%
+
+\def\gre@emit@endsyllablepart{%
+ \gre@trace{gre@emit@endsyllablepart}%
+ \gre@if@rewritesyllable{}{%
+ \gre@debugmsg{syllablerewriting}{not rewriting syllable}%
+ \gre@endsyllablepart %
+ }%
+ \relax %
+ \gre@trace@end%
+}%
+
+\def\gre@emit@endsyllablepartfornextsyllable{%
+ \gre@trace{gre@emit@endsyllablepartfornextsyllable}%
+ \gre@if@rewritesyllable{%
+ \gre@endsyllablepart %
+ }{}%
+ \relax %
+ \gre@trace@end%
+}%
+
+\newif\ifgre@textcleared%
+
+\def\GreClearSyllableText{%
+ \gre@textclearedtrue%
+}%
+
%% general macro : it will typeset the syllable : arguments are :
% #1 : macro setting the letters of this syllable
% #2 : reserved (unused)
@@ -676,10 +848,28 @@
%% 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@textclearedfalse%
+ \def\gre@syllable@args{{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}%
+ \futurelet\gre@syllable@next\gre@syllable@expand%
+}%
+\def\gre@syllable@expand{%
+ \gre@trace{gre@syllable@expand}%
+ \expandafter\gre@syllable@act\gre@syllable@args%
+ \gre@trace@end%
+}%
+\def\gre@syllable@act#1#2#3#4#5#6#7#8#9{%
+ \gre@trace{gre@syllable@act{#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 %
+ % This needs to be calculated early for syllable rewriting, the value
+ % will be refined later on
+ \ifcase#4 %
+ \global\gre@possibleluahyphenafterthissyllabletrue %
+ \else %
+ \global\gre@possibleluahyphenafterthissyllablefalse %
+ \fi %
+ \global\advance\gre@attr@syllable@id by 1\relax %
\gre@showhyphenafterthissyllablefalse%
\ifcase#4\ifgre@forcehyphen%
\gre@debugmsg{hyphen}{Forcing hyphen}%
@@ -688,7 +878,7 @@
#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@calculate@textaligncenter{\gre@save@endsyllablepart}{\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 %
@@ -737,9 +927,23 @@
% 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@calculate@nextbegindifference{\gre@emit@endsyllablepartfornextsyllable}{\gre@evaluatenextsyllable{\gre@nextfirstsyllablepart}}{\gre@evaluatenextsyllable{\gre@nextmiddlesyllablepart}}{\gre@evaluatenextsyllable{\gre@nextendsyllablepart}}{#7}%
\gre@unsetfixednexttextformat %
- \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart}{#6}}}%
+ \ifgre@showlyrics%
+ \setbox\gre@box@syllabletext=\hbox{%
+ \IfSubStr{\gre@debug}{,notespacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ \gre@emit@syllabletext{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@emit@endsyllablepart}{#6}}%
+ \IfSubStr{\gre@debug}{,notespacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ }%
+ \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%
@@ -772,25 +976,74 @@
\fi %
\fi% ficase#4
\ifgre@showhyphenafterthissyllable\relax%
+ \global\gre@possibleluahyphenafterthissyllablefalse %
\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}}}%
+ \ifgre@showlyrics%
+ \setbox\gre@box@syllabletext=\hbox{%
+ \IfSubStr{\gre@debug}{,notespacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ \gre@emit@syllabletext{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@emit@endsyllablepart#3{\GreHyph}\relax}{#6}}%
+ \IfSubStr{\gre@debug}{,notespacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ }%
+ \else%
+ \setbox\gre@box@syllabletext=\box\voidb@x%
+ \fi%
\else %
- \setbox\gre@box@syllabletext=\hbox{\gre@fixedtextformat{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@endsyllablepart#3{-}}{#6}}}%
+ \ifgre@showlyrics%
+ \setbox\gre@box@syllabletext=\hbox{%
+ \IfSubStr{\gre@debug}{,notespacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ \gre@emit@syllabletext{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@emit@endsyllablepart#3{-}}{#6}}%
+ \IfSubStr{\gre@debug}{,notespacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ }%
+ \else%
+ \setbox\gre@box@syllabletext=\box\voidb@x%
+ \fi%
\fi %
% recomputing end difference and final skip with the final hyphen
+ \gre@calculate@nextbegindifference{\gre@emit@endsyllablepartfornextsyllable}{\gre@evaluatenextsyllable{\gre@nextfirstsyllablepart}}{\gre@evaluatenextsyllable{\gre@nextmiddlesyllablepart}}{\gre@evaluatenextsyllable{\gre@nextendsyllablepart}}{#7}%
\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 %
+ \global\gre@possibleluahyphenafterthissyllabletrue %
\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 %
+ \ifgre@showlyrics%
+ \setbox\gre@box@syllabletext=\hbox{%
+ \IfSubStr{\gre@debug}{,notespacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ \gre@emit@syllabletext{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@emit@endsyllablepart}{#6}}%
+ \IfSubStr{\gre@debug}{,notespacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ }%
+ \else%
+ \setbox\gre@box@syllabletext=\box\voidb@x%
+ \fi%
+ \else %
+ \global\gre@possibleluahyphenafterthissyllablefalse %
\fi %
\fi%
+ \ifgre@textcleared%
+ \gre@clearsyllable{note}%
+ \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%
@@ -812,7 +1065,17 @@
% 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
+ \ifgre@shownotes%
+ \IfSubStr{\gre@debug}{,notespacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\raise 12pt\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ #9% we do that instead of \unhbox\Syllablnotes, because it would not set the \localrightbox
+ \IfSubStr{\gre@debug}{,notespacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\raise 12pt\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ \fi%
\GreNoBreak % no line breaks between notes and end of syllable skips
\gre@debugmsg{ifdim}{ enddifference < 0pt}%
\ifdim\gre@dimen@enddifference <0pt\relax%
@@ -821,13 +1084,15 @@
\GreNoBreak %
\fi%
% we call end of syllable
- \gre@syllable@end{#7}{\gre@nextfirstsyllablepart\gre@nextmiddlesyllablepart\gre@nextendsyllablepart}{#4}%
+ \gre@syllable@end{#7}{\gre@evaluatenextsyllable{\gre@nextfirstsyllablepart\gre@nextmiddlesyllablepart\gre@nextendsyllablepart}}{#4}%
+ \gre@push@endsyllable{#6}\relax %
\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@trace@end%
}%
% #1 is the id of the euouae block (assigned by the C code)
@@ -836,10 +1101,10 @@
\def\GreNextSyllableBeginsEUOUAE#1#2{%
\GreNoBreak %
\ifgre@blockeolcustosbeforeeuouae %
- \gre@usemanualeolcustos %
+ \GreSuppressEolCustos %
\fi %
\ifgre@raggedbreakbeforeeuouae %
- \directlua{gregoriotex.save_pos(#1,1)}%
+ \directlua{gregoriotex.save_euouae(#1,1)}%
\ifcase#2\ifcase\directlua{gregoriotex.is_ypos_different(#1)}\relax%
\gre@newlinecommon{1}{1}%
\fi\fi %
@@ -862,7 +1127,7 @@
%% @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@trace{gre@syllable@end{#1}{#2}{#3}}%
% 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 %
@@ -890,6 +1155,7 @@
\gre@debugmsg{syllablespacing}{ calling endofsyllable with #3}%
\gre@endofsyllable{1}{#3}{0}%
\fi %
+ \gre@trace@end%
}
%% @desc Macro called at end of a syllable, adds a penalty and a space
@@ -898,25 +1164,30 @@
%% @arg#3 1 if next syllable is a bar, 0 otherwise
%%
\def\gre@endofsyllable#1#2#3{%
- \gre@debugmsg{syllablespacing}{ endofsyllable with #2}%
+ \gre@trace{gre@endofsyllable{#1}{#2}{#3}}%
\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}%
+ \gre@debugmsg{syllablespacing}{ set penalty \the\gre@space@count@nobreakpenalty}%
\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 %
+ \gre@count@temp@one=0\relax %
+ \gre@if@rewritesyllable{%
+ \GreNoBreak%
+ }{%
+ \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 %
+ }%
+ \gre@count@temp@one=0\relax %
\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.
@@ -940,6 +1211,7 @@
\fi %
\fi %
\relax%
+ \gre@trace@end%
}%
\def\gresetbarspacing#1{%
@@ -964,12 +1236,18 @@
% end of line for later.
\xdef\gre@newlinearg{-1}
\gdef\gre@newlinecommondelayed#1#2{%
+ \gre@trace{gre@newlinecommondelayed{#1}{#2}}%
\xdef\gre@newlinearg{#1}%
+ \gre@trace@end%
}
%a macro to typeset a syllable with only a bar inside
\def\GreBarSyllable#1#2#3#4#5#6#7#8#9{%
+ \gre@textclearedfalse%
+ \gre@debugmsg{general}{}%
\gre@debugmsg{general}{New bar syllable}%
+ \gre@debugmsg{general}{}%
+ \global\advance\gre@attr@syllable@id by 1\relax %
\gre@possibleluahyphenafterthissyllablefalse %
\gre@showhyphenafterthissyllablefalse %
% the algorithm of this function is *extremely* complex, and has been much painful to write... good luck to understand.
@@ -977,8 +1255,22 @@
% 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@calculate@textaligncenter{\gre@save@endsyllablepart}{\gre@firstsyllablepart}{\gre@middlesyllablepart}{0}%
+ \ifgre@showlyrics%
+ \setbox\gre@box@syllabletext=\hbox{%
+ \IfSubStr{\gre@debug}{,barspacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ \gre@emit@syllabletext{\gre@pointandclick{\gre@firstsyllablepart\gre@middlesyllablepart\gre@emit@endsyllablepart}{#6}}%
+ \IfSubStr{\gre@debug}{,barspacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ }%
+ \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 %
@@ -989,7 +1281,7 @@
\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@calculate@nextbegindifference{\gre@emit@endsyllablepartfornextsyllable}{\gre@evaluatenextsyllable{\gre@nextfirstsyllablepart}}{\gre@evaluatenextsyllable{\gre@nextmiddlesyllablepart}}{\gre@evaluatenextsyllable{\gre@nextendsyllablepart}}{#7}%
\gre@unsetfixednexttextformat %
\gre@debugmsg{barspacing}{previousenddifference: \the\gre@dimen@previousenddifference}%
\gre@debugmsg{barspacing}{begindifference: \the\gre@dimen@begindifference}%
@@ -1000,13 +1292,16 @@
% New bar spacing algorithm
%
\gre@calculate@barposition{#4}{#7}%
+ \ifgre@textcleared%
+ \gre@clearsyllable{bar}%
+ \fi%
%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%
+ \GreNoBreak %
%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
@@ -1029,7 +1324,17 @@
\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%
+ \ifgre@shownotes%
+ \IfSubStr{\gre@debug}{,barspacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\raise 12pt\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ #9%
+ \IfSubStr{\gre@debug}{,barspacing,}%
+ % when debugging we add a zero-width line to mark the syllable bound
+ {\raise 12pt\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}%
+ {}% do nothing if not debugging
+ \fi%
\global\let\gre@newlinecommon\gre@newlinecommonsaved %
\GreNoBreak%
% get into position to place the penalty
@@ -1039,37 +1344,48 @@
\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%
+ \ifgre@endofscore%
+ \kern\glueexpr(-\gre@skip@bar@lastskip)\relax%
+ \else%
+ %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%
\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 %
+ \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}%
+ \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%
+ \ifgre@endofscore\else%
+ %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%
\fi%
\ifdim\gre@dimen@enddifference < 0pt\relax%
%undo the earlier shift
\kern\gre@dimen@enddifference%
\GreNoBreak%
\fi%
+ % adjustment for alterations:
+ \kern-\gre@skip@alterationshift %
%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
@@ -1083,11 +1399,13 @@
\else %
\ifgre@endofscore %
\gre@localleftbox{}%
- \gre@debugmsg{barspacing}{after bar penalty: \greendafterbarpenalty}%
- \gre@penalty{\grefinalpenalty}%
+ \gre@debugmsg{barspacing}{after bar penalty: \gre@space@count@endafterbarpenalty}%
+ \gre@penalty{\the\gre@space@count@finalpenalty}%
\else %
- \gre@debugmsg{barspacing}{calling new line with argument: \gre@newlinearg}%
- \gre@newlinecommon{\gre@newlinearg}{1}%
+ \ifnum\gre@newlinearg=-1\else %
+ \gre@debugmsg{barspacing}{calling new line with argument: \gre@newlinearg}%
+ \gre@newlinecommon{\gre@newlinearg}{1}%
+ \fi %
\fi %
\fi%
\else%
@@ -1095,6 +1413,10 @@
% Old spacing algorithm
%
%This is the old algorithm. I've kept it in case people still want to use it.
+ \gre@punctummoraadjustment%
+ \ifgre@textcleared%
+ \gre@clearsyllable{bar}%
+ \fi%
% then we check if there is something to write
\global\let\gre@newlinecommon\gre@newlinecommonsaved %
\gre@debugmsg{ifdim}{ wd(gre@box@syllabletext) = 0pt}%
@@ -1113,10 +1435,10 @@
\else %
\gre@skip@temp@two=0 pt\relax%
\fi %
- \gre@debugmsg{ifdim}{ previousenddifference < 0pt}%
- \ifdim\gre@dimen@previousenddifference < 0 pt\relax%
+ \gre@debugmsg{ifdim}{ adjustedpreviousenddifference < 0pt}%
+ \ifdim\gre@dimen@adjustedpreviousenddifference < 0 pt\relax%
\advance\gre@skip@temp@two by %
- \glueexpr(-\gre@dimen@previousenddifference %
+ \glueexpr(-\gre@dimen@adjustedpreviousenddifference %
+ \gre@space@skip@interwordspacetext)\relax%
\else %
\advance\gre@skip@temp@two by \gre@space@skip@interwordspacenotes\relax%
@@ -1130,9 +1452,9 @@
\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%
+ \gre@debugmsg{ifdim}{ adjustedpreviousenddifference < 0pt}%
+ \ifdim\gre@dimen@adjustedpreviousenddifference < 0 pt\relax%
+ \advance\gre@skip@temp@two by \gre@dimen@adjustedpreviousenddifference\relax%
\fi %
\GreNoBreak %
\gre@debugmsg{ifdim}{ temp@skip@two > -wd(gre@box@syllablenotes)}%
@@ -1149,8 +1471,10 @@
\gre@dotranslationcenterend %
\gre@mustdotranslationcenterendfalse%
\fi %
- #9\relax %
- \gre@penalty{\greendafterbaraltpenalty }% TODO: isn't it a bit buggy?
+ \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 %
@@ -1193,7 +1517,9 @@
\kern\gre@skip@temp@one %
\gre@skip@temp@one = -\gre@dimen@begindifference\relax%
\kern\gre@skip@temp@one %
- #9%
+ \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
@@ -1211,6 +1537,7 @@
%and that's it !!
\fi %
\fi%
+ \gre@push@endsyllable{#6}\relax %
\global\gre@dimen@notesaligncenter= 0 pt\relax % very important, see flat and natural
\gre@unsetfixedtextformat %
\ifgre@blockeolcustos\ifnum\gre@insidediscretionary=0\relax %
@@ -1232,14 +1559,17 @@
%% #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{%
+ \gre@trace{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 %
}%
+ \gre@trace@end%
}%
+% TODO: Change \gre@initiallines to \gre@count@initiallines in 5.0
\def\gresetinitiallines#1{%
\IfInteger{#1}%
{%
@@ -1257,11 +1587,6 @@
}%
\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
-
%% sets the first syllable text
%% #1 - Initial
%% #2 - First letter after the initial
@@ -1270,8 +1595,8 @@
%% #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@printcommentary%
+ \ifcase\gre@initiallines\relax % no initial
\gre@noinitial %
\gre@setfirstsyllabletext#5{#1}{#2#3}{}%
\or % regular intiial
@@ -1290,10 +1615,10 @@
\def\GreUpcomingNewLineForcesCustos#1{%
\ifcase#1\relax % 0 - forced off
- \gre@usemanualeolcustos %
+ \GreSuppressEolCustos %
\or % 1 - forced on
\gre@useautoeolcustos %
- \GreNextCustos{\gre@nextcustos}%
+ \GreNextCustos{\gre@nextcustospitch}{\gre@nextcustosalteration}%
\fi %
}%
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.lua b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.lua
index afa9f015248..574babd4414 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.lua
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.lua
@@ -1,6 +1,6 @@
--GregorioTeX Symbols Lua support file.
--
---Copyright (C) 2016 The Gregorio Project (see CONTRIBUTORS.md)
+--Copyright (C) 2016-2017 The Gregorio Project (see CONTRIBUTORS.md)
--
--This file is part of Gregorio.
--
@@ -19,7 +19,7 @@
-- this file contains lua functions to support signs used by GregorioTeX.
--- GREGORIO_VERSION 4.1.5
+-- GREGORIO_VERSION 5.0.1
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 23155baa182..5112d2b23e6 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.tex
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-symbols.tex
@@ -1,6 +1,6 @@
%GregorioTeX file.
%
-% Copyright (C) 2007-2016 The Gregorio Project (see CONTRIBUTORS.md)
+% Copyright (C) 2007-2017 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
@@ -22,8 +22,7 @@
\ifcsname gregoriotex@symbols@loaded\endcsname\endinput\fi%
\def\gregoriotex@symbols@loaded{}%
-\gre@debugmsg{general}{Loading gregoriotex-symbols.tex}%
-\gre@declarefileversion{gregoriotex-symbols.tex}{4.1.5}% GREGORIO_VERSION
+\gre@declarefileversion{gregoriotex-symbols.tex}{5.0.1}% GREGORIO_VERSION
\RequireLuaModule{gregoriotex}%
@@ -114,7 +113,9 @@
\gre@iflatex{%
\def\gre@latex@barredsymbol#1#2#3#4{%
+ \gre@trace{gre@latex@barredsymbol{#1}{#2}{#3}{#4}}%
\IfStrEq{\f@series/\f@shape}{#1}{\grebarredsymbol{#2}{#3}{\f@size}{#4}{0pt}}%
+ \gre@trace@end%
}%
%% define a barred symbol that handles italic, slanted, and small cap shapes
@@ -193,9 +194,6 @@
\fi%
}%
-\def\gresep#1#2{%OBSOLETE
- \gre@obsolete{\protect\gresep}{\protect\greseparator}%
-}
%%%%%%%%%%%
%% Ornamentation
@@ -221,9 +219,7 @@
\gresetspecial{\string\037}{\%{}}%
\gresetspecial{R/}{\Rbar{}}%
\gresetspecial{V/}{\Vbar{}}%
-\gresetspecial{'æ}{\'\ae{}}%
\gresetspecial{'ae}{\'\ae{}}%
-\gresetspecial{'œ}{\'\oe{}}%
\gresetspecial{'oe}{\'\oe{}}%
\gresetspecial{ae}{\ae{}}%
\gresetspecial{oe}{\oe{}}%
@@ -235,3 +231,13 @@
\gresetspecial{\string\035}{\#{}}%
\gresetspecial{\string\095}{\_{}}%
\gresetspecial{\string\126}{\gretilde{}}%
+\gre@iflatex{%
+ \@ifpackageloaded{luainputenc}{}{%
+ \gresetspecial{'æ}{\'\ae{}}%
+ \gresetspecial{'œ}{\'\oe{}}%
+ }%
+}%
+\gre@ifnotlatex{%
+ \gresetspecial{'æ}{\'\ae{}}%
+ \gresetspecial{'œ}{\'\oe{}}%
+}%
diff --git a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua
index 6f15499f3ac..e87bbc553e0 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.lua
@@ -1,6 +1,6 @@
--GregorioTeX Lua file.
--
---Copyright (C) 2008-2016 The Gregorio Project (see CONTRIBUTORS.md)
+--Copyright (C) 2008-2017 The Gregorio Project (see CONTRIBUTORS.md)
--
--This file is part of Gregorio.
--
@@ -24,19 +24,21 @@ local hpack, traverse, traverse_id, has_attribute, count, remove, insert_after,
gregoriotex = gregoriotex or {}
local gregoriotex = gregoriotex
-local internalversion = '4.1.5' -- GREGORIO_VERSION (comment used by VersionManager.py)
+local internalversion = '5.0.1' -- GREGORIO_VERSION (comment used by VersionManager.py)
local err, warn, info, log = luatexbase.provides_module({
name = "gregoriotex",
- version = '4.1.5', -- GREGORIO_VERSION
+ version = '5.0.1', -- GREGORIO_VERSION
greinternalversion = internalversion,
- date = "2016/08/18", -- GREGORIO_DATE_LTX
+ date = "2017/04/16", -- GREGORIO_DATE_LTX
description = "GregorioTeX module.",
author = "The Gregorio Project (see CONTRIBUTORS.md)",
- copyright = "2008-2016 - The Gregorio Project",
+ copyright = "2008-2017 - The Gregorio Project",
license = "GPLv3+",
})
+local real_gregorio_exe = nil
+
gregoriotex.module = { err = err, warn = warn, info = info, log = log }
local format = string.format
@@ -49,7 +51,7 @@ local whatsit = node.id('whatsit')
local hyphen = tex.defaulthyphenchar or 45
-local dash_attr = luatexbase.attributes['gre@attr@dash']
+local dash_attr = luatexbase.attributes['gre@attr@dash']
local potentialdashvalue = 1
local nopotentialdashvalue = 2
@@ -62,17 +64,28 @@ local glyph_top_attr = luatexbase.attributes['gre@attr@glyph@top']
local glyph_bottom_attr = luatexbase.attributes['gre@attr@glyph@bottom']
local prev_line_id = nil
+local syllable_id_attr = luatexbase.attributes['gre@attr@syllable@id']
+
local cur_score_id = nil
local score_inclusion = {}
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 last_syllables = nil
+local new_last_syllables = nil
+local score_last_syllables = nil
+local new_score_last_syllables = nil
+local state_hashes = nil
+local new_state_hashes = nil
local auxname = nil
+local snippet_filename = nil
+local snippet_logname = nil
local space_below_staff = 5
local space_above_staff = 13
@@ -90,6 +103,13 @@ local number_to_letter = {
}
local capture_header_macro = {}
+local hashed_spaces = {}
+local space_hash = ''
+
+local per_line_dims = {}
+local per_line_counts = {}
+local saved_dims = {}
+local saved_counts = {}
local catcode_at_letter = luatexbase.catcodetables['gre@atletter']
@@ -98,9 +118,41 @@ local create_marker = luatexbase.new_user_whatsit('marker', 'gregoriotex')
local marker_whatsit_id = luatexbase.get_user_whatsit_id('marker', 'gregoriotex')
local translation_mark = 1
local abovelinestext_mark = 2
-
log("marker whatsit id is %d", marker_whatsit_id)
+local function gregorio_exe()
+ if real_gregorio_exe == nil then
+ local exe_version
+
+ -- first look for one with the exact version
+ real_gregorio_exe = 'gregorio-5_0_1' -- FILENAME_VERSION
+ exe_version = io.popen(real_gregorio_exe..' --version', 'r')
+ if exe_version then
+ exe_version = exe_version:read("*line")
+ end
+ if not exe_version then
+ -- look for suffix-less executable
+ real_gregorio_exe = 'gregorio'
+ exe_version = io.popen(real_gregorio_exe..' --version', 'r')
+ exe_version = exe_version:read("*line")
+ if not exe_version or string.match(exe_version,"%d+%.%d+%.")
+ ~= string.match(internalversion,"%d+%.%d+%.") then
+ real_gregorio_exe = nil
+ err("Unable to find gregorio executable.\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.",
+ tex.formatname, tex.jobname)
+ end
+ end
+
+ log("will use %s", real_gregorio_exe)
+ end
+
+ return real_gregorio_exe
+end
+
local function mark(value)
local marker = create_marker()
marker.type = 100
@@ -134,69 +186,130 @@ 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 entries_changed(tab1, tab2)
+ local k, v
+ for k, v in pairs(tab1) do
+ if tab2[k] ~= v then return true end
+ end
+ return false
+end
+
+local function is_greaux_write_needed()
local id, tab
+ if entries_changed(state_hashes, new_state_hashes) or
+ entries_changed(new_state_hashes, state_hashes) then
+ return true
+ end
for id, tab in pairs(new_line_heights) do
if keys_changed(tab, line_heights[id]) then return true end
end
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
+ for id, tab in pairs(new_last_syllables) do
+ if keys_changed(tab, last_syllables[id]) then return true end
end
- for id, tab in pairs(var_brace_positions) do
- if keys_changed(tab, new_var_brace_positions[id]) then return true end
+ for id, tab in pairs(last_syllables) do
+ if keys_changed(tab, new_last_syllables[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
+ if saved_computations_changed(saved_lengths, new_saved_lengths) then
+ return true
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)
+ local id, tab, id2, line, value
aux:write('return {\n ["line_heights"]={\n')
- local id, tab, id2, line
for id, tab in pairs(new_line_heights) do
aux:write(string.format(' ["%s"]={\n', id))
for id2, line in pairs(tab) do
- aux:write(string.format(' [%d]={%d,%d,%d,%d},\n', id2, line[1],
- line[2], line[3], line[4]))
+ if id2 == 'last' then
+ aux:write(string.format(' ["%s"]=%d,\n', id2, line))
+ else
+ aux:write(string.format(' [%d]={%d,%d,%d,%d,%d},\n', id2, line[1],
+ line[2], line[3], line[4], line[5]))
+ end
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 ["last_syllables"]={\n')
+ for id, tab in pairs(new_last_syllables) 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 id2 == 'state' then
+ aux:write(string.format(' state="%s",\n', value))
+ else
+ 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_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 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
+ aux:write(string.format(' [%d]=%d,\n', id2, value))
end
end
aux:write(' },\n')
end
+ 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, 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')
+ end
+ aux:write(' },\n ["state_hashes"]={\n')
+ for id, value in pairs(new_state_hashes) do
+ aux:write(string.format(' ["%s"]="%s",\n', id, value))
+ end
aux:write(' },\n}\n')
aux:close()
else
@@ -221,8 +334,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,16 +348,22 @@ 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 {}
+ last_syllables = score_info.last_syllables or {}
+ state_hashes = score_info.state_hashes 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 = {}
+ last_syllables = {}
+ state_hashes = {}
+ saved_lengths = {}
+ saved_newline_before_euouae = {}
end
if enable_height_computation then
new_line_heights = {}
+ new_last_syllables = {}
+ new_state_hashes = {}
local mcb_version = luatexbase.get_module_version and
luatexbase.get_module_version('luatexbase-mcb') or 9999
@@ -262,8 +385,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
@@ -357,15 +481,17 @@ end
local glue_sign_name = {[0] = 'normal', [1] = 'stretching', [2] = 'shrinking'}
-local function debugmessage(type, message)
+local function debugmessage(type, ...)
if (debug_types_activated[type] or debug_types_activated['all']) then
- texio.write_nl('GregorioTeX debug: ('..type..'): '..message)
+ texio.write_nl('GregorioTeX debug: ('..type..'): '..format(...))
end
end
+gregoriotex.module.debugmessage = debugmessage
+
-- in each function we check if we really are inside a score,
-- which we can see with the dash_attr being set or not
-local function process (h, groupcode, glyphes)
+local function post_linebreak(h, groupcode, glyphes)
-- TODO: to be changed according to the font
local lastseennode = nil
local adddash = false
@@ -378,6 +504,7 @@ local function process (h, groupcode, glyphes)
local line_has_translation = false
local line_has_abovelinestext = false
local linenum = 0
+ local syl_id = nil
-- we explore the lines
for line in traverse(h) do
if line.id == glue then
@@ -394,7 +521,7 @@ local function process (h, groupcode, glyphes)
h, line = remove(h, line)
else
linenum = linenum + 1
- debugmessage('linesglues', format('line %d: %s factor %d%%', linenum, glue_sign_name[line.glue_sign], line.glue_set*100))
+ debugmessage('linesglues', 'line %d: %s factor %d%%', linenum, glue_sign_name[line.glue_sign], line.glue_set*100)
centerstartnode = nil
line_id = nil
line_top = nil
@@ -402,6 +529,7 @@ local function process (h, groupcode, glyphes)
line_has_translation = false
line_has_abovelinestext = false
for n in traverse_id(hlist, line.head) do
+ syl_id = has_attribute(n, syllable_id_attr) or syl_id
if has_attribute(n, center_attr, startcenter) then
centerstartnode = n
elseif has_attribute(n, center_attr, endcenter) then
@@ -466,11 +594,15 @@ local function process (h, groupcode, glyphes)
addash=false
end
if line_id then
- new_score_heights[prev_line_id] = { line_top, line_bottom,
+ new_score_heights[prev_line_id] = { linenum, line_top, line_bottom,
line_has_translation and 1 or 0,
line_has_abovelinestext and 1 or 0 }
+ new_score_heights['last'] = prev_line_id
prev_line_id = line_id
end
+ if new_score_last_syllables and syl_id then
+ new_score_last_syllables[syl_id] = syl_id
+ end
end
-- we reinitialize the shift value, because it may change according to the line
currentshift=0
@@ -488,8 +620,75 @@ local function disable_hyphenation()
return false
end
-local function atScoreBeginning (score_id, top_height, bottom_height,
- has_translation, has_above_lines_text, top_height_adj, bottom_height_adj)
+local get_font_by_id = font.getfont --- cached, indexes fonts.hashes.identifiers
+local font_id = font.id
+
+-- an "unsafe" version of get_font_by_id that can see all fonts
+-- LuaTeX can see, which is needed when we need the font size of
+-- the user-selected current font
+local function unsafe_get_font_by_id(id)
+ return get_font_by_id(id) or font.fonts[id]
+end
+
+-- get_font_by_name(name) -- Look up a font identifier in the
+-- ``score_fonts`` table. Returns the id of the font if found, -1
+-- otherwise.
+local function get_font_by_name(name)
+ local id = font_id(name)
+ return id >= 0 and get_font_by_id(id)
+end
+
+-- get_score_font_id(name) -- Look up a font identifier in the
+-- ``score_fonts`` table. Returns the id of the font if found, -1
+-- otherwise.
+local function get_score_font_id(name)
+ local sfnt = score_fonts[name]
+ if sfnt then
+ return font_id(sfnt)
+ end
+ return -1
+end
+
+local resource_dummy = { unicodes = { } }
+
+-- get_font_resources(number) -- Retrieve the resource table
+-- associated with a font id. Always returns a Lua table value whose
+-- ``unicodes`` field is indexable.
+local function get_font_resources(id)
+ local fnt = get_font_by_id(id)
+ if fnt then
+ return fnt.resources or resource_dummy
+ end
+ return resource_dummy
+end
+
+-- get_score_font_resources(string) -- Retrieve the resource table
+-- belonging to a font in the ``score_font`` table. Always returns
+-- a table whose ``unicodes`` field is indexable.
+local function get_score_font_resources(name)
+ return get_font_resources(get_score_font_id(name))
+end
+
+local function get_score_font_unicode_pairs(name)
+ local unicodes = get_score_font_resources(name).unicodes
+ if not font_indexed[name] then
+ -- The unicodes table may be lazy-loaded, so iterating it may not
+ -- return everything. Attempting to retrieve the code point of a
+ -- glyph that has not already been loaded will trigger the __index
+ -- method in the metatable (implemented by the fontloader) to load
+ -- the table until the glyph is found. When iterating the
+ -- unicodes, we want the whole table to be filled, so we try to
+ -- access a non-existing glyph in order to force load the entire
+ -- table.
+ local ignored = unicodes['_this_is_hopefully_a_nonexistent_glyph_']
+ font_indexed[name] = true
+ end
+ return pairs(unicodes)
+end
+
+local function at_score_beginning(score_id, top_height, bottom_height,
+ has_translation, has_above_lines_text, top_height_adj, bottom_height_adj,
+ score_font_name)
local inclusion = score_inclusion[score_id] or 1
score_inclusion[score_id] = inclusion + 1
score_id = score_id..'.'..inclusion
@@ -507,14 +706,33 @@ local function atScoreBeginning (score_id, top_height, bottom_height,
score_heights = nil
new_score_heights = nil
end
+ local text_font = unsafe_get_font_by_id(font.current())
+ local score_font = unsafe_get_font_by_id(font.id('gre@font@music'))
+ local state = md5.sumhexa(string.format('%s|%d|%s|%d|%s', text_font.name,
+ text_font.size, score_font.name, score_font.size, space_hash))
+ score_last_syllables = last_syllables[score_id]
+ if score_last_syllables and state_hashes[score_id] ~= state then
+ score_last_syllables = nil
+ end
+ if new_state_hashes then
+ new_state_hashes[score_id] = state
+ end
+ if new_last_syllables then
+ new_score_last_syllables = {}
+ new_last_syllables[score_id] = new_score_last_syllables
+ end
- luatexbase.add_to_callback('post_linebreak_filter', process, 'gregoriotex.callback', 1)
+ luatexbase.add_to_callback('post_linebreak_filter', post_linebreak, 'gregoriotex.post_linebreak', 1)
luatexbase.add_to_callback("hyphenate", disable_hyphenation, "gregoriotex.disable_hyphenation", 1)
end
-local function atScoreEnd ()
- luatexbase.remove_from_callback('post_linebreak_filter', 'gregoriotex.callback')
+local function at_score_end()
+ luatexbase.remove_from_callback('post_linebreak_filter', 'gregoriotex.post_linebreak')
luatexbase.remove_from_callback("hyphenate", "gregoriotex.disable_hyphenation")
+ per_line_dims = {}
+ per_line_counts = {}
+ saved_dims = {}
+ saved_counts = {}
end
local function clean_old_gtex_files(file_withdir)
@@ -545,19 +763,44 @@ 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('%s %s -W -o %s -l %s "%s"', gregorio_exe(),
+ 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 %s.\nPlease check your score file.", gabc_file,
+ gregorio_exe())
else
-- open the gtex file for writing so that LuaTeX records output to it
-- when the -recorder option is used
@@ -567,24 +810,49 @@ 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 file_root
- if string.match(input_file:sub(-5), '%.gtex') then
- file_root = input_file:sub(1,-6)
- elseif string.match(input_file:sub(-4), '%.tex') then
- file_root = input_file:sub(1,-5)
- elseif string.match(input_file:sub(-5), '%.gabc') then
- file_root = input_file:sub(1,-6)
- elseif not file_root then
- file_root = input_file
+local function include_score(input_file, force_gabccompile, allow_deprecated)
+ if string.match(input_file, "[#%%]") then
+ err("GABC filename contains invalid character(s): # %%\n"
+ .."Rename the file and retry: %s", input_file)
end
- local gtex_file = file_root.."-"..internalversion:gsub("%.", "_")..".gtex"
- local gabc_file = file_root..".gabc"
+ local has_extention = false
+ local file_dir,input_name
+ local extensions = {['gabc']=true, ['gtex']=true, ['tex']=true}
+ if extensions[string.match(input_file, "([^%.\\/]*)$")] then
+ has_extention = true
+ end
+ if has_extention then
+ file_dir,input_name = string.match(input_file, "(.-)([^\\/]-)%.?[^%.\\/]*$")
+ else
+ file_dir,input_name = string.match(input_file, "(.-)([^\\/]*)$")
+ end
+
+ local cleaned_filename = input_name:gsub("[%s%+%&%*%?$@:;!\"\'`]", "-")
+ local gabc_file = string.format("%s%s.gabc", file_dir, input_name)
+ local gtex_file = string.format("%s%s-%s.gtex", file_dir, cleaned_filename,
+ internalversion:gsub("%.", "_"))
+ local glog_file = string.format("%s%s-%s.glog", file_dir, cleaned_filename,
+ internalversion:gsub("%.", "_"))
if not lfs.isfile(gtex_file) then
- clean_old_gtex_files(file_root)
+ clean_old_gtex_files(file_dir..cleaned_filename)
log("The file %s does not exist. Searching for a gabc file", gtex_file)
if lfs.isfile(gabc_file) then
local gabc = io.open(gabc_file, 'r')
@@ -594,7 +862,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
@@ -615,103 +883,65 @@ 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, allow_deprecated)
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('%s -W %s-S -l %s %s', gregorio_exe(), 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)
- end
- tex.print(p:read("*a"):explode('\n'))
- p:close()
- os.remove(tmpname)
-end
-
-local function get_gregorioversion()
- return internalversion
-end
-
-local get_font_by_id = font.getfont --- cached, indexes fonts.hashes.identifiers
-local font_id = font.id
-
--- an "unsafe" version of get_font_by_id that can see all fonts
--- LuaTeX can see, which is needed when we need the font size of
--- the user-selected current font
-local function unsafe_get_font_by_id(id)
- return get_font_by_id(id) or font.fonts[id]
-end
-
--- get_font_by_name(name) -- Look up a font identifier in the
--- ``score_fonts`` table. Returns the id of the font if found, -1
--- otherwise.
-local function get_font_by_name(name)
- local id = font_id(name)
- return id >= 0 and get_font_by_id(id)
-end
-
--- get_score_font_id(name) -- Look up a font identifier in the
--- ``score_fonts`` table. Returns the id of the font if found, -1
--- otherwise.
-local function get_score_font_id(name)
- local sfnt = score_fonts[name]
- if sfnt then
- return font_id(sfnt)
+ 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
- return -1
-end
-
-local resource_dummy = { unicodes = { } }
-
--- get_font_resources(number) -- Retrieve the resource table
--- associated with a font id. Always returns a Lua table value whose
--- ``unicodes`` field is indexable.
-local function get_font_resources(id)
- local fnt = get_font_by_id(id)
- if fnt then
- return fnt.resources or resource_dummy
+ 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
- return resource_dummy
-end
-
--- get_score_font_resources(string) -- Retrieve the resource table
--- belonging to a font in the ``score_font`` table. Always returns
--- a table whose ``unicodes`` field is indexable.
-local function get_score_font_resources(name)
- return get_font_resources(get_score_font_id(name))
+ os.remove(snippet_filename)
+ os.remove(snippet_logname)
end
-local function get_score_font_unicode_pairs(name)
- local unicodes = get_score_font_resources(name).unicodes
- if not font_indexed[name] then
- -- The unicodes table may be lazy-loaded, so iterating it may not
- -- return everything. Attempting to retrieve the code point of a
- -- glyph that has not already been loaded will trigger the __index
- -- method in the metatable (implemented by the fontloader) to load
- -- the table until the glyph is found. When iterating the
- -- unicodes, we want the whole table to be filled, so we try to
- -- access a non-existing glyph in order to force load the entire
- -- table.
- local ignored = unicodes['_this_is_hopefully_a_nonexistent_glyph_']
- font_indexed[name] = true
- end
- return pairs(unicodes)
+local function get_gregoriotexluaversion()
+ return internalversion
end
-local function check_font_version()
- local gregoriofont = get_font_by_name('gre@font@music')
+local function check_one_font_version(name)
+ local gregoriofont = get_font_by_name(name)
if gregoriofont then
local fontversion = gregoriofont.shared.rawdata.metadata.version
if fontversion and string.match(fontversion, "%d+%.%d+%.%d+") ~= string.match(internalversion, "%d+%.%d+%.%d+") then
@@ -721,12 +951,18 @@ local function check_font_version()
end
end
+local function check_font_version()
+ check_one_font_version('gre@font@music')
+ check_one_font_version('gre@font@music@hollow')
+ check_one_font_version('gre@font@music@hole')
+end
+
local function map_font(name, prefix)
log("Mapping font %s", name)
local glyph, unicode
for glyph, unicode in get_score_font_unicode_pairs(name) do
if unicode >= 0 and not string.match(glyph, '%.') then
- log("Setting \\Gre%s%s to \\char%d", prefix, glyph, unicode)
+ debugmessage("mapfont", "Setting \\Gre%s%s to \\char%d", prefix, glyph, unicode)
tex.sprint(catcode_at_letter, string.format(
[[\xdef\Gre%s%s{\char%d}]], prefix, glyph, unicode))
end
@@ -741,13 +977,18 @@ local function init_variant_font(font_name, for_score, gre_factor)
font_table[font_name] = font_csname
log("Registering variant font %s as %s.", font_name, font_csname)
if for_score then
+ local _, name, factor
+ _, _, name, factor = string.find(font_name, '^([^@]*)@(%d*)$')
+ name = name or font_name
+ factor = factor or '100000'
+ local size = gre_factor * tonumber(factor)
tex.print(catcode_at_letter, string.format(
- [[\global\font\%s = {name:%s} at 10 sp\relax ]],
- font_csname, font_name))
+ [[\global\font\%s = {name:%s} at %s sp\relax ]],
+ font_csname, name, size))
-- loaded_font_sizes will only be given a value if the font is for_score
- loaded_font_sizes[font_name] = {size = '10', gre_factor = gre_factor}
+ loaded_font_sizes[font_name] = {size = size, gre_factor = gre_factor}
if font_factors[font_name] == nil then
- font_factors[font_name] = '100000'
+ font_factors[font_name] = factor
end
else
-- is there a nice way to make this string readable?
@@ -762,14 +1003,14 @@ local function init_variant_font(font_name, for_score, gre_factor)
end
local function set_score_glyph(csname, font_csname, char)
- log([[Setting \%s to \%s\char%d]], csname, font_csname, char)
+ debugmessage('changeglyph', [[Setting \%s to \%s\char%d]], csname, font_csname, char)
tex.print(catcode_at_letter, string.format(
[[\edef\%s{{\noexpand\%s\char%d}}]], csname, font_csname, char))
end
local function set_common_score_glyph(csname, font_csname, char)
-- font_csname is ignored
- log([[Setting \%s to \char%d]], csname, char)
+ debugmessage('changeglyph', [[Setting \%s to \char%d]], csname, char)
tex.print(catcode_at_letter, string.format(
[[\edef\%s{{\char%d}}]], csname, char))
end
@@ -804,32 +1045,46 @@ local function def_glyph(csname, font_name, glyph, font_table, setter)
setter(csname, font_csname, char)
end
-local function change_single_score_glyph(glyph_name, font_name, replacement)
- if font_name == '*' then def_glyph('GreCP'..glyph_name, 'greciliae', replacement, score_fonts, set_common_score_glyph)
+local function general_font_for(cavum)
+ if cavum == 'Hollow' then
+ return 'greciliae-hollow'
+ elseif cavum == 'Hole' then
+ return 'greciliae-hole'
+ else
+ return 'greciliae'
+ end
+end
+
+local function change_single_score_glyph(glyph_name, cavum, font_name, replacement)
+ if font_name == '*' then
+ def_glyph('Gre'..cavum..'CP'..glyph_name, general_font_for(cavum),
+ replacement, score_fonts, set_common_score_glyph)
else
- def_glyph('GreCP'..glyph_name, font_name, replacement, score_fonts,
- set_score_glyph)
+ def_glyph('Gre'..cavum..'CP'..glyph_name, font_name, replacement,
+ score_fonts, set_score_glyph)
end
end
-local function change_score_glyph(glyph_name, font_name, replacement)
+local function change_score_glyph(glyph_name, font_name, replacement, cavum)
+ cavum = cavum or ''
if string.match(glyph_name, '%*') then
glyph_name = '^'..glyph_name:gsub('%*', '.*')..'$'
if not string.match(replacement, '^%.') then
err('If a wildcard is supplied for glyph name, replacement must start with a dot.')
end
+ local general_font = general_font_for(cavum)
local other_font
if font_name == '*' then
- other_font = get_score_font_resources('greciliae').unicodes
+ other_font = get_score_font_resources(general_font).unicodes
else
other_font = get_score_font_resources(font_name).unicodes
end
local name, char
- for name, char in get_score_font_unicode_pairs('greciliae') do
+ for name, char in get_score_font_unicode_pairs(general_font) do
if not string.match(name, '%.') and char >= 0 and string.match(name, glyph_name) then
local matched_replacement = name..replacement
if other_font[matched_replacement] ~= nil and other_font[matched_replacement] >= 0 then
- change_single_score_glyph(name, font_name, matched_replacement)
+ change_single_score_glyph(name, cavum, font_name, matched_replacement)
end
end
end
@@ -837,25 +1092,27 @@ local function change_score_glyph(glyph_name, font_name, replacement)
if string.match(replacement, '^%.') then
replacement = glyph_name..replacement
end
- change_single_score_glyph(glyph_name, font_name, replacement)
+ change_single_score_glyph(glyph_name, cavum, font_name, replacement)
end
end
-local function reset_score_glyph(glyph_name)
+local function reset_score_glyph(glyph_name, cavum)
+ cavum = cavum or ''
+ local general_font = general_font_for(cavum)
if string.match(glyph_name, '%*') then
glyph_name = '^'..glyph_name:gsub('%*', '.*')..'$'
local name, char
- for name, char in get_score_font_unicode_pairs('greciliae') do
+ for name, char in get_score_font_unicode_pairs(general_font) do
if not string.match(name, '%.') and char >= 0 and string.match(name, glyph_name) then
- set_common_score_glyph('GreCP'..name, nil, char)
+ set_common_score_glyph('Gre'..cavum..'CP'..name, nil, char)
end
end
else
- local char = get_score_font_resources("greciliae").unicodes[glyph_name]
+ local char = get_score_font_resources(general_font).unicodes[glyph_name]
if char == nil then
err('\nGlyph %s was not found.', glyph_name)
end
- set_common_score_glyph('GreCP'..glyph_name, nil, char)
+ set_common_score_glyph('Gre'..cavum..'CP'..glyph_name, nil, char)
end
end
@@ -863,12 +1120,17 @@ local function set_font_factor(font_name, font_factor)
font_factors[font_name] = font_factor
end
-local function scale_score_fonts(size, gre_factor)
+local function scale_score_fonts(gre_factor)
for font_name, font_csname in pairs(score_fonts) do
if loaded_font_sizes[font_name] and font_factors[font_name] and loaded_font_sizes[font_name].size ~= gre_factor * font_factors[font_name] then
+ local _, name
+ _, _, name, _ = string.find(font_name, '^([^@]*)@(%d*)$')
+ name = name or font_name
+ local size = gre_factor * font_factors[font_name]
+ log("%s : %s : rescaling %s to %s", font_name, font_csname, name, size)
tex.print(catcode_at_letter, string.format(
[[\global\font\%s = {name:%s} at %s sp\relax ]],
- font_csname, font_name, gre_factor * font_factors[font_name]))
+ font_csname, name, size))
loaded_font_sizes[font_name] = {size = size, gre_factor = gre_factor}
end
end
@@ -883,78 +1145,209 @@ local function font_size()
tex.print(string.format('%.2f', (unsafe_get_font_by_id(font.current()).size / 65536.0)))
end
-local function adjust_line_height(inside_discretionary)
- if score_heights then
- local heights = score_heights[tex.getattribute(glyph_id_attr)]
- if heights then
+local function adjust_line_height_internal(heights, inside_discretionary, for_next_line)
+ local backup_dims = saved_dims
+ local backup_counts = saved_counts
+ -- restore saved dims
+ local name, value
+ for name, value in pairs(saved_dims) do
+ tex.sprint(catcode_at_letter, string.format(
+ [[\grechangedim{%s}{%s}{%s}]], name, value[1], value[2]))
+ end
+ for name, value in pairs(saved_counts) do
+ tex.sprint(catcode_at_letter, string.format(
+ [[\grechangecount{%s}{%s}]], name, value))
+ end
+ -- clear saved dims
+ saved_dims = {}
+ saved_counts = {}
+ -- apply per-line dims
+ local line_dims = per_line_dims[heights[1]]
+ if line_dims ~= nil then
+ for name, value in pairs(line_dims) do
+ tex.sprint(catcode_at_letter, string.format(
+ [[\gre@changedimforline{%s}{%s}{%s}]], name, value[1], value[2]))
+ end
+ end
+ local line_counts = per_line_counts[heights[1]]
+ if line_counts ~= nil then
+ for name, value in pairs(line_counts) do
+ tex.sprint(catcode_at_letter, string.format(
+ [[\gre@changecountforline{%s}{%s}]], name, value))
+ end
+ end
+ -- recalculate spaces
+ tex.sprint(catcode_at_letter, string.format(
+ [[\gre@calculate@additionalspaces{%d}{%d}{%d}{%d}]],
+ heights[2], heights[3], heights[4], heights[5]))
+ if inside_discretionary == 0 then
+ tex.sprint(catcode_at_letter, [[\gre@updateleftbox ]])
+ end
+ if for_next_line then
+ -- IS THIS GOOD ENOUGH???
+ -- restore saved dims (from current line)
+ local name, value
+ for name, value in pairs(saved_dims) do
+ tex.sprint(catcode_at_letter, string.format(
+ [[\grechangedim{%s}{%s}{%s}]], name, value[1], value[2]))
+ end
+ for name, value in pairs(saved_counts) do
tex.sprint(catcode_at_letter, string.format(
- [[\gre@calculate@additionalspaces{%d}{%d}{%d}{%d}]],
- heights[1], heights[2], heights[3], heights[4]))
- if inside_discretionary == 0 then
- tex.sprint(catcode_at_letter, [[\gre@updateleftbox ]])
+ [[\grechangecount{%s}{%s}]], name, value))
+ end
+ -- put previous saved dims back
+ saved_dims = backup_dims
+ saved_counts = backup_counts
+ end
+end
+
+local function adjust_line_height(inside_discretionary, for_next_line)
+ if score_heights then
+ local heights = nil
+ if for_next_line then
+ local last = score_heights['last']
+ if last then
+ local target_id = tex.getattribute(glyph_id_attr) + 1
+ while target_id <= last do
+ heights = score_heights[target_id]
+ if heights then break end
+ target_id = target_id + 1
+ end
end
+ else
+ heights = score_heights[tex.getattribute(glyph_id_attr)]
+ end
+ if heights then
+ adjust_line_height_internal(heights, inside_discretionary, for_next_line)
end
end
end
-local function var_brace_note_pos(brace, start_end)
- tex.print(catcode_at_letter, string.format([[\luatexlatelua{gregoriotex.late_brace_note_pos('%s', %d, %d, \number\gre@lastxpos)}]], cur_score_id, brace, start_end))
+local function save_dim(name, value, modifier)
+ saved_dims[name] = { value, modifier }
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] = {}
- end
- if new_var_brace_positions[score_id][brace] == nil then
- new_var_brace_positions[score_id][brace] = {}
+local function save_count(name, value)
+ saved_counts[name] = value
+end
+
+local function change_next_score_line_dim(line_expr, name, value, modifier)
+ local linenum_str
+ for linenum_str in string.gmatch(line_expr, "%s*([^,]+)%s*") do
+ local linenum = tonumber(linenum_str)
+ local line_dims = per_line_dims[linenum]
+ if line_dims == nil then
+ line_dims = {}
+ per_line_dims[linenum] = line_dims
+ end
+ line_dims[name] = { value, modifier }
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
+local function change_next_score_line_count(line_expr, name, value)
+ local linenum_str
+ for linenum_str in string.gmatch(line_expr, "([^,]+)") do
+ local linenum = tonumber(linenum_str)
+ local line_counts = per_line_counts[linenum]
+ if line_counts == nil then
+ line_counts = {}
+ per_line_counts[linenum] = line_counts
end
+ line_counts[name] = value
end
- tex.print('2mm')
end
-local function save_pos(index, which)
- tex.print(catcode_at_letter, string.format([[\gre@savepos\luatexlatelua{gregoriotex.late_save_pos('%s', %d, %d, \number\gre@lastxpos, \number\gre@lastypos)}]], cur_score_id, index, which))
+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_save_pos(score_id, index, which, xpos, ypos)
- if new_pos_saves[score_id] == nil then
- new_pos_saves[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 new_pos_saves[score_id][index] == nil then
- new_pos_saves[score_id][index] = {}
+ --[[
+ if pos.fn == nil then
+ err('Attempting to reuse position save slot %d', index)
+ return
+ end
+ --]]
+ 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_pos_saves[score_id][index][(2 * which) - 1] = xpos
- new_pos_saves[score_id][index][2 * which] = ypos
+end
+
+local function compute_saved_length(score_id, index, pos)
+ if new_saved_lengths[score_id] == nil then
+ new_saved_lengths[score_id] = {}
+ end
+ 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_length(index, which)
+ if which == 1 then
+ prep_save_position(index, compute_saved_length)
+ end
+ save_position(index, which)
+end
+
+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
+ 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
+ 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,39 +1424,74 @@ local function mode_part(part)
end
end
-gregoriotex.number_to_letter = number_to_letter
-gregoriotex.init = init
-gregoriotex.include_score = include_score
-gregoriotex.atScoreEnd = atScoreEnd
-gregoriotex.atScoreBeginning = atScoreBeginning
-gregoriotex.check_font_version = check_font_version
-gregoriotex.get_gregorioversion = get_gregorioversion
-gregoriotex.map_font = map_font
-gregoriotex.init_variant_font = init_variant_font
-gregoriotex.change_score_glyph = change_score_glyph
-gregoriotex.reset_score_glyph = reset_score_glyph
-gregoriotex.scale_score_fonts = scale_score_fonts
-gregoriotex.set_font_factor = set_font_factor
-gregoriotex.def_symbol = def_symbol
-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.mark_translation = mark_translation
-gregoriotex.mark_abovelinestext = mark_abovelinestext
-gregoriotex.width_to_bp = width_to_bp
-gregoriotex.hypotenuse = hypotenuse
-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.mode_part = mode_part
-gregoriotex.set_debug_string = set_debug_string
+-- this function is meant to be used from \ifcase; prints 0 for true and 1 for false
+local function is_last_syllable_on_line()
+ if score_last_syllables then
+ if score_last_syllables[tex.getattribute(syllable_id_attr)] then
+ tex.print(0)
+ else
+ tex.print(1)
+ end
+ else
+ -- if the last syllable is not computed, treat all syllables as the
+ -- last on a line
+ tex.print(0)
+ end
+end
+
+local function hash_spaces(name, value)
+ hashed_spaces[name] = value
+ local k, _
+ local keys = {}
+ for k,_ in pairs(hashed_spaces) do
+ table.insert(keys, k)
+ end
+ table.sort(keys)
+ local mash = ''
+ for _,k in ipairs(keys) do
+ mash = string.format('%s%s:%s|', mash, k, hashed_spaces[k])
+ end
+ space_hash = md5.sumhexa(mash)
+end
+
+gregoriotex.number_to_letter = number_to_letter
+gregoriotex.init = init
+gregoriotex.include_score = include_score
+gregoriotex.at_score_end = at_score_end
+gregoriotex.at_score_beginning = at_score_beginning
+gregoriotex.check_font_version = check_font_version
+gregoriotex.get_gregoriotexluaversion = get_gregoriotexluaversion
+gregoriotex.map_font = map_font
+gregoriotex.init_variant_font = init_variant_font
+gregoriotex.change_score_glyph = change_score_glyph
+gregoriotex.reset_score_glyph = reset_score_glyph
+gregoriotex.scale_score_fonts = scale_score_fonts
+gregoriotex.set_font_factor = set_font_factor
+gregoriotex.def_symbol = def_symbol
+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.save_length = save_length
+gregoriotex.mark_translation = mark_translation
+gregoriotex.mark_abovelinestext = mark_abovelinestext
+gregoriotex.width_to_bp = width_to_bp
+gregoriotex.hypotenuse = hypotenuse
+gregoriotex.rotation = rotation
+gregoriotex.scale_space = scale_space
+gregoriotex.set_header_capture = set_header_capture
+gregoriotex.capture_header = capture_header
+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
+gregoriotex.is_last_syllable_on_line = is_last_syllable_on_line
+gregoriotex.hash_spaces = hash_spaces
+gregoriotex.save_dim = save_dim
+gregoriotex.save_count = save_count
+gregoriotex.change_next_score_line_dim = change_next_score_line_dim
+gregoriotex.change_next_score_line_count = change_next_score_line_count
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 bc148ea9b84..43d1cc7b9a0 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.tex
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.tex
@@ -1,6 +1,6 @@
% GregorioTeX boostrap file for Plain TeX
%
-% Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md)
+% Copyright (C) 2015-2017 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
@@ -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/08/18 v4.1.5 GregorioTeX system.]% PARSE_VERSION_DATE_LTX
+% [2017/04/16 v5.0.1 GregorioTeX system.]% PARSE_VERSION_DATE_LTX
\edef\greoldcatcode{\the\catcode`@}
@@ -90,8 +90,17 @@
\def\gre@strip@pt{\expandafter\gre@rem@pt\the}%
\long\def\gre@iflatex#1{}%
+\long\def\gre@ifnotlatex#1{#1}%
\input gregoriotex-main.tex
+
+%%%%%%%%%
+%% Color definitions
+%%%%%%%%%
+
+\definecolor{grebackgroundcolor}{RGB}{255,255,255}%
+\definecolor{gregoriocolor}{RGB}{229,53,44}%
+
%%%%%%%%%
%% PlainTeX specific definitions for fonts
%%%%%%%%%
@@ -106,8 +115,14 @@
%\relax
}%
+% Since small caps in PlainTeX requires loading another font, it is not defined by default. This command maintains compatibility by checking to see if \sc has been defined and raising a warning when it hasn’t
\def\GreSmallCaps#1{%
- {\sc #1}%
+ \ifdefined\sc%
+ {\sc #1}%
+ \else%
+ \gre@warning{Small caps (\protect\sc) is not defined}%
+ {#1}%
+ \fi%
\relax %
}%
@@ -116,16 +131,14 @@
\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}%
+\def\GreUnderline#1{%
+ $\underline{\rm #1}$
\relax %
}%
@@ -136,32 +149,14 @@
% 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
%%%%%%%%%%%%%%%%%%%%
-\font\gre@font@biginitial=pncr at 80pt\relax%%% DEPRECATED for removal in 5.0
\font\gre@font@initial=pncr at 40pt\relax%
\def\gre@style@initial{%
@@ -171,13 +166,6 @@
}%
\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
-}%%% DEPRECATED for removal in 5.0
-\def\endgre@style@biginitial{\endgroup}%%% DEPRECATED for removal in 5.0
-
\def\gre@style@translation{%
\begingroup%
\it%
@@ -238,7 +226,6 @@
\def\gre@style@modeline{%
\begingroup%
\bf%
- \sc%
\relax%
}%
\def\endgre@style@modeline{\endgroup}%
@@ -261,7 +248,7 @@
\def\gre@style@commentary{%
\begingroup%
\it%
- % footnotesize is LaTeX, but nothing here since changing font size is so hard
+ % footnotesize in LaTeX, but nothing here since changing font size is so hard
\relax%
}%
\def\endgre@style@commentary{\endgroup}%
@@ -269,7 +256,7 @@
\def\gre@style@elision{%
\begingroup%
\it%
- % small is LaTeX, but nothing here since changing font size is so hard
+ % small in LaTeX, but nothing here since changing font size is so hard
\relax%
}%
\def\endgre@style@elision{\endgroup}%
@@ -282,13 +269,19 @@
\def\gre@style@nabc{%
\begingroup%
- \relax% we do nothing since colors are not implemented in PlainTeX
+ \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}%
}%
+%%%%%%%%%%%%%%%
+%% Default Mode Numbering style
+%%%%%%%%%%%%%%%
+
+\gresetmodenumbersystem{roman-majuscule}%
+
\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 aa7606bb2d9..8a8a3c7b13d 100644
--- a/Master/texmf-dist/tex/luatex/gregoriotex/gsp-default.tex
+++ b/Master/texmf-dist/tex/luatex/gregoriotex/gsp-default.tex
@@ -1,6 +1,6 @@
%GregorioTeX file.
%
-% Copyright (C) 2010-2016 The Gregorio Project (see CONTRIBUTORS.md)
+% Copyright (C) 2010-2017 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
@@ -22,52 +22,66 @@
%% 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}%
+% Protrusion factors
+
+% protrusion factor for comma
+\gresetprotrusionfactor{,}{0}%
+% protrusion factor for semicolon
+\gresetprotrusionfactor{;}{0}%
+% protrusion factor for colon
+\gresetprotrusionfactor{:}{0}%
+% protrusion factor for period
+\gresetprotrusionfactor{.}{0}%
+% protrusion factor for hyphens added automatically in the Lua phase
+\gresetprotrusionfactor{eolhyphen}{0}%
+% protrusion factor used by <pr> without an argument
+\gresetprotrusionfactor{default}{1}%
%%%%%%%%%%%%%%%%%%%
%% And finally, all the spacings:
@@ -109,9 +123,9 @@
% 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}%
+\grecreatedim{spacebeforeeolcustos}{0.23 cm plus 0 cm minus 0 cm}{scalable}%
% space before punctum mora and augmentum duplex
\grecreatedim{spacebeforesigns}{0.050 cm plus 0.004 cm minus 0.004 cm}{scalable}%
% when a syllable is shifted left because of a preceding punctum mora, moraadjustmentbar is
@@ -119,24 +133,25 @@
% This version is the general case.
\grecreatedim{moraadjustment}{0.050 cm}{scalable}%
% This version is for when punctum mora is before a bar.
-\grecreatedim{moraadjustmentbar}{0 cm}{scalable}%
+\grecreatedim{moraadjustmentbar}{0.050 cm}{scalable}%
% space after punctum mora and augmentum duplex
\grecreatedim{spaceaftersigns}{0.08203 cm plus 0.0082 cm minus 0.0082 cm}{scalable}%
% space after a clef at the beginning of a line
-\grecreatedim{spaceafterlineclef}{0.27345 cm plus 0.14584 cm minus 0.01367 cm}{scalable}%
+\grecreatedim{spaceafterlineclef}{0.23 cm plus 0 cm minus 0.01367 cm}{scalable}%
+% space after a clef at the beginning of a line, when the clef and first note are vertically distant
+\grecreatedim{shortspaceafterlineclef}{0.18 cm plus 0 cm minus 0.01367 cm}{scalable}%
% minimal space between notes of different words
-\grecreatedim{interwordspacenotes}{0.27 cm plus 0.15 cm minus 0.05 cm}{scalable}%
+\grecreatedim{interwordspacenotes}{0.29 cm plus 0.05 cm minus 0.05 cm}{scalable}%
% minimal space between notes of the same syllable.
\grecreatedim{intersyllablespacenotes}{0.24 cm}{scalable}%
% 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}{0.17 cm plus 0.05 cm minus 0.05 cm}{scalable}%
% 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{interwordspacenotes@euouae}{0.23 cm plus 0.1 cm minus 0.05 cm}{scalable}%
+\grecreatedim{interwordspacetext@euouae}{0.21 cm plus 0.1 cm minus 0.05 cm}{scalable}%
% 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 +167,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
@@ -163,13 +180,13 @@
% space between puncta inclinata, larger ambitus (range=4th or 5th)
\grecreatedim{punctuminclinatummaxshift}{0.17865 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
% space between two ascending punctum inclinatum
-\grecreatedim{ascendingpunctuminclinatumshift}{-0.07918 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
+\grecreatedim{ascendingpunctuminclinatumshift}{-0.03918 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
% space between a punctum inclinatum and a punctum inclinatum deminutus, ascending
-\grecreatedim{ascendingpunctuminclinatumanddebilisshift}{-0.06278 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
+\grecreatedim{ascendingpunctuminclinatumanddebilisshift}{-0.02278 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
% space between ascending puncta inclinata, larger ambitus (range=3rd)
-\grecreatedim{ascendingpunctuminclinatumbigshift}{-0.00435 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
+\grecreatedim{ascendingpunctuminclinatumbigshift}{0.07565 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
% space between ascending puncta inclinata, larger ambitus (range=4th or 5th)
-\grecreatedim{ascendingpunctuminclinatummaxshift}{0.09865 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
+\grecreatedim{ascendingpunctuminclinatummaxshift}{0.17865 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
% space between a punctum inclinatum and a no-bar glyph one pitch below
\grecreatedim{descendinginclinatumtonobarshift}{-0.00073 cm plus 0.00363 cm minus 0.00363 cm}{scalable}%
% space between a punctum inclinatum and a no-bar glyph two pitches below
@@ -182,6 +199,11 @@
\grecreatedim{ascendinginclinatumtonobarbigshift}{0.04427 cm plus 0.00363 cm minus 0.00363 cm}{scalable}%
% space between a punctum inclinatum and a no-bar glyph three or four pitches above
\grecreatedim{ascendinginclinatumtonobarmaxshift}{0.12927 cm plus 0.00363 cm minus 0.00363 cm}{scalable}%
+% space between two descending punctum inclinatum glyphs in an ascent
+\grecreatedim{descendingpunctuminclinatumascendingshift}{-0.07918 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
+% space between two ascending punctum inclinatum glyphs in an descent
+\grecreatedim{ascendingpunctuminclinatumdescendingshift}{-0.07918 cm plus 0.0009 cm minus 0.0009 cm}{scalable}%
+
%
%%%%%%%%
% bars %
@@ -190,7 +212,10 @@
% bars inside syllables
%
\grecreatedim{bar@virgula}{0.1823 cm plus 0.22787 cm minus 0.00469 cm}{scalable}%
+% short versions are when the notes are very low (virgula and minima only)
+\grecreatedim{bar@virgula@short}{0.13 cm plus 0.05 cm minus 0.00469 cm}{scalable}%
\grecreatedim{bar@minima}{0.1823 cm plus 0.22787 cm minus 0.00469 cm}{scalable}%
+\grecreatedim{bar@minima@short}{0.12 cm plus 0.05 cm minus 0.00469 cm}{scalable}%
\grecreatedim{bar@minor}{0.1823 cm plus 0.22787 cm minus 0.00469 cm}{scalable}%
% dominican bars
\grecreatedim{bar@dominican}{0.1823 cm plus 0.22787 cm minus 0.00469 cm}{scalable}%
@@ -203,7 +228,9 @@
% plus or minus here will trigger some problems
%
\grecreatedim{bar@virgula@standalone@text}{0.2323 cm}{scalable}%
+\grecreatedim{bar@virgula@standalone@text@short}{0.19 cm}{scalable}%
\grecreatedim{bar@minima@standalone@text}{0.2323 cm}{scalable}%
+\grecreatedim{bar@minima@standalone@text@short}{0.19 cm}{scalable}%
\grecreatedim{bar@minor@standalone@text}{0.2323 cm}{scalable}%
\grecreatedim{bar@dominican@standalone@text}{0.2323 cm}{scalable}%
\grecreatedim{bar@maior@standalone@text}{0.2323 cm}{scalable}%
@@ -213,8 +240,10 @@
%
% bars having their own syllable, with no text associated (new bar spacing algorithm only)
%
-\grecreatedim{bar@virgula@standalone@notext}{0.2323 cm}{scalable}%
-\grecreatedim{bar@minima@standalone@notext}{0.2323 cm}{scalable}%
+\grecreatedim{bar@virgula@standalone@notext}{0.2 cm}{scalable}%
+\grecreatedim{bar@virgula@standalone@notext@short}{0.19 cm}{scalable}%
+\grecreatedim{bar@minima@standalone@notext}{0.2 cm}{scalable}%
+\grecreatedim{bar@minima@standalone@notext@short}{0.19 cm}{scalable}%
\grecreatedim{bar@minor@standalone@notext}{0.2323 cm}{scalable}%
\grecreatedim{bar@dominican@standalone@notext}{0.2323 cm}{scalable}%
\grecreatedim{bar@maior@standalone@notext}{0.2323 cm}{scalable}%
@@ -223,16 +252,19 @@
%
% 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.18 cm}{scalable}%
% 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.18 cm}{scalable}%
+\grecreatedim{interwordspacetext@bars@notext}{0.19 cm}{scalable}%
% 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.18 cm}{scalable}%
% 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}%
+\grecreatedim{bar@rubber}{0 cm plus 0.025 cm minus 0.025 cm}{scalable}%
+% in the case of an alteration after a bar, the alteration will "protrude" left of this value
+% think of it as some kind of moraadjustmentbar
+\grecreatedim{alterationadjustmentbar}{0.07 cm}{scalable}%
% additional space that will appear around bars that are preceded by a custos and followed by a key.
\grecreatedim{spacearoundclefbars}{0.03645 cm plus 0.00455 cm minus 0.0009 cm}{scalable}%
% space between the text of previous syllable and text associated with a bar (old bar spacing algorithm only)
@@ -240,9 +272,9 @@
% minimal space between a note and a bar (old algorithm only)
\grecreatedim{notebarspace}{0.31903 cm plus 0.27345 cm minus 0.02824 cm}{scalable}%
% Maximum offset between a bar and its associated text when the text goes left of the bar (new bar spacing algorithm only)
-\grecreatedim{maxbaroffsettextleft}{0.6 cm}{scalable}%
+\grecreatedim{maxbaroffsettextleft}{0.3 cm}{scalable}%
% Same as maxbaroffsettextleft when text goes right of the bar
-\grecreatedim{maxbaroffsettextright}{0 cm}{scalable}%
+\grecreatedim{maxbaroffsettextright}{0.15 cm}{scalable}%
% Maximum offset between a no-bar (i.e. something like `text()` in gabc) and its associated text when the text goes left of the no-bar (new bar spacing algorithm only)
\grecreatedim{maxbaroffsettextleft@nobar}{12 cm}{scalable}%
% Same as maxbaroffsettextleft@nobar when text goes right of the no-bar
@@ -260,27 +292,29 @@
% an extensible space for the beginning of lines
\grecreatedim{afterclefnospace}{0 cm plus 0.27345 cm minus 0 cm}{scalable}%
% space between the initial and the beginning of the score
-\grecreatedim{afterinitialshift}{0.2457 cm}{scalable}%
+\grecreatedim{afterinitialshift}{0.2 cm}{scalable}%
% space before the initial
-\grecreatedim{beforeinitialshift}{0.2457 cm}{scalable}%
+\grecreatedim{beforeinitialshift}{0.2 cm}{scalable}%
% when bolshifts are enabled, minimum space between beginning of line and first syllable text
\grecreatedim{minimalspaceatlinebeginning}{0.05 cm}{scalable}%
% space to force the initial width to. Ignored when 0.
\grecreatedim{manualinitialwidth}{0 cm}{scalable}%
+% minimum width of the initial. Ignored when manualinitialwidth is non-zero.
+\grecreatedim{minimalinitialwidth}{0 cm}{scalable}%
% distance to move the initial up by
\grecreatedim{initialraise}{0 cm}{scalable}%
% Space between lines in the annotation
-\grecreatedim{annotationseparation}{0.05cm}{scalable}%
+\grecreatedim{annotationseparation}{0.05 cm}{scalable}%
% Amount to raise (positive) or lower (negative) the annotations from the default position
-\grecreatedim{annotationraise}{0cm}{scalable}%
+\grecreatedim{annotationraise}{-0.2 cm}{scalable}%
% Space between lines in the commentary
-\grecreatedim{commentaryseparation}{0.05cm}{scalable}%
+\grecreatedim{commentaryseparation}{0.05 cm}{scalable}%
% Amount to raise (positive) or lower (negative) the commentary from the default position (base line of bottom commentary aligned with top line of staff)
-\grecreatedim{commentaryraise}{0.2cm}{scalable}%
+\grecreatedim{commentaryraise}{0.2 cm}{scalable}%
% 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}%
@@ -301,16 +335,25 @@
% the space for the translation
\grecreatedim{translationheight}{0.5 cm}{scalable}%
%the space above the lines
-\grecreatedim{spaceabovelines}{0.45576 cm plus 0.36461 cm minus 0.09114 cm}{scalable}%
+\grecreatedim{spaceabovelines}{0 cm}{scalable}%
% this counter is the threshold above which we start accounting notes above
% lines for additional space above lines. For instance with a threshold of
-% 2, notes with a pitch of k and l will not interfere with the space above
-% lines
+% 2 and a staff of 4 lines, notes with a pitch of k and l will not interfere
+% with the space above lines
\grechangecount{additionaltopspacethreshold}{2}%
% same, for notes taken into account for alt text vertical position
\grechangecount{additionaltopspacealtthreshold}{0}%
+% same, for notes taken into account for nabc vertical position
+\grechangecount{additionaltopspacenabcthreshold}{4}%
%the space between the lines and the bottom of the text
\grecreatedim{spacelinestext}{0.60617 cm}{scalable}%
+%the per-note additional space between lines and the bottom of the text
+\grecreatedim{noteadditionalspacelinestext}{0.14413 cm}{scalable}%
+% this counter is the number of low notes which will add on the
+% noteadditionalspacelinestext. For instance, with a threshold of 2, every
+% note below c will add noteadditionalspacelinestext space for each pitch needed
+% below c, accounting for the various signs.
+\grechangecount{noteadditionalspacelinestextthreshold}{2}%
%the space beneath the text
\grecreatedim{spacebeneathtext}{0 cm}{scalable}%
% height of the text above the note line
@@ -351,4 +394,16 @@
\grecreatedim{spaceporrectuspunctummorashift}{0.00000 cm}{scalable}%
% shift for a rare sign
\grecreatedim{raresignshift}{0.18302 cm}{scalable}%
+% up-shift for a bracket
+\grecreatedim{bracketupshift}{0.03000 cm}{scalable}%
+% down-shift for a bracket
+\grecreatedim{bracketdownshift}{0.04000 cm}{scalable}%
%
+
+%%%%%%%%%%
+%% Line spacings
+%%%%%%%%%%
+\grecreatedim{parskip}{1pt plus 1pt}{scalable}%
+\grecreatedim{lineskip}{0pt plus 1pt}{scalable}%
+\grecreatedim{baselineskip}{55pt plus 5pt minus 5pt}{scalable}%
+\grecreatedim{lineskiplimit}{0pt}{scalable}%