summaryrefslogtreecommitdiff
path: root/support/gregoriotex/tex/luatex/gregoriotex-spaces.tex
diff options
context:
space:
mode:
Diffstat (limited to 'support/gregoriotex/tex/luatex/gregoriotex-spaces.tex')
-rw-r--r--support/gregoriotex/tex/luatex/gregoriotex-spaces.tex289
1 files changed, 152 insertions, 137 deletions
diff --git a/support/gregoriotex/tex/luatex/gregoriotex-spaces.tex b/support/gregoriotex/tex/luatex/gregoriotex-spaces.tex
index c9a0df14f6..a0fcc077b9 100644
--- a/support/gregoriotex/tex/luatex/gregoriotex-spaces.tex
+++ b/support/gregoriotex/tex/luatex/gregoriotex-spaces.tex
@@ -1,6 +1,6 @@
%GregorioTeX file.
%
-% Copyright (C) 2007-2019 The Gregorio Project (see CONTRIBUTORS.md)
+% Copyright (C) 2007-2021 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
@@ -19,7 +19,7 @@
% this file contains definitions of spaces
-\gre@declarefileversion{gregoriotex-spaces.tex}{5.2.1}% GREGORIO_VERSION
+\gre@declarefileversion{gregoriotex-spaces.tex}{6.0.0-beta1}% GREGORIO_VERSION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% macros for tuning penalties
@@ -35,77 +35,95 @@
-\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%
+\newcount\gre@saved@prescore@hyphenpenalty%
+\newcount\gre@saved@prescore@exhyphenpenalty%
+\newcount\gre@saved@prescore@exhyphenchar%
+\newcount\gre@saved@prescore@doublehyphendemerits%
+\newcount\gre@saved@prescore@finalhyphendemerits%
+\newcount\gre@saved@prescore@brokenpenalty%
+\newcount\gre@saved@prescore@looseness%
+\newcount\gre@saved@prescore@tolerance%
+\newcount\gre@saved@prescore@pretolerance%
+\newskip\gre@saved@prescore@emergencystretch%
+\newcount\gre@saved@prescore@widowpenalty%
+\newcount\gre@saved@prescore@clubpenalty%
+\newskip\gre@saved@prescore@parskip%
+\newskip\gre@saved@prescore@lineskip%
+\newskip\gre@saved@prescore@baselineskip%
+\newskip\gre@saved@prescore@lineskiplimit%
%% The following macros cancel some useless penalties, and reinstates them
%% at the end of a score
\def\gre@cancelpenalties{%
\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%
+ \global\gre@saved@prescore@hyphenpenalty=\hyphenpenalty\relax %
\hyphenpenalty=\gre@space@count@hyphenpenalty %
+ %
+ \global\gre@saved@prescore@exhyphenpenalty=\exhyphenpenalty\relax %
\exhyphenpenalty=\gre@space@count@hyphenpenalty %
+ %
+ \global\gre@saved@prescore@exhyphenchar=\exhyphenchar\relax %
+ \exhyphenchar=-1\relax%
+ %
+ \global\gre@saved@prescore@doublehyphendemerits=\doublehyphendemerits\relax %
\doublehyphendemerits=0\relax %
+ %
+ \global\gre@saved@prescore@finalhyphendemerits=\finalhyphendemerits\relax %
\finalhyphendemerits=0\relax %
+ %
+ \global\gre@saved@prescore@brokenpenalty=\brokenpenalty\relax %
\brokenpenalty=\gre@space@count@brokenpenalty %
+ %
+ \global\gre@saved@prescore@looseness=\looseness\relax %
\looseness=\gre@space@count@looseness %
+ %
+ \global\gre@saved@prescore@tolerance=\tolerance\relax %
\tolerance=\gre@space@count@tolerance %
+ %
+ \global\gre@saved@prescore@pretolerance=\pretolerance\relax %
\pretolerance=\gre@space@count@pretolerance %
+ %
+ \global\gre@saved@prescore@emergencystretch=\emergencystretch\relax %
\emergencystretch=\gre@space@skip@emergencystretch\relax %
+ %
+ \global\gre@saved@prescore@widowpenalty=\widowpenalty\relax %
\widowpenalty=\gre@space@count@widowpenalty %
+ %
+ \global\gre@saved@prescore@clubpenalty=\clubpenalty\relax %
\clubpenalty=\gre@space@count@clubpenalty %
+ %
+ \global\gre@saved@prescore@parskip=\parskip%
\parskip=\gre@space@skip@parskip%
+ %
+ \global\gre@saved@prescore@lineskip=\lineskip%
\lineskip=\gre@space@skip@lineskip%
+ %
+ \global\gre@saved@prescore@baselineskip=\baselineskip%
\baselineskip=\gre@space@skip@baselineskip%
+ %
+ \global\gre@saved@prescore@lineskiplimit=\lineskiplimit%
\lineskiplimit=\gre@space@skip@lineskiplimit%
\gre@trace@end%
}%
\def\gre@restorepenalties{%
\gre@trace{gre@restorepenalties}%
- \hyphenpenalty=\gre@hyphenpenaltysave %
- \exhyphenpenalty=\gre@exhyphenpenaltysave %
- \doublehyphendemerits=\gre@doublehyphendemeritssave %
- \finalhyphendemerits=\gre@finalhyphendemeritssave %
- \brokenpenalty=\gre@brokenpenaltysave %
- \looseness=\gre@loosenesssave %
- \tolerance=\gre@tolerancesave %
- \pretolerance=\gre@pretolerancesave %
- \emergencystretch=\gre@emergencystretchsave %
- \widowpenalty=\gre@widowpenaltysave %
- \clubpenalty=\gre@clubpenaltysave %
- \parskip=\gre@saved@parskip%
- \lineskip=\gre@saved@lineskip%
- \baselineskip=\gre@saved@baselineskip%
- \lineskiplimit=\gre@saved@lineskiplimit%
+ \hyphenpenalty=\gre@saved@prescore@hyphenpenalty %
+ \exhyphenpenalty=\gre@saved@prescore@exhyphenpenalty %
+ \exhyphenchar=\gre@saved@prescore@exhyphenchar %
+ \doublehyphendemerits=\gre@saved@prescore@doublehyphendemerits %
+ \finalhyphendemerits=\gre@saved@prescore@finalhyphendemerits %
+ \brokenpenalty=\gre@saved@prescore@brokenpenalty %
+ \looseness=\gre@saved@prescore@looseness %
+ \tolerance=\gre@saved@prescore@tolerance %
+ \pretolerance=\gre@saved@prescore@pretolerance %
+ \emergencystretch=\gre@saved@prescore@emergencystretch %
+ \widowpenalty=\gre@saved@prescore@widowpenalty %
+ \clubpenalty=\gre@saved@prescore@clubpenalty %
+ \parskip=\gre@saved@prescore@parskip%
+ \lineskip=\gre@saved@prescore@lineskip%
+ \baselineskip=\gre@saved@prescore@baselineskip%
+ \lineskiplimit=\gre@saved@prescore@lineskiplimit%
\gre@trace@end%
}%
@@ -114,7 +132,7 @@
%% macros for the typesetting of spaces
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Independent default distances are defined in gsp-default.tex. The distances defined here are calculated from those distances.
+% Independent default distances are defined in gregoriotex-gsp-default.tex. The distances defined here are calculated from those distances.
%%%%%%%%%%%%%%%%%
%% Global distances
@@ -148,35 +166,29 @@
% Messing with the staff line thickness directly is messy, so we provide the following interface to make life easier on the user:
% stafflineheight is the height of a staff line
-% = 1500 * stafflinefactor
+% = gre@dimen@stafflinethicknessbase * 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 %
+ \global\gre@dimen@stafflineheight=\dimexpr(\gre@dimen@stafflinethicknessbase * \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
+% = (gre@dimen@interstafflinedistancebase + gre@dimen@stafflinethicknessbase) * gre@factor - gre@dimen@stafflinethicknessbase * gre@stafflinefactor
\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%
+ \global\gre@dimen@interstafflinespace=\dimexpr((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) * \gre@factor - \gre@dimen@stafflinethicknessbase * \gre@stafflinefactor)\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
+% = gre@dimen@stafflinethicknessbase * (gre@stafflinefactor - gre@factor) / 2
\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%
+ \global\gre@dimen@stafflinediff = \dimexpr( \gre@dimen@stafflinethicknessbase * (\gre@stafflinefactor - \gre@factor) / 2 )\relax%
\gre@trace@end%
}%
@@ -187,7 +199,7 @@
\newif\ifgre@scale@stafflinefactor%
\gre@scale@stafflinefactortrue
-% a macro for setting the thickness of the staff lines. This changes the stafflinefactor and then adjusts the spaces that are affected by the thicker staff lines.
+% a macro for setting the thickness of the staff lines. The changes to stafflinefactor will be automatically picked up when the staff lines are redrawn
\def\grechangestafflinethickness#1{%
\xdef\gre@stafflinefactor{#1}%
\relax %
@@ -199,7 +211,7 @@
% 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) %
+ \global\gre@dimen@constantglyphraise = \dimexpr((\gre@dimen@glyphraisebase * \gre@factor) %
+ \gre@dimen@additionalbottomspace %
+ \gre@space@dimen@spacebeneathtext %
+ \gre@space@dimen@spacelinestext %
@@ -563,10 +575,9 @@
\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
+\def\gresethyphenprotrusion#1{% OBSOLETE
+ \gre@obsolete{\protect\gresethyphenprotrusion{percentage}}{\protect\gresetprotrusionfactor{eolhyphen}{factor}}% OBSOLETE
+}% OBSOLETE
% dimen keeping the shift computed with next function
\newdimen\gre@dimen@eolshift
@@ -794,7 +805,7 @@
\fi%
\fi%
\global\advance\gre@count@temp@three by -8 %
- \global\gre@dimen@glyphraisevalue = \dimexpr(15750 sp * \gre@factor * \gre@count@temp@three)\relax %
+ \global\gre@dimen@glyphraisevalue = \dimexpr(((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) / 2 ) * \gre@factor * \gre@count@temp@three)\relax %
\ifcase#2 %
\or\or\or%3: if it is a vertical episema on a line, we shift it a bit higher, so that it's more beautiful
\ifgre@isonaline%
@@ -898,16 +909,6 @@
% 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
@@ -939,29 +940,40 @@
\gre@trace@end%
}%
+% some backup demensions for use around discretionaries
+\newdimen\gre@saved@prediscretionary@dimen@additionalbottomspace\relax%
+\newdimen\gre@saved@prediscretionary@dimen@additionaltopspace\relax%
+\newdimen\gre@saved@prediscretionary@dimen@additionaltopspacealt\relax%
+\newdimen\gre@saved@prediscretionary@dimen@additionaltopspacenabc\relax%
+\newdimen\gre@saved@prediscretionary@dimen@currenttranslationheight\relax%
+\newdimen\gre@saved@prediscretionary@dimen@textlower\relax%
+\newdimen\gre@saved@prediscretionary@dimen@currentabovelinestextheight\relax%
+\newdimen\gre@saved@prediscretionary@dimen@constantglyphraise\relax%
+
+
\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%
+ \global\gre@saved@prediscretionary@dimen@additionalbottomspace=\gre@dimen@additionalbottomspace\relax%
+ \global\gre@saved@prediscretionary@dimen@additionaltopspace=\gre@dimen@additionaltopspace\relax%
+ \global\gre@saved@prediscretionary@dimen@additionaltopspacealt=\gre@dimen@additionaltopspacealt\relax%
+ \global\gre@saved@prediscretionary@dimen@additionaltopspacenabc=\gre@dimen@additionaltopspacenabc\relax%
+ \global\gre@saved@prediscretionary@dimen@currenttranslationheight=\gre@dimen@currenttranslationheight\relax%
+ \global\gre@saved@prediscretionary@dimen@textlower=\gre@dimen@textlower\relax%
+ \global\gre@saved@prediscretionary@dimen@currentabovelinestextheight=\gre@dimen@currentabovelinestextheight\relax%
+ \global\gre@saved@prediscretionary@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%
+ \global\gre@dimen@additionalbottomspace=\gre@saved@prediscretionary@dimen@additionalbottomspace\relax%
+ \global\gre@dimen@additionaltopspace=\gre@saved@prediscretionary@dimen@additionaltopspace\relax%
+ \global\gre@dimen@additionaltopspacealt=\gre@saved@prediscretionary@dimen@additionaltopspacealt\relax%
+ \global\gre@dimen@additionaltopspacenabc=\gre@saved@prediscretionary@dimen@additionaltopspacenabc\relax%
+ \global\gre@dimen@currenttranslationheight=\gre@saved@prediscretionary@dimen@currenttranslationheight\relax%
+ \global\gre@dimen@textlower=\gre@saved@prediscretionary@dimen@textlower\relax%
+ \global\gre@dimen@currentabovelinestextheight=\gre@saved@prediscretionary@dimen@currentabovelinestextheight\relax%
+ \global\gre@dimen@constantglyphraise=\gre@saved@prediscretionary@dimen@constantglyphraise\relax%
\gre@trace@end%
}%
@@ -977,28 +989,32 @@
\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 %
+ \global\gre@dimen@additionaltopspace=\dimexpr(((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) / 2 ) * \gre@count@temp@one * \gre@factor)\relax %
\else %
\global\gre@dimen@additionaltopspace=0 sp%
\fi %
\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 %
+ \global\gre@dimen@additionaltopspacealt=\dimexpr(((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) / 2 ) * \gre@count@temp@one * \gre@factor)\relax %
\else %
\global\gre@dimen@additionaltopspacealt=0 sp%
\fi %
\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@additionaltopspacenabc=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax %
+ \global\gre@dimen@additionaltopspacenabc=\dimexpr(((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) / 2 ) * \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 %
+ \ifgre@noteadditionalspacelinestext%
+ \global\gre@dimen@additionalbottomspace=\dimexpr(\gre@space@dimen@noteadditionalspacelinestext * \gre@count@temp@one)\relax%
+ \else%
+ \global\gre@dimen@additionalbottomspace=\dimexpr(((\gre@dimen@interstafflinedistancebase + \gre@dimen@stafflinethicknessbase) / 2 ) * \gre@factor * \gre@count@temp@one)\relax%
+ \fi%
\else %
\global\gre@dimen@additionalbottomspace=0 sp%
\fi %
@@ -1028,7 +1044,7 @@
\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}}%
+ \gre@widthof{\gre@saved@syllable@fixedtextformat{#1}\gre@fixedtextformat{#2#3}}%
\else %
\gre@widthof{\gre@fixedtextformat{#1}\gre@fixednexttextformat{#2#3}}%
\fi %
@@ -1100,8 +1116,9 @@
%% 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}}%
+%% 6 : alteration type (see gre@calculate@nextnotesaligncenter)
+\def\gre@calculate@nextbegindifference#1#2#3#4#5#6{%
+ \gre@trace{gre@calculate@nextbegindifference{#1}{#2}{#3}{#4}{#5}{#6}}%
\ifnum\gre@lastoflinecount=1\relax %
\global\gre@skip@nextbegindifference=0pt\relax%
\else %
@@ -1112,7 +1129,7 @@
\global\gre@skip@nextbegindifference=-\gre@dimen@textaligncenter\relax%
% 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
+ \gre@calculate@nextnotesaligncenter{#5}{#6}% idem
\global\advance\gre@skip@nextbegindifference by \the\gre@dimen@notesaligncenter\relax%
\global\gre@dimen@textaligncenter=\gre@dimen@temp@two %
\global\gre@dimen@notesaligncenter=\gre@dimen@temp@four %
@@ -1176,7 +1193,7 @@
%
%In the new algorithm the bar and the text are set independently of each other based purely on the positions of the corresponding element in the previous and next syllable
% #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)
+% #2 is #7:2 from \GreBarSyllable (alteration 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)
@@ -1384,7 +1401,7 @@
\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
+ \ifnum#1>0\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}%
@@ -1548,7 +1565,7 @@
%% This macro creates one dim (#1), setting its value to #2 and sets whether it should scale when the \gre@factor changes (#3, scalable or fixed). Checks that #1 can accept the kind of distance given in #2.
%% 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{%
+\def\gre@createdim#1#2#3{%
\csname newif\expandafter\endcsname\csname ifgre@scale@#1\endcsname%
\IfStrEqCase{#3}{%
{scalable}%
@@ -1558,7 +1575,7 @@
{inherited}%
{\grescaledim{#1}{false}}%
}[% all other cases
- \gre@error{Unrecognized option "#3" for \protect\grecreatedim\MessageBreak Possible options are: 'scalable' and 'fixed'}%
+ \gre@error{Unrecognized option "#3" for \protect\gre@createdim\MessageBreak Possible options are: 'scalable' and 'fixed' and 'inherited'}%
]%
\gre@dimension{#1}{#2}{#3}%
}%
@@ -1599,31 +1616,16 @@
% all other cases
}[\gre@error{Unrecognized option "#3" for \protect\grechangedim\MessageBreak Possible options are: 'scalable', 'fixed', and 'inherited'}]%
\gre@dimension{#1}{#2}{#3}%
+ %If we are calling grechangedim from a space configuration file (greconffactor is not 0)
+ % and the space configuration file is designed for a \gre@factor other than the current
+ % one, then we need to rescale the distance being changed.
+ \ifnum\greconffactor=0\else%
+ \ifnum\the\gre@factor=\greconffactor\else%
+ \gre@changeonedimenfactor{#1}{\greconffactor}{\gre@factor} %
+ \fi%
+ \fi%
\else%
- \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
- ]% OBSOLETE
+ \gre@error{#1 is not a recognized distance.}%
\fi%
}%
@@ -1802,13 +1804,24 @@
\newcount\greconffactor%
\def\greloadspaceconf#1{%
- \input gsp-#1.tex\relax %
- \ifnum\greconffactor=0\relax%
- \gre@error{gsp-#1.tex does not have an assigned staff size.\MessageBreak Please edit it to define \protect\greconffactor}%
- \fi %
- \ifnum\the\gre@factor=\greconffactor\else %If the space configuration file is designed for a \gre@factor other than the current one, then we need to rescale the distances.
- \gre@changedimenfactor{\greconffactor}{\gre@factor} %
- \fi%
+ \IfStrEq{#1}{default}{% load default spacings
+ \ifx\@onlypreamble\@notprerr%
+ \gre@debugmsg{preamble}{Not in preamble}%
+ \makeatletter%
+ \else%
+ \gre@debugmsg{preamble}{In preamble}%
+ \fi%
+ \input gregoriotex-gsp-default.tex%
+ \gre@changedimenfactor{\greconffactor}{\gre@factor}%
+ \ifx\@onlypreamble\@notprerr%
+ \makeatother%
+ \fi%
+ }{% load a custom spacing
+ \input gsp-#1.tex\relax %
+ \ifnum\greconffactor=0\relax%
+ \gre@error{gsp-#1.tex does not have an assigned staff size.\MessageBreak Please edit it to define \protect\greconffactor}%
+ \fi %
+ }
\greconffactor=0%
\relax %
}%
@@ -1896,11 +1909,13 @@
% Math
\gre@rubberpermit{#1}%
\ifgre@rubber%
+ \gre@debugmsg{gsp}{scaling a rubber}%
% if we have a rubber allowed length we create a temporary skip
\let\gre@scaledist\gre@skip@temp@one%
\edef\gre@convert{\csname gre@space@skip@#1\endcsname}%
\gre@scaledist=\glueexpr(\gre@convert * \number#3 / \number#2)\relax %
\else%
+ \gre@debugmsg{gsp}{scaling a fixed distance}%
% otherwise we create a temporary dimen
\let\gre@scaledist\gre@dimen@temp@one%
\edef\gre@convert{\csname gre@space@dimen@#1\endcsname}%