summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-04-17 22:24:58 +0000
committerKarl Berry <karl@freefriends.org>2017-04-17 22:24:58 +0000
commit9ee090cf87c7a8684f0df3dc98eb1b4aebe6acbf (patch)
treea30680f7e7a150a3c687162d082a014b23d7e215 /Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex
parentb42b0f62342cf5057d1013ea7645f9352d51a036 (diff)
gregoriotex (17apr17)
git-svn-id: svn://tug.org/texlive/trunk@43897 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex')
-rw-r--r--Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-spaces.tex1014
1 files changed, 758 insertions, 256 deletions
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%
}%