| 1 |
%GregorioTeX file. |
| 2 |
% |
| 3 |
% Copyright (C) 2007-2025 The Gregorio Project (see CONTRIBUTORS.md) |
| 4 |
% |
| 5 |
% This file is part of Gregorio. |
| 6 |
% |
| 7 |
% Gregorio is free software: you can redistribute it and/or modify |
| 8 |
% it under the terms of the GNU General Public License as published by |
| 9 |
% the Free Software Foundation, either version 3 of the License, or |
| 10 |
% (at your option) any later version. |
| 11 |
% |
| 12 |
% Gregorio is distributed in the hope that it will be useful, |
| 13 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
% GNU General Public License for more details. |
| 16 |
% |
| 17 |
% You should have received a copy of the GNU General Public License |
| 18 |
% along with Gregorio. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
|
| 21 |
% this file contains definitions of signs (bar, episema, punctum, alterations) |
| 22 |
|
| 23 |
\def\grebarbracewidth{.58879}% |
| 24 |
|
| 25 |
\gre@declarefileversion{gregoriotex-signs.tex}{6.1.0}% GREGORIO_VERSION |
| 26 |
|
| 27 |
\def\gre@usestylecommon{% |
| 28 |
\gre@trace{gre@usestylecommon}% |
| 29 |
\ifgre@usestylefont\else % |
| 30 |
\gre@usestylefonttrue% |
| 31 |
\gre@setstylefont % |
| 32 |
\fi % |
| 33 |
\relax % |
| 34 |
\gre@trace@end% |
| 35 |
}% |
| 36 |
|
| 37 |
\gresetglyphstyle{default}% |
| 38 |
|
| 39 |
% Possibility to disable some signs: |
| 40 |
\newif\ifgre@disablevepisema |
| 41 |
\gre@disablevepisemafalse |
| 42 |
\newif\ifgre@disablehepisema |
| 43 |
\gre@disablehepisemafalse |
| 44 |
\newif\ifgre@disablemora |
| 45 |
\gre@disablemorafalse |
| 46 |
|
| 47 |
\def\greprintsigns#1#2{% |
| 48 |
\gre@trace{greprintsigns{#1}{#2}}% |
| 49 |
\IfStrEqCase{#2}{% |
| 50 |
{enable}% |
| 51 |
{% |
| 52 |
\IfStrEqCase{#1}{% |
| 53 |
{vepisema}% |
| 54 |
{\global\gre@disablevepisemafalse}% |
| 55 |
{hepisema}% |
| 56 |
{\global\gre@disablehepisemafalse}% |
| 57 |
{mora}% |
| 58 |
{\global\gre@disablemorafalse}% |
| 59 |
{all}% |
| 60 |
{\global\gre@disablemorafalse\global\gre@disablevepisemafalse\global\gre@disablehepisemafalse}% |
| 61 |
}[% all other cases |
| 62 |
\gre@error{Unrecognized first argument for \protect\greprintsigns}% |
| 63 |
]% |
| 64 |
}% |
| 65 |
{disable}% |
| 66 |
{% |
| 67 |
\IfStrEqCase{#1}{% |
| 68 |
{vepisema}% |
| 69 |
{\global\gre@disablevepisematrue}% |
| 70 |
{hepisema}% |
| 71 |
{\global\gre@disablehepisematrue}% |
| 72 |
{mora}% |
| 73 |
{\global\gre@disablemoratrue}% |
| 74 |
{all}% |
| 75 |
{\global\gre@disablemoratrue\global\gre@disablevepisematrue\global\gre@disablehepisematrue}% |
| 76 |
}[% all other cases |
| 77 |
\gre@error{Unrecognized first argument for \protect\greprintsigns}% |
| 78 |
]% |
| 79 |
}% |
| 80 |
}[% all other cases |
| 81 |
\gre@error{Unrecognized second argument for \protect\greprintsigns}% |
| 82 |
]% |
| 83 |
\gre@trace@end% |
| 84 |
}% |
| 85 |
|
| 86 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 87 |
%% macros for discretionaries |
| 88 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 89 |
% |
| 90 |
% In order to avoid clef change at beginning or end of line, we use discretionaries |
| 91 |
% for clef change, or even with more complex data (z0::c3 for instance). The problem |
| 92 |
% with discretionaries is that: |
| 93 |
% - you cannot use \hskip (but you can use kern) |
| 94 |
% - you cannot use \penalty (which is useless indeed) |
| 95 |
% |
| 96 |
% To remedy that, we define \gre@hskip to be \hskip outside a discretionary, and |
| 97 |
% \kern inside a discretionary. This is what these macros do: |
| 98 |
|
| 99 |
\def\gre@falsepenalty#1{}% |
| 100 |
\def\gre@truepenalty#1{\penalty#1}% |
| 101 |
|
| 102 |
\let\gre@hskip\hskip% |
| 103 |
\let\gre@penalty\gre@truepenalty% |
| 104 |
\xdef\gre@insidediscretionary{\number 0}% |
| 105 |
|
| 106 |
% #1 is the type of discretionary, for penalty assignment. Recognized types: |
| 107 |
% - 0: clef change |
| 108 |
\def\GreDiscretionary#1#2#3{% |
| 109 |
\gre@trace{GreDiscretionary{#1}{#2}{#3}}% |
| 110 |
\gre@save@additionalspaces % |
| 111 |
\directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary, true)}% |
| 112 |
\gre@restore@additionalspaces % |
| 113 |
\global\let\gre@hskip\kern % |
| 114 |
\global\let\gre@penalty\gre@falsepenalty % |
| 115 |
\global\xdef\gre@insidediscretionary{\number 1}% |
| 116 |
\discretionary{% |
| 117 |
\global\gre@lastoflinecount=1\relax % (a good magic trick) |
| 118 |
\gre@debugmsg{bolshift}{discretionary pre lastoflinecount: \the\gre@lastoflinecount}% |
| 119 |
#2% |
| 120 |
}{% |
| 121 |
\global\gre@lastoflinecount=2\relax % (a good magic trick) |
| 122 |
\gre@debugmsg{bolshift}{discretionary post lastoflinecount: \the\gre@lastoflinecount}% |
| 123 |
}{% |
| 124 |
\gre@debugmsg{bolshift}{discretionary no lastoflinecount: \the\gre@lastoflinecount}% |
| 125 |
#3% |
| 126 |
}% |
| 127 |
\global\xdef\gre@insidediscretionary{\number 0}% |
| 128 |
\global\let\gre@hskip\hskip % |
| 129 |
\global\let\gre@penalty\gre@truepenalty % |
| 130 |
\relax % |
| 131 |
\gre@trace@end% |
| 132 |
}% |
| 133 |
|
| 134 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 135 |
%% macros for the typesetting of the clefs of the beginning of lines and custos |
| 136 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 137 |
|
| 138 |
% flag for showing the clef |
| 139 |
\newif\ifgre@showclef% |
| 140 |
\gre@showcleftrue |
| 141 |
|
| 142 |
\def\gresetclef#1{% |
| 143 |
\gre@trace{gresetclef{#1}}% |
| 144 |
\IfStrEqCase{#1}{% |
| 145 |
{visible}% |
| 146 |
{\gre@showcleftrue}% |
| 147 |
{invisible}% |
| 148 |
{\gre@showcleffalse}% |
| 149 |
}[% all other cases |
| 150 |
\gre@error{Unrecognized option "#1" for \protect\gresetclef\MessageBreak Possible options are: 'visible' and 'invisible'}% |
| 151 |
]% |
| 152 |
\gre@trace@end% |
| 153 |
}% |
| 154 |
|
| 155 |
%% macro to define the clef that will appear at the beginning of the lines |
| 156 |
%% #1 c or f: type of first clef |
| 157 |
%% #2 int: line of first clef |
| 158 |
%% #3 int: 0 if not space, 1 if normal space, 2 for short space |
| 159 |
%% #4 int: height of the flat of first clef, 3 for no flat |
| 160 |
%% #5, #6, #7 = #1, #2, #3 for second clef |
| 161 |
\def\GreSetLinesClef#1#2#3#4#5#6#7{% |
| 162 |
\gre@trace{GreSetLinesClef{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% |
| 163 |
\gre@save@clef{#1}{#2}{#4}{#5}{#6}{#7}% |
| 164 |
\gre@localleftbox{% |
| 165 |
\copy\gre@box@lines% draws the lines |
| 166 |
\unkern % |
| 167 |
\ifgre@showclef% |
| 168 |
\gre@skip@temp@four = \gre@space@skip@afterclefnospace\relax% |
| 169 |
\hbox{\gre@typeclef{#1}{#2}{0}{#3}{#4}{#5}{#6}{#7}\gre@hskip\gre@skip@temp@four}% |
| 170 |
\else % |
| 171 |
\gre@skip@temp@four = \gre@space@dimen@noclefspace\relax% |
| 172 |
\hbox{\kern\gre@skip@temp@four}% |
| 173 |
\fi % |
| 174 |
}% |
| 175 |
\xdef\gre@clefflatheight{#4}% |
| 176 |
\xdef\gre@cleftwoflatheight{#7}% |
| 177 |
\relax% |
| 178 |
\gre@trace@end% |
| 179 |
}% |
| 180 |
|
| 181 |
% defines the largest clef of the score |
| 182 |
% arguments are the same as \GreSetLinesClef except that the #3 of |
| 183 |
% \GreSetLineClef is removed (always 1) |
| 184 |
\def\GreSetLargestClef#1#2#3#4#5#6{% |
| 185 |
\gre@trace{GreSetLargestClef{#1}{#2}{#3}{#4}{#5}{#6}}% |
| 186 |
\gre@boxclef{#1}{#2}{0}{1}{#3}{#4}{#5}{#6}% |
| 187 |
\gre@update@clefwidth@largest{\wd\gre@box@temp@width}% |
| 188 |
\relax% |
| 189 |
}% |
| 190 |
|
| 191 |
\def\gre@save@clef#1#2#3#4#5#6{% |
| 192 |
\gre@trace{gre@save@clef{#1}{#2}{#3}{#4}{#5}{#6}}% |
| 193 |
\global\let\gre@clef=#1\relax% |
| 194 |
\xdef\gre@clefheight{#2}% |
| 195 |
\xdef\gre@clefflatheight{#3}% |
| 196 |
\global\let\gre@cleftwo=#4\relax% |
| 197 |
\xdef\gre@cleftwoheight{#5}% |
| 198 |
\xdef\gre@cleftwoflatheight{#6}% |
| 199 |
\gre@trace@end% |
| 200 |
}% |
| 201 |
|
| 202 |
%% macro redrawing a key from clefnum, useful for vertical space changes |
| 203 |
\def\gre@updatelinesclef{% |
| 204 |
\gre@trace{gre@updatelinesclef}% |
| 205 |
\GreSetLinesClef{\gre@clef}{\gre@clefheight}{1}{\gre@clefflatheight}% |
| 206 |
{\gre@cleftwo}{\gre@cleftwoheight}{\gre@cleftwoflatheight}\relax % |
| 207 |
\gre@trace@end% |
| 208 |
}% |
| 209 |
|
| 210 |
\newbox\gre@box@temp@clef% |
| 211 |
\newbox\gre@box@temp@cleftwo% |
| 212 |
|
| 213 |
% sets \gre@box@temp@width with the clef, the arguments are the same as \gre@typeclef |
| 214 |
\def\gre@boxclef#1#2#3#4#5#6#7#8{% |
| 215 |
\gre@trace{gre@boxclef{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}% |
| 216 |
\setbox\gre@box@temp@width=\hbox{% |
| 217 |
\ifcase#7% |
| 218 |
\gre@typesingleclef{#1}{#2}{#3}{#5}% |
| 219 |
\else % |
| 220 |
\ifnum\numexpr (#7 - #2) * (#7 - #2) > 1 \relax % |
| 221 |
\setbox\gre@box@temp@clef=\hbox{\gre@typesingleclef{#1}{#2}{#3}{#5}}% |
| 222 |
\setbox\gre@box@temp@cleftwo=\hbox{\gre@typesingleclef{#6}{#7}{#3}{#8}}% |
| 223 |
\ifdim\wd\gre@box@temp@clef>\wd\gre@box@temp@cleftwo% |
| 224 |
\hbox to 0pt{\copy\gre@box@temp@cleftwo}\copy\gre@box@temp@clef% |
| 225 |
\else % |
| 226 |
\hbox to 0pt{\copy\gre@box@temp@clef}\copy\gre@box@temp@cleftwo% |
| 227 |
\fi % |
| 228 |
\else % |
| 229 |
\gre@typesingleclef{#1}{#2}{#3}{#5}% |
| 230 |
\gre@skip@temp@two=\gre@space@skip@clefflatspace\relax% |
| 231 |
\gre@hskip\gre@skip@temp@two % |
| 232 |
\gre@typesingleclef{#6}{#7}{#3}{#8}% |
| 233 |
\fi % |
| 234 |
\fi % |
| 235 |
}% |
| 236 |
\gre@trace@end% |
| 237 |
} |
| 238 |
|
| 239 |
\def\gre@save@clefextrema#1#2{% |
| 240 |
\gre@trace{gre@save@clefextrema{#1}{#2}}% |
| 241 |
% compute the clef extrema |
| 242 |
\ifcase#1\or % first@1 |
| 243 |
\global\let\gre@pitch@cleftop\gre@pitch@e % |
| 244 |
\global\let\gre@pitch@clefbottom\gre@pitch@c % |
| 245 |
\ifcase#2\or\or % second@2 |
| 246 |
\global\let\gre@pitch@cleftop\gre@pitch@g % |
| 247 |
\or % second@3 |
| 248 |
\global\let\gre@pitch@cleftop\gre@pitch@i % |
| 249 |
\or % second@4 |
| 250 |
\global\let\gre@pitch@cleftop\gre@pitch@k % |
| 251 |
\or % second@5 |
| 252 |
\global\let\gre@pitch@cleftop\gre@pitch@m % |
| 253 |
\fi % |
| 254 |
\or % first@2 |
| 255 |
\global\let\gre@pitch@cleftop\gre@pitch@g % |
| 256 |
\global\let\gre@pitch@clefbottom\gre@pitch@e % |
| 257 |
\ifcase#2\or % second@1 |
| 258 |
\global\let\gre@pitch@clefbottom\gre@pitch@c % |
| 259 |
\or\or % second@3 |
| 260 |
\global\let\gre@pitch@cleftop\gre@pitch@i % |
| 261 |
\or % second@4 |
| 262 |
\global\let\gre@pitch@cleftop\gre@pitch@k % |
| 263 |
\or % second@5 |
| 264 |
\global\let\gre@pitch@cleftop\gre@pitch@m % |
| 265 |
\fi % |
| 266 |
\or % first@3 |
| 267 |
\global\let\gre@pitch@cleftop\gre@pitch@i % |
| 268 |
\global\let\gre@pitch@clefbottom\gre@pitch@g % |
| 269 |
\ifcase#2\or % second@1 |
| 270 |
\global\let\gre@pitch@clefbottom\gre@pitch@c % |
| 271 |
\or % second@2 |
| 272 |
\global\let\gre@pitch@clefbottom\gre@pitch@e % |
| 273 |
\or\or % second@4 |
| 274 |
\global\let\gre@pitch@cleftop\gre@pitch@k % |
| 275 |
\or % second@5 |
| 276 |
\global\let\gre@pitch@cleftop\gre@pitch@m % |
| 277 |
\fi % |
| 278 |
\or % first@4 |
| 279 |
\global\let\gre@pitch@cleftop\gre@pitch@k % |
| 280 |
\global\let\gre@pitch@clefbottom\gre@pitch@i % |
| 281 |
\ifcase#2\or % second@1 |
| 282 |
\global\let\gre@pitch@clefbottom\gre@pitch@c % |
| 283 |
\or % second@2 |
| 284 |
\global\let\gre@pitch@clefbottom\gre@pitch@e % |
| 285 |
\or % second@3 |
| 286 |
\global\let\gre@pitch@clefbottom\gre@pitch@g % |
| 287 |
\or\or % second@5 |
| 288 |
\global\let\gre@pitch@cleftop\gre@pitch@m % |
| 289 |
\fi % |
| 290 |
\or % first@5 |
| 291 |
\global\let\gre@pitch@cleftop\gre@pitch@m % |
| 292 |
\global\let\gre@pitch@clefbottom\gre@pitch@k % |
| 293 |
\ifcase#2\or % second@1 |
| 294 |
\global\let\gre@pitch@clefbottom\gre@pitch@c % |
| 295 |
\or % second@2 |
| 296 |
\global\let\gre@pitch@clefbottom\gre@pitch@e % |
| 297 |
\or % second@3 |
| 298 |
\global\let\gre@pitch@clefbottom\gre@pitch@g % |
| 299 |
\or % second@4 |
| 300 |
\global\let\gre@pitch@clefbottom\gre@pitch@i % |
| 301 |
\fi % |
| 302 |
\fi % |
| 303 |
\gre@trace@end% |
| 304 |
}% |
| 305 |
|
| 306 |
\def\GreInitialClefPosition#1#2{% |
| 307 |
\gre@trace{GreInitialClefPosition{#1}{#2}}% |
| 308 |
\ifgre@showclef % |
| 309 |
\gre@save@clefextrema{#1}{#2}% |
| 310 |
\fi % |
| 311 |
\gre@trace@end% |
| 312 |
}% |
| 313 |
|
| 314 |
% macro that typesets the clef |
| 315 |
% arguments are : |
| 316 |
%% #1: the type of the clef : c or f |
| 317 |
%% #2: the line of the clef (1 is the lowest) |
| 318 |
%% #3: if we must use small clef characters (inside a line) or not 0: if not inside, 1 if inside |
| 319 |
%% #4: 0: no space after, 1: normal space after, 2: short space after |
| 320 |
%% #5: if 3, it means that we must not put a flat after the clef, otherwise it's the height of the flat |
| 321 |
%% #6: the type of the secondary clef : c or f |
| 322 |
%% #7: the line of the secondary clef (1 is the lowest) |
| 323 |
%% #8: if 3, it means that we must not put a flat after the secondary clef, otherwise it's the height of the flat |
| 324 |
\def\gre@typeclef#1#2#3#4#5#6#7#8{% |
| 325 |
\gre@trace{gre@typeclef{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}% |
| 326 |
\gre@save@clefextrema{#2}{#7}% |
| 327 |
\gre@boxclef{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% |
| 328 |
\ifcase#3% |
| 329 |
\gre@update@clefwidth@current{\wd\gre@box@temp@width}% |
| 330 |
\fi % |
| 331 |
\copy\gre@box@temp@width % |
| 332 |
\ifcase#4 % |
| 333 |
\gre@skip@temp@two=\gre@space@skip@afterclefnospace\relax% |
| 334 |
\or % |
| 335 |
\gre@skip@temp@two=\gre@space@skip@spaceafterlineclef\relax% |
| 336 |
\else % |
| 337 |
\gre@skip@temp@two=\gre@space@skip@shortspaceafterlineclef\relax% |
| 338 |
\fi % |
| 339 |
\gre@hskip\gre@skip@temp@two % |
| 340 |
\gre@trace@end% |
| 341 |
}% |
| 342 |
|
| 343 |
% macro that typesets one clef |
| 344 |
% arguments are : |
| 345 |
%% #1: the type of the key : c or f |
| 346 |
%% #2: the line of the key (1 is the lowest) |
| 347 |
%% #3: if we must use small key characters (inside a line) or not 0: if not inside, 1 if inside |
| 348 |
%% #4: if 3, it means that we must not put a flat after the key, otherwise it's the height of the flat |
| 349 |
\def\gre@typesingleclef#1#2#3#4{% |
| 350 |
\gre@trace{gre@typesingleclef{#1}{#2}{#3}{#4}}% |
| 351 |
\ifcase#2 % |
| 352 |
\or% |
| 353 |
\gre@calculate@glyphraisevalue{\gre@pitch@c}{0}{}% |
| 354 |
\or% |
| 355 |
\gre@calculate@glyphraisevalue{\gre@pitch@e}{0}{}% |
| 356 |
\or% |
| 357 |
\gre@calculate@glyphraisevalue{\gre@pitch@g}{0}{}% |
| 358 |
\or% |
| 359 |
\gre@calculate@glyphraisevalue{\gre@pitch@i}{0}{}% |
| 360 |
\or% |
| 361 |
\gre@calculate@glyphraisevalue{\gre@pitch@k}{0}{}% |
| 362 |
\fi% |
| 363 |
\ifx c#1% we check if it is a c key |
| 364 |
\ifcase#3% |
| 365 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@cclef}{}{}% |
| 366 |
\or% |
| 367 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@incclef}{}{}% |
| 368 |
\fi% |
| 369 |
\else % we consider that it is a f key |
| 370 |
\ifcase#3% |
| 371 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@fclef}{}{}% |
| 372 |
\or% |
| 373 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@fontchar@infclef}{}{}% |
| 374 |
\fi% |
| 375 |
\fi% |
| 376 |
\ifnum#4=3% |
| 377 |
\else % |
| 378 |
\gre@skip@temp@four = \gre@space@skip@clefflatspace\relax% |
| 379 |
\gre@hskip\gre@skip@temp@four % |
| 380 |
\GreFlat{#4}{1}{}{}{}% |
| 381 |
\fi % |
| 382 |
\relax % |
| 383 |
\gre@trace@end% |
| 384 |
}% |
| 385 |
|
| 386 |
% macro that writes the initial key, and sets the next keys to the same value |
| 387 |
% #1-#2: same as \GreSetLinesClef |
| 388 |
% #3-#6: same as \GreSetLinesClef #4-#7 |
| 389 |
% if #3 is 3, it means that we must not put a flat after the key, otherwise it's the height |
| 390 |
% of the flat |
| 391 |
% #7: 0 if clef and first note are far enough to use a shorter space, 1 otherwise. |
| 392 |
\def\GreSetInitialClef#1#2#3#4#5#6#7{% |
| 393 |
\gre@trace{GreSetInitialClef{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% |
| 394 |
\gre@save@clef{#1}{#2}{#3}{#4}{#5}{#6}% |
| 395 |
\copy\gre@box@lines% draws the lines |
| 396 |
\ifgre@showclef% |
| 397 |
\ifnum\gre@count@initiallines=1\relax % |
| 398 |
\ifnum#7=1\relax % |
| 399 |
\gre@typeclef{#1}{#2}{0}{1}{#3}{#4}{#5}{#6}% |
| 400 |
\else % |
| 401 |
\gre@typeclef{#1}{#2}{0}{2}{#3}{#4}{#5}{#6}% |
| 402 |
\fi % |
| 403 |
\else % |
| 404 |
\gre@typeclef{#1}{#2}{0}{1}{#3}{#4}{#5}{#6}% |
| 405 |
\fi % |
| 406 |
\else% |
| 407 |
\gre@skip@temp@four = \gre@space@dimen@noclefspace\relax% |
| 408 |
\hbox{\kern\gre@skip@temp@four}% |
| 409 |
\fi % |
| 410 |
\GreSetLinesClef{#1}{#2}{1}{#3}{#4}{#5}{#6}% |
| 411 |
\relax% |
| 412 |
\gre@trace@end% |
| 413 |
}% |
| 414 |
|
| 415 |
% macro called when the key changes |
| 416 |
% #1 and #2 are the type and line of the clef |
| 417 |
% #3 is 1 or 0 according to the need of a space before the clef. Useful for clefs after bars for example |
| 418 |
% if #4 is 3, it means that we must not put a flat after the key, otherwise it's the height |
| 419 |
% of the flat |
| 420 |
\def\GreChangeClef#1#2#3#4#5#6#7{% |
| 421 |
\gre@trace{GreChangeClef{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% |
| 422 |
% it makes no sense to change the clef when there is no clef... |
| 423 |
\gresetclef{visible}% |
| 424 |
\gre@save@clef{#1}{#2}{#4}{#5}{#6}{#7}% |
| 425 |
\ifnum\gre@insidediscretionary=0\relax % |
| 426 |
\GreSetLinesClef{#1}{#2}{1}{#4}{#5}{#6}{#7}% |
| 427 |
\fi % |
| 428 |
\ifnum#3=1\relax % |
| 429 |
\gre@skip@temp@four = \gre@space@skip@clefchangespace\relax% |
| 430 |
\gre@hskip\gre@skip@temp@four % |
| 431 |
\else % |
| 432 |
\ifdim\gre@skip@bar@lastskip=0pt\else % we're after a bar: |
| 433 |
% 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 |
| 434 |
\gre@skip@temp@four = -\gre@space@skip@spacearoundclefbars\relax% |
| 435 |
\gre@hskip\gre@skip@temp@four % |
| 436 |
\fi % |
| 437 |
\fi % |
| 438 |
\GreNoBreak % |
| 439 |
\gre@typeclef{#1}{#2}{1}{0}{#4}{#5}{#6}{#7}% |
| 440 |
\ifnum\gre@insidediscretionary=0\relax % |
| 441 |
\gre@skip@temp@four = \gre@space@skip@clefchangespace\relax% |
| 442 |
\else % |
| 443 |
\gre@skip@temp@four = \gre@space@skip@interwordspacenotes\relax% |
| 444 |
\fi % |
| 445 |
\gre@hskip\gre@skip@temp@four % |
| 446 |
\GreNoBreak % |
| 447 |
\relax% |
| 448 |
\gre@trace@end% |
| 449 |
}% |
| 450 |
|
| 451 |
\newif\ifgre@in@custos % |
| 452 |
\gre@in@custosfalse % |
| 453 |
|
| 454 |
% custos just typesets a custos, useful for before the key changes for example |
| 455 |
% #1 is the height |
| 456 |
\def\GreCustos#1#2{% |
| 457 |
\gre@trace{GreCustos{#1}{#2}}% |
| 458 |
\gre@in@custostrue % |
| 459 |
\GreNoBreak % |
| 460 |
\ifdim\gre@skip@bar@lastskip=0pt\else % we're after a bar: |
| 461 |
\kern-\gre@skip@bar@lastskip % |
| 462 |
\GreNoBreak % |
| 463 |
\fi % |
| 464 |
\ifgre@firstglyph% we check if it is the first glyph |
| 465 |
\global\gre@firstglyphfalse% |
| 466 |
\ifnum\gre@insidediscretionary=0\else % |
| 467 |
\gre@skip@temp@four=\gre@space@skip@interwordspacenotes % |
| 468 |
\kern\gre@skip@temp@four% |
| 469 |
\GreNoBreak % |
| 470 |
\fi % |
| 471 |
\else% |
| 472 |
\ifgre@endofscore % |
| 473 |
\gre@skip@temp@four=\gre@space@skip@spacebeforeeolcustos % |
| 474 |
\else % |
| 475 |
\gre@skip@temp@four=\gre@space@skip@spacebeforeinlinecustos % |
| 476 |
\fi % |
| 477 |
\kern\gre@skip@temp@four% |
| 478 |
\GreNoBreak % |
| 479 |
\fi % |
| 480 |
\gre@custosalteration{#1}{#2}% |
| 481 |
\GreNoBreak% |
| 482 |
\gre@calculate@glyphraisevalue{#1}{0}{}% |
| 483 |
%here we need some tricks to draw the line before the custos (for the color) |
| 484 |
\setbox\gre@box@temp@width=\hbox{\gre@pickcustos{#1}{1}}% |
| 485 |
\gre@dimen@temp@three=\wd\gre@box@temp@width % |
| 486 |
\ifgre@showlines % |
| 487 |
\ifnum#1<\gre@pitch@belowstaff\relax % |
| 488 |
\gre@additionalbottomcustoslinemiddle % |
| 489 |
\else\ifnum#1>\gre@pitch@abovestaff\relax % |
| 490 |
\gre@additionaltopcustoslinemiddle % |
| 491 |
\fi\fi % |
| 492 |
\fi % |
| 493 |
\raise \gre@dimen@glyphraisevalue% |
| 494 |
\copy\gre@box@temp@width % |
| 495 |
\ifdim\gre@skip@bar@lastskip=0pt\relax % |
| 496 |
% for now we consider we always have a bar after the custos |
| 497 |
% we don't want to end the line here |
| 498 |
\GreNoBreak % |
| 499 |
\gre@skip@temp@four = -\gre@space@skip@spacearoundclefbars\relax% |
| 500 |
\gre@hskip\gre@skip@temp@four % |
| 501 |
\GreNoBreak % |
| 502 |
\else % |
| 503 |
\GreNoBreak % |
| 504 |
\kern\gre@skip@bar@lastskip % |
| 505 |
\GreNoBreak % |
| 506 |
\fi % |
| 507 |
\directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% |
| 508 |
\relax % |
| 509 |
\gre@in@custosfalse % |
| 510 |
\gre@trace@end% |
| 511 |
}% |
| 512 |
|
| 513 |
% typesets a custos for the end of the score |
| 514 |
\def\GreFinalCustos#1#2{% |
| 515 |
\gre@trace{GreFinalCustos{#1}{#2}}% |
| 516 |
\GreNoBreak% |
| 517 |
\GreCustos{#1}{#2}% |
| 518 |
\gre@endofglyphcommon % |
| 519 |
\gre@trace@end% |
| 520 |
} |
| 521 |
|
| 522 |
% the argument is the height |
| 523 |
\edef\gre@nextcustospitch{\gre@pitch@dummy}% |
| 524 |
\edef\gre@nextcustosalteration{}% |
| 525 |
\def\GreNextCustos#1#2{% |
| 526 |
\gre@trace{GreNextCustos{#1}{#2}}% |
| 527 |
\gre@in@custostrue % |
| 528 |
\gre@debugmsg{custos}{nextcustos = #1,#2}% |
| 529 |
\ifnum\gre@insidediscretionary=0\relax % |
| 530 |
\gre@debugmsg{custos}{not discretionary}% |
| 531 |
\edef\gre@nextcustospitch{#1}% |
| 532 |
\edef\gre@nextcustosalteration{#2}% |
| 533 |
\ifgre@blockeolcustos\else% |
| 534 |
\gre@debugmsg{custos}{not blocked}% |
| 535 |
\gre@calculate@glyphraisevalue{#1}{0}{}% |
| 536 |
%here we need some tricks to draw the line before the custos (for the color) |
| 537 |
% We want both the measured and real alteration to have the same id, |
| 538 |
% so save the id to restore it later. |
| 539 |
\edef\gre@saved@attr@alteration@id{\number\gre@attr@alteration@id\relax}% |
| 540 |
\setbox\gre@box@temp@width=\hbox{% |
| 541 |
% we type a hskip and the we type the custos |
| 542 |
\gre@hskip\gre@space@skip@spacebeforeeolcustos\relax % |
| 543 |
\gre@custosalteration{#1}{#2}% |
| 544 |
\GreNoBreak% |
| 545 |
\raise \gre@dimen@glyphraisevalue% |
| 546 |
\hbox{% |
| 547 |
\gre@pickcustos{#1}{2}\relax % |
| 548 |
}% |
| 549 |
}% |
| 550 |
\global\gre@attr@alteration@id=\gre@saved@attr@alteration@id\relax % |
| 551 |
\gre@dimen@temp@three=\wd\gre@box@temp@width % |
| 552 |
% we make \wd\gre@box@temp@sign contain the width of a custos |
| 553 |
\setbox\gre@box@temp@sign=\hbox{% |
| 554 |
\gre@custosalteration{#1}{#2}% |
| 555 |
\GreNoBreak% |
| 556 |
\gre@pickcustos{#1}{0}\relax % |
| 557 |
}% |
| 558 |
\gre@localrightbox{% |
| 559 |
\ifgre@showlines % |
| 560 |
\ifnum#1<\gre@pitch@belowstaff\relax % |
| 561 |
\gre@additionalbottomcustoslineend % |
| 562 |
\else\ifnum#1>\gre@pitch@abovestaff\relax % |
| 563 |
\gre@additionaltopcustoslineend % |
| 564 |
\fi\fi % |
| 565 |
\fi % |
| 566 |
\copy\gre@box@temp@width % |
| 567 |
}% |
| 568 |
\fi % |
| 569 |
\fi % |
| 570 |
\relax% |
| 571 |
\gre@in@custosfalse % |
| 572 |
\gre@trace@end% |
| 573 |
}% |
| 574 |
|
| 575 |
% macro that typesets an additional line at the top for custos at end of line |
| 576 |
|
| 577 |
\def\gre@additionaltopcustoslineend{% |
| 578 |
\gre@trace{gre@additionalaltopcustoslineend}% |
| 579 |
\gre@dimen@temp@five=\dimexpr(\gre@dimen@staffheight % |
| 580 |
+ \gre@space@dimen@spacebeneathtext % |
| 581 |
+ \gre@space@dimen@spacelinestext % |
| 582 |
+ \gre@dimen@interstafflinespace % |
| 583 |
+ \gre@dimen@additionalbottomspace % |
| 584 |
+ \gre@dimen@currenttranslationheight)\relax % |
| 585 |
\raise\gre@dimen@temp@five % |
| 586 |
\hbox to 0pt{% |
| 587 |
\gre@style@additionalstafflines % |
| 588 |
\kern\gre@dimen@temp@three % |
| 589 |
\gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@sign + \gre@space@dimen@additionalcustoslineswidth)\relax% |
| 590 |
\kern-\gre@dimen@temp@five % |
| 591 |
\vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% |
| 592 |
\hss % |
| 593 |
\endgre@style@additionalstafflines% |
| 594 |
}% |
| 595 |
\relax % |
| 596 |
\gre@trace@end% |
| 597 |
}% |
| 598 |
|
| 599 |
\def\gre@additionalbottomcustoslineend{% |
| 600 |
\gre@trace{gre@additionalbottomcustoslineend}% |
| 601 |
\gre@dimen@temp@five=\dimexpr(\gre@space@dimen@spacebeneathtext % |
| 602 |
+ \gre@space@dimen@spacelinestext % |
| 603 |
+ \gre@dimen@additionalbottomspace % |
| 604 |
+ \gre@dimen@currenttranslationheight % |
| 605 |
- \gre@dimen@interstafflinespace % |
| 606 |
- \gre@dimen@stafflineheight)\relax % |
| 607 |
\raise\gre@dimen@temp@five % |
| 608 |
\hbox to 0pt{% |
| 609 |
\gre@style@additionalstafflines % |
| 610 |
\kern\gre@dimen@temp@three % |
| 611 |
\gre@dimen@temp@five=\dimexpr(\wd\gre@box@temp@sign+\gre@space@dimen@additionalcustoslineswidth)\relax% |
| 612 |
\kern-\gre@dimen@temp@five % |
| 613 |
\vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% |
| 614 |
\hss % |
| 615 |
\endgre@style@additionalstafflines% |
| 616 |
}% |
| 617 |
\relax % |
| 618 |
\gre@trace@end% |
| 619 |
}% |
| 620 |
|
| 621 |
% same macros, but for a custos in the middle |
| 622 |
|
| 623 |
\def\gre@additionaltopcustoslinemiddle{% |
| 624 |
\gre@trace{gre@additionaltopcustoslinemiddle}% |
| 625 |
\gre@dimen@temp@five=\dimexpr(\gre@dimen@staffheight % |
| 626 |
+ \gre@space@dimen@spacebeneathtext % |
| 627 |
+ \gre@space@dimen@spacelinestext % |
| 628 |
+ \gre@dimen@interstafflinespace % |
| 629 |
+ \gre@dimen@additionalbottomspace % |
| 630 |
+ \gre@dimen@currenttranslationheight)\relax% |
| 631 |
\raise\gre@dimen@temp@five % |
| 632 |
\hbox to 0pt{% |
| 633 |
\gre@style@additionalstafflines % |
| 634 |
\hss % |
| 635 |
\kern\gre@dimen@temp@three % |
| 636 |
\gre@dimen@temp@five=\dimexpr((\gre@space@dimen@additionalcustoslineswidth*2)+\wd\gre@box@temp@sign)\relax % |
| 637 |
\vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% |
| 638 |
\hss % |
| 639 |
\endgre@style@additionalstafflines% |
| 640 |
}% |
| 641 |
\relax % |
| 642 |
\gre@trace@end% |
| 643 |
}% |
| 644 |
|
| 645 |
\def\gre@additionalbottomcustoslinemiddle{% |
| 646 |
\gre@trace{gre@additionalbottomcustoslinemiddle}% |
| 647 |
\gre@dimen@temp@five=\dimexpr(\gre@space@dimen@spacebeneathtext % |
| 648 |
+ \gre@space@dimen@spacelinestext % |
| 649 |
+ \gre@dimen@additionalbottomspace % |
| 650 |
+ \gre@dimen@currenttranslationheight % |
| 651 |
- \gre@dimen@interstafflinespace % |
| 652 |
- \gre@dimen@stafflineheight)\relax% |
| 653 |
\raise\gre@dimen@temp@five % |
| 654 |
\hbox to 0pt{% |
| 655 |
\gre@style@additionalstafflines % |
| 656 |
\hss % |
| 657 |
\kern\gre@dimen@temp@three % |
| 658 |
\gre@dimen@temp@five=\dimexpr((\gre@space@dimen@additionalcustoslineswidth*2)+\wd\gre@box@temp@sign)\relax % |
| 659 |
\vrule width \gre@dimen@temp@five height \gre@dimen@stafflineheight\relax% |
| 660 |
\hss % |
| 661 |
\endgre@style@additionalstafflines% |
| 662 |
}% |
| 663 |
\relax % |
| 664 |
\gre@trace@end% |
| 665 |
}% |
| 666 |
|
| 667 |
\newif\ifgre@usecustosalteration% |
| 668 |
\gre@usecustosalterationtrue% |
| 669 |
\def\gresetcustosalteration#1{% |
| 670 |
\gre@trace{gresetcustosalteration{#1}}% |
| 671 |
\IfStrEqCase{#1}{% |
| 672 |
{visible}{\gre@usecustosalterationtrue}% |
| 673 |
{invisible}{\gre@usecustosalterationfalse}% |
| 674 |
}[% all other cases |
| 675 |
\gre@error{Unrecognized option "#1" for \protect\gresetcustosalteration\MessageBreak Possible options are: 'visible' and 'invisible'}% |
| 676 |
]% |
| 677 |
\gre@trace@end% |
| 678 |
}% |
| 679 |
\def\gre@custosalteration#1#2{% |
| 680 |
\gre@trace{gre@custosalteration{#1}{#2}}% |
| 681 |
\ifgre@usecustosalteration % |
| 682 |
\IfStrEq{#2}{}{}{\csname Gre#2\endcsname{#1}{0}{}{}{}}% |
| 683 |
\fi % |
| 684 |
\gre@trace@end% |
| 685 |
}% |
| 686 |
|
| 687 |
% #2 is 0 for measurement only, 1 in the normal case, 2 for the right box |
| 688 |
\def\gre@pickcustos#1#2{% |
| 689 |
\gre@trace{gre@pickcustos{#1}{#2}}% |
| 690 |
% set attributes to adjust the line height for the pitch of the custos |
| 691 |
\ifcase#2% 0 |
| 692 |
\or % 1 |
| 693 |
\global\advance\gre@attr@glyph@id by 1\relax % |
| 694 |
\GreGlyphHeights{#1}{#1}% |
| 695 |
\or % 2 |
| 696 |
\ifgre@eolshiftsenabled % |
| 697 |
\GreGlyphHeights{#1}{#1}% |
| 698 |
\fi % |
| 699 |
\fi % |
| 700 |
\ifcase#1% |
| 701 |
\or\or% |
| 702 |
\or\gre@fontchar@custostopmiddle % |
| 703 |
\or\gre@fontchar@custostoplong % |
| 704 |
\or\gre@fontchar@custostopshort % |
| 705 |
\or\gre@fontchar@custostoplong % |
| 706 |
\or\gre@fontchar@custostopshort % |
| 707 |
\or % |
| 708 |
\ifnum\gre@count@stafflines>2\relax |
| 709 |
\gre@fontchar@custostoplong % |
| 710 |
\else % |
| 711 |
\gre@fontchar@custosbottomlong % |
| 712 |
\fi % |
| 713 |
\or % |
| 714 |
\ifnum\gre@count@stafflines>2\relax |
| 715 |
\gre@fontchar@custostopshort % |
| 716 |
\else % |
| 717 |
\gre@fontchar@custosbottomshort % |
| 718 |
\fi % |
| 719 |
\or % |
| 720 |
\ifnum\gre@count@stafflines>3\relax |
| 721 |
\gre@fontchar@custostoplong % |
| 722 |
\else % |
| 723 |
\gre@fontchar@custosbottomlong % |
| 724 |
\fi % |
| 725 |
\or % |
| 726 |
\ifnum\gre@count@stafflines>3\relax |
| 727 |
\gre@fontchar@custostopshort % |
| 728 |
\else % |
| 729 |
\ifnum\gre@count@stafflines>2\relax |
| 730 |
\gre@fontchar@custosbottomshort % |
| 731 |
\else % |
| 732 |
\gre@fontchar@custosbottommiddle % |
| 733 |
\fi % |
| 734 |
\fi % |
| 735 |
\or % |
| 736 |
\ifnum\gre@count@stafflines>4\relax |
| 737 |
\gre@fontchar@custostoplong % |
| 738 |
\else % |
| 739 |
\gre@fontchar@custosbottomlong % |
| 740 |
\fi % |
| 741 |
\or % |
| 742 |
\ifnum\gre@count@stafflines>4\relax |
| 743 |
\gre@fontchar@custostopshort % |
| 744 |
\else % |
| 745 |
\ifnum\gre@count@stafflines>3\relax |
| 746 |
\gre@fontchar@custosbottomshort % |
| 747 |
\else % |
| 748 |
\gre@fontchar@custosbottommiddle % |
| 749 |
\fi % |
| 750 |
\fi % |
| 751 |
\or\gre@fontchar@custosbottomlong % |
| 752 |
\or % |
| 753 |
\ifnum\gre@count@stafflines>4\relax |
| 754 |
\gre@fontchar@custosbottomshort % |
| 755 |
\else % |
| 756 |
\gre@fontchar@custosbottommiddle % |
| 757 |
\fi % |
| 758 |
\or\gre@fontchar@custosbottomlong % |
| 759 |
\or\gre@fontchar@custosbottommiddle % |
| 760 |
\fi% |
| 761 |
\gre@trace@end% |
| 762 |
}% |
| 763 |
|
| 764 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 765 |
%% macros for the typesetting of braces and other things above the score |
| 766 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 767 |
|
| 768 |
\newif\ifgre@metapost@brace\gre@metapost@bracetrue % |
| 769 |
\newif\ifgre@metapost@underbrace\gre@metapost@underbracetrue % |
| 770 |
\newif\ifgre@metapost@curlybrace\gre@metapost@curlybracetrue % |
| 771 |
\newif\ifgre@metapost@barbrace\gre@metapost@barbracetrue % |
| 772 |
\def\gresetbracerendering{% |
| 773 |
\@ifnextchar[{\gre@setbracerendering}{\gre@setallbracerendering}% |
| 774 |
}% |
| 775 |
\def\gre@setallbracerendering#1{% |
| 776 |
\gre@trace{gre@setallbracerendering{#1}}% |
| 777 |
\gre@@setbracerendering{brace}{#1}% |
| 778 |
\gre@@setbracerendering{underbrace}{#1}% |
| 779 |
\gre@@setbracerendering{curlybrace}{#1}% |
| 780 |
\gre@@setbracerendering{barbrace}{#1}% |
| 781 |
\gre@trace@end% |
| 782 |
}% |
| 783 |
\def\gre@setbracerendering[#1]#2{% |
| 784 |
\gre@trace{gre@setbracerendering[#1]{#2}}% |
| 785 |
\IfStrEqCase{#1}{% |
| 786 |
{brace}{\gre@@setbracerendering{#1}{#2}}% |
| 787 |
{underbrace}{\gre@@setbracerendering{#1}{#2}}% |
| 788 |
{curlybrace}{\gre@@setbracerendering{#1}{#2}}% |
| 789 |
{barbrace}{\gre@@setbracerendering{#1}{#2}}% |
| 790 |
}[\gre@error{Unrecognized option "#1" for \protect\gresetbracerendering\MessageBreak Possible options are: 'brace', 'underbrace', 'curlybrace', and 'barbrace'}]% |
| 791 |
\gre@trace@end% |
| 792 |
}% |
| 793 |
\def\gre@@setbracerendering#1#2{% |
| 794 |
\gre@trace{gre@@setbracerendering{#1}{#2}}% |
| 795 |
\IfStrEqCase{#2}{% |
| 796 |
{font}{\csname gre@metapost@#1false\endcsname}% |
| 797 |
{metapost}{\csname gre@metapost@#1true\endcsname}% |
| 798 |
}[\gre@error{Unrecognized option "#2" for \protect\gresetbracerendering\MessageBreak Possible options are: 'font' and 'metapost'}]% |
| 799 |
\gre@trace@end% |
| 800 |
}% |
| 801 |
|
| 802 |
\gdef\gre@fontchar@curlybrace{\gre@font@music\GreCPCurlyBrace}% |
| 803 |
\gdef\gre@fontchar@brace{\gre@font@music\GreCPRoundBrace}% |
| 804 |
\gdef\gre@fontchar@underbrace{\gre@font@music\GreCPRoundBraceDown}% |
| 805 |
|
| 806 |
% the command to resize a box, \resizebox is provided by graphicx |
| 807 |
\global\let\gre@resizebox\resizebox % |
| 808 |
|
| 809 |
% #1: the width |
| 810 |
% #2: a vertical shift |
| 811 |
% #3: a horizontal shift |
| 812 |
% #4: 1 if we shift to the beginning of the last glyph, 0 otherwise |
| 813 |
% #5: 1 if we put an accentus above or not |
| 814 |
\def\GreOverCurlyBrace#1#2#3#4#5{% |
| 815 |
\gre@trace{GreOverCurlyBrace{#1}{#2}{#3}{#4}{#5}}% |
| 816 |
\ifgre@boxing\else % |
| 817 |
\gre@brace@common{#1}{#2}{#3}{#4}{#5}{\gre@pitch@overbraceglyph}{\gre@fontchar@curlybrace}% |
| 818 |
\fi % |
| 819 |
\gre@trace@end% |
| 820 |
}% |
| 821 |
|
| 822 |
% #1: the width |
| 823 |
% #2: a vertical shift |
| 824 |
% #3: a horizontal shift |
| 825 |
% #4: 1 if we shift to the beginning of the last glyph, 0 otherwise |
| 826 |
\def\GreOverBrace#1#2#3#4{% |
| 827 |
\gre@trace{GreOverBrace{#1}{#2}{#3}{#4}}% |
| 828 |
\ifgre@boxing\else % |
| 829 |
\gre@brace@common{#1}{#2}{#3}{#4}{0}{\gre@pitch@overbraceglyph}{\gre@fontchar@brace}% |
| 830 |
\fi % |
| 831 |
\gre@trace@end% |
| 832 |
}% |
| 833 |
|
| 834 |
% #1: the width |
| 835 |
% #2: a vertical shift |
| 836 |
% #3: a horizontal shift |
| 837 |
% #4: 1 if we shift to the beginning of the last glyph, 0 otherwise |
| 838 |
\def\GreUnderBrace#1#2#3#4{% |
| 839 |
\gre@trace{GreUnderBrace{#1}{#2}{#3}{#4}}% |
| 840 |
\ifgre@boxing\else % |
| 841 |
\gre@brace@common{#1}{#2}{#3}{#4}{0}{\gre@pitch@underbrace}{\gre@fontchar@underbrace}% |
| 842 |
\fi % |
| 843 |
\gre@trace@end% |
| 844 |
}% |
| 845 |
|
| 846 |
% #1: the width |
| 847 |
% #2: a vertical shift |
| 848 |
% #3: a horizontal shift |
| 849 |
% #4: 1 if we shift to the beginning of the last glyph, 0 otherwise |
| 850 |
% #5: 1 if we put an accentus above, 0 if not |
| 851 |
% #6: the pitch at which to compute the height |
| 852 |
% #7: the brace character |
| 853 |
\def\gre@brace@common#1#2#3#4#5#6#7{% |
| 854 |
\gre@trace{gre@brace@common{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% |
| 855 |
\ifnum#4=1\relax % |
| 856 |
\setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% |
| 857 |
\gre@dimen@temp@five=\wd\gre@box@temp@sign % |
| 858 |
\kern-\gre@dimen@temp@five % |
| 859 |
\fi % |
| 860 |
\gre@calculate@glyphraisevalue{#6}{13}{}% |
| 861 |
\advance\gre@dimen@glyphraisevalue by #2\relax % |
| 862 |
\hbox to 0pt{% |
| 863 |
\gre@skip@temp@four = #3\relax % |
| 864 |
\kern\gre@skip@temp@four % |
| 865 |
\raise\gre@dimen@glyphraisevalue\hbox{% |
| 866 |
\ifx#7\gre@fontchar@curlybrace % |
| 867 |
\ifgre@metapost@curlybrace % |
| 868 |
\gre@draw@curlybrace{#1}% |
| 869 |
\else % |
| 870 |
\gre@draw@fontbrace{#1}{#7}% |
| 871 |
\fi % |
| 872 |
\else % |
| 873 |
\ifx#7\gre@fontchar@brace % |
| 874 |
\ifgre@metapost@brace % |
| 875 |
\gre@draw@brace{#1}% |
| 876 |
\else % |
| 877 |
\gre@draw@fontbrace{#1}{#7}% |
| 878 |
\fi % |
| 879 |
\else % |
| 880 |
\ifx#7\gre@fontchar@underbrace % |
| 881 |
\ifgre@metapost@underbrace % |
| 882 |
\gre@draw@underbrace{#1}% |
| 883 |
\else % |
| 884 |
\gre@draw@fontbrace{#1}{#7}% |
| 885 |
\fi % |
| 886 |
\fi % |
| 887 |
\fi % |
| 888 |
\fi % |
| 889 |
}% |
| 890 |
\hss % |
| 891 |
\ifnum#5=1\relax % |
| 892 |
\gre@calculate@glyphraisevalue{\gre@pitch@overbrace}{13}{}% |
| 893 |
\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@curlybraceaccentusshift\relax% |
| 894 |
\raise\gre@dimen@glyphraisevalue\hbox{% |
| 895 |
\gre@font@music\GreCPAccentus\relax % |
| 896 |
}% |
| 897 |
\hss % |
| 898 |
\fi % |
| 899 |
}% |
| 900 |
\ifnum#4=1\relax % |
| 901 |
\kern\gre@dimen@temp@five % |
| 902 |
\fi % |
| 903 |
\relax % |
| 904 |
\gre@trace@end% |
| 905 |
}% |
| 906 |
% #1 : the width |
| 907 |
% #2 : the brace character |
| 908 |
\def\gre@draw@fontbrace#1#2{% |
| 909 |
\gre@trace{gre@draw@fontbrace{#1}{#2}}% |
| 910 |
\setbox\gre@box@temp@sign=\hbox{#2}% |
| 911 |
\gre@resizebox{#1}{\ht\gre@box@temp@sign}{#2}% |
| 912 |
\gre@trace@end% |
| 913 |
}% |
| 914 |
|
| 915 |
% #1: the width, or * for the bar brace width |
| 916 |
% this can't have @ in the name because of the metapost catcode settings |
| 917 |
\def\grebracemetapostpreamble#1{% |
| 918 |
% multiplier to convert gre@factor to em-size in bp |
| 919 |
% (100000 sp) * (72 bp/in) / (65536 sp/pt) / 72.27 (pt/in) |
| 920 |
factor = 1.5201782378; |
| 921 |
scale = \the\gre@factor * factor; |
| 922 |
% assuming #1 is in bp, we convert it back into the internal unit of the |
| 923 |
% calculation, ems |
| 924 |
width = \directlua{gregoriotex.width_to_bp([[#1]], "\grebarbracewidth * scale")} / scale; |
| 925 |
}% |
| 926 |
|
| 927 |
% #1: the width |
| 928 |
\def\gre@draw@curlybrace#1{% |
| 929 |
\gre@trace{gre@draw@curlybrace{#1}}% |
| 930 |
\gre@metapost{ |
| 931 |
\grebracemetapostpreamble{#1} |
| 932 |
transform t; |
| 933 |
t = identity scaled scale; |
| 934 |
p := (width - 0.1416) / 2; |
| 935 |
q := (width - 0.08626) / 2; |
| 936 |
if (p < 0.1005) or (q < 0.12817): |
| 937 |
t := t xscaled (width / 0.34261); |
| 938 |
p := 0.1005; |
| 939 |
q := 0.12817; |
| 940 |
fi; |
| 941 |
f := 1 + (p / 4); |
| 942 |
beginfig(0); |
| 943 |
fill |
| 944 |
( (0,0) |
| 945 |
-- (0.00651,0) |
| 946 |
.. controls (((0.03239**f)*p)+0.00651,0.01763) and (((0.08502**f)*p)+0.00651,0.03065) .. (((0.15789**f)*p)+0.00651,0.03906) |
| 947 |
.. controls (((0.23347**f)*p)+0.00651,0.04801) and (((0.32659**f)*p)+0.00651,0.05249) .. (((0.43725**f)*p)+0.00651,0.05249) |
| 948 |
.. controls (((0.49663**f)*p)+0.00651,0.05249) and (((0.59109**f)*p)+0.00651,0.05086) .. (((0.72065**f)*p)+0.00651,0.04761) |
| 949 |
.. controls (((0.82861**f)*p)+0.00651,0.04408) and (((0.92173**f)*p)+0.00651,0.04232) .. (p+0.00651,0.04232) |
| 950 |
.. controls (p+0.0198,0.04232) and (p+0.03242,0.04842) .. (p+0.04435,0.06063) |
| 951 |
.. controls (p+0.05602,0.07365) and (p+0.06483,0.0906) .. (p+0.0708,0.11149) |
| 952 |
.. controls (p+0.07677,0.0906) and (p+0.08558,0.07365) .. (p+0.09725,0.06063) |
| 953 |
.. controls (p+0.10918,0.04842) and (p+0.1218,0.04232) .. (p+0.13509,0.04232) |
| 954 |
.. controls (p+((1-(0.92173**f))*p)+0.13509,0.04232) and (p+((1-(0.82861**f))*p)+0.13509,0.04408) .. (p+((1-(0.72065**f))*p)+0.13509,0.04761) |
| 955 |
.. controls (p+((1-(0.59109**f))*p)+0.13509,0.05086) and (p+((1-(0.49663**f))*p)+0.13509,0.05249) .. (p+((1-(0.43725**f))*p)+0.13509,0.05249) |
| 956 |
.. controls (p+((1-(0.32659**f))*p)+0.13509,0.05249) and (p+((1-(0.23347**f))*p)+0.13509,0.04801) .. (p+((1-(0.15789**f))*p)+0.13509,0.03906) |
| 957 |
.. controls (p+((1-(0.08502**f))*p)+0.13509,0.03065) and (p+((1-(0.03239**f))*p)+0.13509,0.01763) .. (p+p+0.13509,0) |
| 958 |
-- (p+p+0.13509,0) -- (q+q+0.08626,0) -- (q+q+0.08626,0) |
| 959 |
.. controls (q+((1-(0.02117**f))*q)+0.08626,0.02658) and (q+((1-(0.08466**f))*q)+0.08626,0.04774) .. (q+((1-(0.19048**f))*q)+0.08626,0.06348) |
| 960 |
.. controls (q+((1-(0.29418**f))*q)+0.08626,0.07975) and (q+((1-(0.42434**f))*q)+0.08626,0.08789) .. (q+((1-(0.58095**f))*q)+0.08626,0.08789) |
| 961 |
.. controls (q+((1-(0.63386**f))*q)+0.08626,0.08789) and (q+((1-(0.70159**f))*q)+0.08626,0.08626) .. (q+((1-(0.78413**f))*q)+0.08626,0.08301) |
| 962 |
.. controls (q+((1-(0.87937**f))*q)+0.08626,0.07894) and (q+((1-(0.95132**f))*q)+0.08626,0.0769) .. (q+0.08626,0.0769) |
| 963 |
.. controls (q+0.06219,0.0769) and (q+0.05013,0.10644) .. (q+0.04679,0.13102) |
| 964 |
-- (q+0.04679,0.13102) -- (q+0.03947,0.13102) -- (q+0.03947,0.13102) |
| 965 |
.. controls (q+0.03614,0.10644) and (q+0.02407,0.0769) .. (q+0,0.0769) |
| 966 |
.. controls (((0.95132**f)*q)+0,0.0769) and (((0.87937**f)*q)+0,0.07894) .. (((0.78413**f)*q)+0,0.08301) |
| 967 |
.. controls (((0.70159**f)*q)+0,0.08626) and (((0.63386**f)*q)+0,0.08789) .. (((0.58095**f)*q)+0,0.08789) |
| 968 |
.. controls (((0.42434**f)*q)+0,0.08789) and (((0.29418**f)*q)+0,0.07975) .. (((0.19048**f)*q)+0,0.06348) |
| 969 |
.. controls (((0.08466**f)*q)+0,0.04774) and (((0.02117**f)*q)+0,0.02658) .. (0,0) |
| 970 |
-- cycle |
| 971 |
) transformed t; |
| 972 |
setbounds currentpicture to |
| 973 |
( (0,-0.67980) -- (q+q+0.08626,-0.67980) -- (q+q+0.08626,0.13102) -- (0,0.13102) -- cycle ) |
| 974 |
transformed t; |
| 975 |
endfig; |
| 976 |
}% |
| 977 |
\gre@trace@end% |
| 978 |
}% |
| 979 |
|
| 980 |
% #1: the width |
| 981 |
\def\gre@draw@brace#1{% |
| 982 |
\gre@trace{gre@draw@brace{#1}}% |
| 983 |
\gre@draw@roundbrace{#1}{.89500}{ |
| 984 |
(-.00192,.70347) % start the top |
| 985 |
.. controls (-.00192,.70525) and (-.00134,.70740) |
| 986 |
.. (.00000,.71000) -- (.00000,.71000){curl c} |
| 987 |
.. (p/2,.89500) % top of the center |
| 988 |
.. {curl c}(p,.71000) -- (p,.71000) |
| 989 |
.. controls (p+.00134,.70740) and (p+.00192,.70525) |
| 990 |
.. (p+.00192,.70347) % end the top |
| 991 |
.. controls (p+.00192,.69508) and (p-.01103,.69500) |
| 992 |
.. (p-.01856,.69500) % start the bottom |
| 993 |
.. controls (p-.01856,.69500) and (p-.01900,.69500) |
| 994 |
.. (p-.01900,.69500) -- (p-.01900,.69500){curl c} |
| 995 |
.. (p/2,.86400) % bottom of the center |
| 996 |
.. {curl c}(.01900,.69500) -- (.01900,.69500) |
| 997 |
.. controls (.01900,.69500) and (.01856,.69500) |
| 998 |
.. (.01856,.69500) % end the bottom |
| 999 |
.. controls (.01103,.69500) and (-.00192,.69508) |
| 1000 |
.. (-.00192,.70347) -- cycle |
| 1001 |
}% |
| 1002 |
\gre@trace@end% |
| 1003 |
}% |
| 1004 |
|
| 1005 |
% #1: the width |
| 1006 |
\def\gre@draw@underbrace#1{% |
| 1007 |
\gre@trace{gre@draw@underbrace{#1}}% |
| 1008 |
\gre@draw@roundbrace{#1}{.25500}{ |
| 1009 |
(-.00192,.24653) % start the bottom |
| 1010 |
.. controls (-.00192,.24475) and (-.00134,.24260) |
| 1011 |
.. (.00000,.24000) -- (.00000,.24000){curl c} |
| 1012 |
.. (p/2,.05500) % bottom of the center |
| 1013 |
.. {curl c}(p,.24000) -- (p,.24000) |
| 1014 |
.. controls (p+.00134,.24260) and (p+.00192,.24475) |
| 1015 |
.. (p+.00192,.24653) % end the bottom |
| 1016 |
.. controls (p+.00192,.25492) and (p-.01103,.25500) |
| 1017 |
.. (p-.01856,.25500) % start the top |
| 1018 |
.. controls (p-.01856,.25500) and (p-.01900,.25500) |
| 1019 |
.. (p-.01900,.25500) -- (p-.01900,.25500){curl c} |
| 1020 |
.. (p/2,.08600) % top to the center |
| 1021 |
.. {curl c}(.01900,.25500) -- (.01900,.25500) |
| 1022 |
.. controls (.01900,.25500) and (.01856,.25500) |
| 1023 |
.. (.01856,.25500) % end the top |
| 1024 |
.. controls (.01103,.25500) and (-.00192,.25492) |
| 1025 |
.. (-.00192,.24653) -- cycle |
| 1026 |
}% |
| 1027 |
\gre@trace@end% |
| 1028 |
}% |
| 1029 |
|
| 1030 |
% #1: the width |
| 1031 |
% #2: height of the bounding box |
| 1032 |
% #3: metapost commands to draw the outline |
| 1033 |
\def\gre@draw@roundbrace#1#2#3{% |
| 1034 |
\gre@trace{gre@draw@roundbrace{#1}{#2}{#3}}% |
| 1035 |
\gre@debugmsg{general}{round brace width = #1}% |
| 1036 |
\gre@metapost{ |
| 1037 |
\grebracemetapostpreamble{#1} |
| 1038 |
p = width; |
| 1039 |
transform t; |
| 1040 |
t = identity scaled scale; |
| 1041 |
c = 1; |
| 1042 |
if p < 0.200: |
| 1043 |
c := 0; |
| 1044 |
t := t xscaled (p/0.200); |
| 1045 |
p := 0.200; |
| 1046 |
elseif p < 0.350: |
| 1047 |
c := (p - 0.200) / 0.350; |
| 1048 |
fi; |
| 1049 |
beginfig(0); |
| 1050 |
fill ( #3 ) transformed t; |
| 1051 |
setbounds currentpicture to |
| 1052 |
( (0,0) -- (p,0) -- (p,#2) -- (0,#2) -- cycle ) |
| 1053 |
transformed t; |
| 1054 |
endfig; |
| 1055 |
}% |
| 1056 |
\gre@trace@end% |
| 1057 |
}% |
| 1058 |
|
| 1059 |
% #1 : x-distance |
| 1060 |
% #2 : y-distance |
| 1061 |
% #3 : -1 for below, 1 for above |
| 1062 |
\def\gre@draw@slur#1#2#3{% |
| 1063 |
\gre@trace{gre@draw@slur{#1}{#2}{#3}}% |
| 1064 |
\gre@metapost{ |
| 1065 |
\grebracemetapostpreamble{\directlua{gregoriotex.hypotenuse([[#1]],[[#2]])}} |
| 1066 |
transform t; |
| 1067 |
t = identity scaled scale; |
| 1068 |
t := t xscaled width; |
| 1069 |
t := t rotated \directlua{gregoriotex.rotation([[#1]],[[#2]])}; |
| 1070 |
beginfig(0); |
| 1071 |
fill |
| 1072 |
( (0,0) |
| 1073 |
.. controls (0.3,#3*0.20) and (0.7,#3*0.20) |
| 1074 |
.. (1,0) |
| 1075 |
-- (1,0) |
| 1076 |
.. controls (0.7,#3*0.22) and (0.3,#3*0.22) |
| 1077 |
.. (0,0) |
| 1078 |
-- cycle |
| 1079 |
) transformed t withpen pencircle scaled 0.3; |
| 1080 |
endfig; |
| 1081 |
}% |
| 1082 |
\gre@trace@end% |
| 1083 |
}% |
| 1084 |
|
| 1085 |
\newdimen\greslurheight |
| 1086 |
% #1 : height |
| 1087 |
% #2 : -1 for below, 1 for above |
| 1088 |
% #3 : 0 = no left-shift, 1 = left-shift 1 punctum, 2 = left shift 1/2 punctum |
| 1089 |
% #4 : x-distance |
| 1090 |
% #5 : y-distance |
| 1091 |
% #6 : end height if #6 not given |
| 1092 |
\def\GreSlur#1#2#3#4#5#6{% |
| 1093 |
\gre@trace{GreSlur{#1}{#2}{#3}{#4}{#5}{#6}}% |
| 1094 |
\ifgre@boxing\else % |
| 1095 |
\ifnum\number#2 > 0\relax % |
| 1096 |
\gre@calculate@glyphraisevalue{#1}{15}{}% |
| 1097 |
\else % |
| 1098 |
\gre@calculate@glyphraisevalue{#1}{16}{}% |
| 1099 |
\fi % |
| 1100 |
\hbox to 0pt{\raise\gre@dimen@glyphraisevalue\hbox{% |
| 1101 |
\ifcase#3 % 0 |
| 1102 |
\or % 1 |
| 1103 |
\setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% |
| 1104 |
\kern-\wd\gre@box@temp@sign % |
| 1105 |
\or % 2 |
| 1106 |
\setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% |
| 1107 |
\kern-.5\wd\gre@box@temp@sign % |
| 1108 |
\fi % |
| 1109 |
\if\relax\detokenize{#5}\relax % |
| 1110 |
\gre@dimen@temp@five=\gre@dimen@glyphraisevalue\relax % |
| 1111 |
\ifnum\number#2 > 0\relax % |
| 1112 |
\gre@calculate@glyphraisevalue{#6}{15}{}% |
| 1113 |
\else % |
| 1114 |
\gre@calculate@glyphraisevalue{#6}{16}{}% |
| 1115 |
\fi % |
| 1116 |
\greslurheight = \dimexpr(\gre@dimen@glyphraisevalue - \gre@dimen@temp@five)\relax % |
| 1117 |
\else % |
| 1118 |
\greslurheight = #5\relax % |
| 1119 |
\fi % |
| 1120 |
\gre@draw@slur{#4}{\the\greslurheight}{#2}% |
| 1121 |
}}% |
| 1122 |
\fi % |
| 1123 |
\relax % |
| 1124 |
\gre@trace@end% |
| 1125 |
}% |
| 1126 |
|
| 1127 |
% #1: id of the variable length brace within the score |
| 1128 |
% this function cannot be traced because doing so interferes with it producing something which TeX recognizes as a number |
| 1129 |
\def\GreVarBraceLength#1{% |
| 1130 |
\ifgre@boxing\else % |
| 1131 |
\directlua{gregoriotex.var_brace_len(#1)}% |
| 1132 |
\fi % |
| 1133 |
}% |
| 1134 |
|
| 1135 |
% #1: id of the variable length brace within the score |
| 1136 |
% #2: 0 = no left-shift, 1 = left-shift 1 punctum, 2 = left shift 1/2 punctum |
| 1137 |
% #3: 1 if the start, 2 if the end |
| 1138 |
\def\GreVarBraceSavePos#1#2#3{% |
| 1139 |
\gre@trace{GreVarBraceSavePos{#1}{#2}{#3}}% |
| 1140 |
\ifgre@boxing\else % |
| 1141 |
\ifcase#2 % 0 |
| 1142 |
\gre@debugmsg{general}{save case 0}% |
| 1143 |
\gre@savepos % |
| 1144 |
\or % 1 |
| 1145 |
\setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% |
| 1146 |
\kern-\wd\gre@box@temp@sign % |
| 1147 |
\gre@savepos % |
| 1148 |
\kern\wd\gre@box@temp@sign % |
| 1149 |
\or % 2 |
| 1150 |
\gre@debugmsg{general}{save case 2}% |
| 1151 |
\setbox\gre@box@temp@sign=\hbox{\gre@fontchar@punctum}% |
| 1152 |
\gre@dimen@temp@five=\wd\gre@box@temp@sign % |
| 1153 |
\kern-.5\wd\gre@box@temp@sign % |
| 1154 |
\gre@savepos % |
| 1155 |
\kern.5\wd\gre@box@temp@sign % |
| 1156 |
\fi % |
| 1157 |
\directlua{gregoriotex.save_length(#1, #3)}% |
| 1158 |
\fi % |
| 1159 |
\relax % |
| 1160 |
\gre@trace@end% |
| 1161 |
}% |
| 1162 |
|
| 1163 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1164 |
%% macros for the typesetting of punctum mora, auctum duplex and choral signs |
| 1165 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1166 |
|
| 1167 |
% a function to typeset a punctum mora, |
| 1168 |
% #1 is the letter of the height of the punctum mora |
| 1169 |
% #2 is |
| 1170 |
% - 0 in the general case |
| 1171 |
% - 1 if we make the punctum mora 0-width (e.g!hv) |
| 1172 |
% - 2 if we shift the width of one punctum to the left (g.e) |
| 1173 |
% - 3 same as 2 but with ambitus of one (g.f) |
| 1174 |
% #3 is 1 in case of a punctommora in the note before the last note of a podatus, porrectus or torculus resupinus, 0 otherwise. |
| 1175 |
% #4 is 1 if we are at a punctum inclinatum, 0 otherwise |
| 1176 |
\def\gre@punctum@mora#1#2#3#4{% |
| 1177 |
\gre@trace{gre@punctum@mora{#1}{#2}{#3}{#4}}% |
| 1178 |
\GreNoBreak % |
| 1179 |
\ifcase#2\relax % |
| 1180 |
\gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% |
| 1181 |
\gre@hskip\gre@skip@temp@four% |
| 1182 |
\or % |
| 1183 |
\gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% |
| 1184 |
\kern\gre@skip@temp@four % |
| 1185 |
\or % |
| 1186 |
% to get the widht of a punctum minus a line, we calculate the width of a flexus (with ambitus of two) minus the width of a punctum |
| 1187 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPesQuadratumLongqueueThreeNothing}% |
| 1188 |
\gre@dimen@temp@five=\wd\gre@box@temp@width % |
| 1189 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% |
| 1190 |
\advance\gre@dimen@temp@five by -\wd\gre@box@temp@width % |
| 1191 |
\kern-\gre@dimen@temp@five % |
| 1192 |
\gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% |
| 1193 |
\kern\gre@skip@temp@four % |
| 1194 |
\or % |
| 1195 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPPunctum}% |
| 1196 |
\gre@dimen@temp@five=\wd\gre@box@temp@width % |
| 1197 |
\kern-\gre@dimen@temp@five % |
| 1198 |
\gre@skip@temp@four = \gre@space@skip@spacebeforesigns\relax% |
| 1199 |
\kern\gre@skip@temp@four % |
| 1200 |
\fi % |
| 1201 |
\ifnum#2=0\relax % |
| 1202 |
\global\gre@lastendswithmoratrue% |
| 1203 |
\fi % |
| 1204 |
\ifcase#3\relax % 0 |
| 1205 |
\gre@calculate@glyphraisevalue{#1}{4}{}% |
| 1206 |
\or% 1 |
| 1207 |
\gre@calculate@glyphraisevalue{#1}{8}{}% |
| 1208 |
\or% 2 |
| 1209 |
\gre@calculate@glyphraisevalue{#1}{14}{}% |
| 1210 |
\fi % |
| 1211 |
% here we shift a bit left in the case where we have a punctum inclinatum on a line |
| 1212 |
\ifnum#4=1\relax % |
| 1213 |
\ifgre@isonaline % |
| 1214 |
\gre@dimen@temp@three=\dimexpr(\gre@dimen@inclinatumonlinemorahshiftbase * \gre@factor)\relax % |
| 1215 |
\kern-\gre@dimen@temp@three % |
| 1216 |
\gre@dimen@temp@three=\dimexpr(\gre@dimen@inclinatumonlinemoravshiftbase * \gre@factor)\relax% |
| 1217 |
\advance\gre@dimen@glyphraisevalue by -\gre@dimen@temp@three % |
| 1218 |
\else % |
| 1219 |
\gre@dimen@temp@three=\dimexpr(\gre@dimen@inclinatumofflinemorahshiftbase * \gre@factor)\relax % |
| 1220 |
\advance\gre@dimen@glyphraisevalue by -\gre@dimen@temp@three % |
| 1221 |
\fi % |
| 1222 |
\fi % |
| 1223 |
\GreNoBreak % |
| 1224 |
\raise \gre@dimen@glyphraisevalue \hbox{\gre@fontchar@punctummora}% |
| 1225 |
\GreNoBreak % |
| 1226 |
\ifcase#2\relax\or % |
| 1227 |
\setbox\gre@box@temp@width=\hbox{\gre@fontchar@punctummora}% |
| 1228 |
\gre@skip@temp@four = -\wd\gre@box@temp@width % |
| 1229 |
\kern\gre@skip@temp@four% |
| 1230 |
\gre@skip@temp@four = -\gre@space@skip@spacebeforesigns\relax% |
| 1231 |
\kern\gre@skip@temp@four % |
| 1232 |
\or % |
| 1233 |
\setbox\gre@box@temp@width=\hbox{\gre@fontchar@punctummora}% |
| 1234 |
\gre@skip@temp@four = -\wd\gre@box@temp@width % |
| 1235 |
\kern\gre@skip@temp@four% |
| 1236 |
\gre@skip@temp@four = -\gre@space@skip@spacebeforesigns\relax% |
| 1237 |
\kern\gre@skip@temp@four % |
| 1238 |
\kern\gre@dimen@temp@five % |
| 1239 |
\or % |
| 1240 |
\setbox\gre@box@temp@width=\hbox{\gre@fontchar@punctummora}% |
| 1241 |
\gre@skip@temp@four = -\wd\gre@box@temp@width % |
| 1242 |
\kern\gre@skip@temp@four% |
| 1243 |
\gre@skip@temp@four = -\gre@space@skip@spacebeforesigns\relax% |
| 1244 |
\kern\gre@skip@temp@four % |
| 1245 |
\kern\gre@dimen@temp@five % |
| 1246 |
\fi % |
| 1247 |
\GreNoBreak % |
| 1248 |
\relax% |
| 1249 |
\gre@trace@end% |
| 1250 |
}% |
| 1251 |
|
| 1252 |
\def\GrePunctumMora#1#2#3#4{% |
| 1253 |
\gre@trace{GrePunctumMora{#1}{#2}{#3}{#4}}% |
| 1254 |
\ifgre@disablemora\else % |
| 1255 |
\gre@punctum@mora{#1}{#2}{#3}{#4}% |
| 1256 |
\fi % |
| 1257 |
\relax % |
| 1258 |
\gre@trace@end% |
| 1259 |
} |
| 1260 |
|
| 1261 |
% a function to typeset an augmentum duplex, easy enough to be understood... |
| 1262 |
\def\GreAugmentumDuplex#1#2#3{% |
| 1263 |
\gre@trace{GreAugmentumDuplex{#1}{#2}{#3}}% |
| 1264 |
\ifgre@boxing\else % |
| 1265 |
\GrePunctumMora{#1}{1}{#3}{0}% |
| 1266 |
\fi % |
| 1267 |
\GrePunctumMora{#2}{0}{0}{0}% |
| 1268 |
\relax % |
| 1269 |
\gre@trace@end% |
| 1270 |
}% |
| 1271 |
|
| 1272 |
% quite simple function: #1 is the height, #2 is the string, #3 is #2 of punctum mora, #4 is #3 of punctum mora |
| 1273 |
% #3 is 1 if it must be a bit higher |
| 1274 |
\def\GreLowChoralSign#1#2#3{% |
| 1275 |
\gre@trace{GreLowChoralSign{#1}{#2}{#3}}% |
| 1276 |
\GreNoBreak % |
| 1277 |
\gre@skip@temp@four = \gre@space@skip@beforelowchoralsignspace\relax% |
| 1278 |
\gre@hskip\gre@skip@temp@four % |
| 1279 |
\GreNoBreak % |
| 1280 |
\ifnum#3=1\relax % |
| 1281 |
\gre@calculate@glyphraisevalue{#1}{12}{}% |
| 1282 |
\else % |
| 1283 |
\gre@calculate@glyphraisevalue{#1}{10}{}% |
| 1284 |
\fi % |
| 1285 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@style@lowchoralsign#2\endgre@style@lowchoralsign}% |
| 1286 |
\relax % |
| 1287 |
\gre@trace@end% |
| 1288 |
}% |
| 1289 |
|
| 1290 |
\def\GreHighChoralSign#1#2#3{% |
| 1291 |
\gre@trace{GreHighChoralSign{#1}{#2}{#3}}% |
| 1292 |
\GreNoBreak % |
| 1293 |
\gre@vepisemaorrare{#1}{#3}{}{3}{\gre@style@highchoralsign#2\endgre@style@highchoralsign}% |
| 1294 |
\relax % |
| 1295 |
\gre@trace@end% |
| 1296 |
}% |
| 1297 |
|
| 1298 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1299 |
%% macros for the typesetting of vertical episema |
| 1300 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1301 |
|
| 1302 |
\newbox\gre@box@temp@sign% |
| 1303 |
|
| 1304 |
% a macro to help typesetting vertical episema. |
| 1305 |
% #1 is an offset glyph (see #3 below) |
| 1306 |
% #2 represents the glyph upon which the sign is to be centered |
| 1307 |
% #3 is a case number |
| 1308 |
% 0 : go back to the beginning of the previous glyph and then forward half |
| 1309 |
% the width of #2; this puts the sign at the beginning of the previous |
| 1310 |
% glyph, whose first note is the size of #2 |
| 1311 |
% 1 : go back half the width of #2; this puts the sign at the end of the |
| 1312 |
% previous glyph, whose last note is the size of #2 |
| 1313 |
% 2 : go back the width of #1 and then foward half the width of #2; this |
| 1314 |
% puts the sign at the glyph from the end that starts at #1's width from |
| 1315 |
% the end |
| 1316 |
% 3 : go back to the beginning of the previous glyph and then forward the |
| 1317 |
% width of #1 and then back half the width of #2; this puts the sign at |
| 1318 |
% the glyph from the start that ends at #1's width from the start |
| 1319 |
% #4 is a shift that we want to get applied, useful for punctum inclinatum for example |
| 1320 |
% #5 is the glyph number. |
| 1321 |
% #6 is the type of sign (1: vertical episema, 2: rare sign, 3: choral sign) |
| 1322 |
% #7 is the choral sign if relevant |
| 1323 |
\def\gre@vepisemaorrareaux#1#2#3#4#5#6#7{% |
| 1324 |
\gre@trace{gre@vepisemaorrareaux{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% |
| 1325 |
% first we set \gre@dimen@temp@three to the width of the last glyph |
| 1326 |
\gre@dimen@temp@three=\gre@dimen@lastglyphwidth\relax% |
| 1327 |
\setbox\gre@box@temp@sign=\hbox{\gre@font@music #2}% |
| 1328 |
\gre@dimen@temp@two=\dimexpr(\wd\gre@box@temp@sign / 2)\relax % |
| 1329 |
\ifcase#3% |
| 1330 |
% tempwidth is the width of the last glyph |
| 1331 |
\advance\gre@dimen@temp@three by -\gre@dimen@temp@two % |
| 1332 |
\or% |
| 1333 |
\gre@dimen@temp@three=\gre@dimen@temp@two % |
| 1334 |
\or% |
| 1335 |
\setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% |
| 1336 |
\gre@dimen@temp@three=\dimexpr(\wd\gre@box@temp@sign - \gre@dimen@temp@two)\relax % |
| 1337 |
\or % |
| 1338 |
\setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% |
| 1339 |
\advance\gre@dimen@temp@three by \dimexpr(-\wd\gre@box@temp@sign + \gre@dimen@temp@two)\relax % |
| 1340 |
\fi% |
| 1341 |
\kern-\gre@dimen@temp@three % we do it here because of the now-removed ictus (chironomy) |
| 1342 |
% then we draw the sign |
| 1343 |
\ifcase#6\or % |
| 1344 |
% vertical episema |
| 1345 |
\setbox\gre@box@temp@sign=\hbox{\gre@fontchar@verticalepisema}% |
| 1346 |
\or % rare sign |
| 1347 |
\setbox\gre@box@temp@sign=\hbox{\gre@font@music#5}% |
| 1348 |
\or % choral sign |
| 1349 |
\setbox\gre@box@temp@sign=\hbox{#7}% |
| 1350 |
\or % brace above bar |
| 1351 |
\setbox\gre@box@temp@sign=\hbox{\gre@render@barbrace}% |
| 1352 |
\fi % |
| 1353 |
% we set tempwidth to half a punctum malus half the sign width, so that the centers are aligned |
| 1354 |
\gre@dimen@temp@two=\dimexpr(\wd\gre@box@temp@sign / 2)\relax % |
| 1355 |
\advance\gre@dimen@temp@three by \gre@dimen@temp@two % |
| 1356 |
\kern-\gre@dimen@temp@two% |
| 1357 |
\gre@skip@temp@four = #4sp% |
| 1358 |
\kern \gre@skip@temp@four% |
| 1359 |
\raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % |
| 1360 |
\kern -\gre@skip@temp@four% |
| 1361 |
% and finally we go back to the end of the glyph, where we were first |
| 1362 |
\advance\gre@dimen@temp@three by -2\gre@dimen@temp@two % |
| 1363 |
\kern\gre@dimen@temp@three% |
| 1364 |
\relax% |
| 1365 |
\gre@trace@end% |
| 1366 |
}% |
| 1367 |
|
| 1368 |
\directlua{gregoriotex.emit_offset_macros()}% |
| 1369 |
|
| 1370 |
% a function to typeset a vertical episema or a rare accent (like accentus, |
| 1371 |
% circulus, etc.). This function must be called after a call to \GreGlyph. |
| 1372 |
% #1 is the letter of the height of the episema (not the height of the note |
| 1373 |
% it corresponds to. |
| 1374 |
% #2 is note position case as in the table above |
| 1375 |
% #3 is the sign glyph |
| 1376 |
% #4 is type (1: vertical episema, 2: rare sign, 3: choral sign, 4: brace above the bar) |
| 1377 |
% #5 is the choral sign if relevant |
| 1378 |
\def\gre@vepisemaorrare#1#2#3#4#5{% |
| 1379 |
\gre@trace{gre@vepisemaorrare{#1}{#2}{#3}{#4}{#5}}% |
| 1380 |
\ifgre@boxing\else % |
| 1381 |
\ifcase#4\or % |
| 1382 |
% if it is a vertical episema, we call the normal calculateglyphvalue |
| 1383 |
\gre@calculate@glyphraisevalue{#1}{3}{}% |
| 1384 |
\or % |
| 1385 |
% if it is not, we call it with 6 as second argument, it will give us the height of the rare signs (accentus, etc.) the first argument is m if the pitch is < k, otherwise it's n. |
| 1386 |
\ifnum#1<\gre@pitch@raresign\relax % |
| 1387 |
\gre@calculate@glyphraisevalue{\gre@pitch@raresign}{6}{}% |
| 1388 |
\else % |
| 1389 |
{% |
| 1390 |
\gre@count@temp@three=\numexpr(#1 + 1)\relax % |
| 1391 |
\gre@calculate@glyphraisevalue{\gre@count@temp@three}{6}{}% |
| 1392 |
}% |
| 1393 |
\fi % |
| 1394 |
\or % if it's a choral sign |
| 1395 |
\gre@calculate@glyphraisevalue{#1}{11}{}% |
| 1396 |
\or % if it's the brace above the bar |
| 1397 |
\gre@calculate@glyphraisevalue{#1}{13}{}% |
| 1398 |
\fi % |
| 1399 |
\gre@v@case{#2}{#3}{#4}{#5}% |
| 1400 |
\fi % |
| 1401 |
\relax% |
| 1402 |
\gre@trace@end% |
| 1403 |
}% |
| 1404 |
|
| 1405 |
\def\GreVEpisema#1#2{% |
| 1406 |
\gre@trace{GreVEpisema{#1}{#2}}% |
| 1407 |
\ifgre@disablevepisema\else % |
| 1408 |
\gre@vepisemaorrare{#1}{#2}{\GreCPVEpisema}{1}{}% |
| 1409 |
\fi % |
| 1410 |
\relax % |
| 1411 |
\gre@trace@end% |
| 1412 |
}% |
| 1413 |
|
| 1414 |
\def\GreBarBrace#1{% |
| 1415 |
\gre@trace{GreBarBrace{#1}}% |
| 1416 |
\gre@vepisemaorrare{\gre@pitch@overbraceglyph}{#1}{% |
| 1417 |
\gre@render@barbrace% |
| 1418 |
}{4}{}% |
| 1419 |
\relax % |
| 1420 |
\gre@trace@end% |
| 1421 |
}% |
| 1422 |
\def\gre@render@barbrace{% |
| 1423 |
\gre@trace{gre@render@barbrace}% |
| 1424 |
\hbox{% |
| 1425 |
\ifgre@metapost@barbrace % |
| 1426 |
\gre@draw@brace{*}% |
| 1427 |
\else % |
| 1428 |
\gre@fontchar@abovebarbrace % |
| 1429 |
\fi % |
| 1430 |
}% |
| 1431 |
\gre@trace@end% |
| 1432 |
}% |
| 1433 |
|
| 1434 |
\def\GreBarVEpisema#1{% |
| 1435 |
\gre@trace{GreBarVEpisema{#1}}% |
| 1436 |
\gre@vepisemaorrare{\gre@pitch@barvepisema}{#1}{\GreCPVEpisema}{1}{}% |
| 1437 |
\relax % |
| 1438 |
\gre@trace@end% |
| 1439 |
}% |
| 1440 |
|
| 1441 |
\def\GreAccentus#1#2{% |
| 1442 |
\gre@trace{GreAccentus{#1}{#2}}% |
| 1443 |
\gre@vepisemaorrare{#1}{#2}{\GreCPAccentus}{2}{}% |
| 1444 |
\relax % |
| 1445 |
\gre@trace@end% |
| 1446 |
}% |
| 1447 |
|
| 1448 |
\def\GreSemicirculus#1#2{% |
| 1449 |
\gre@trace{GreSemicirculus{#1}{#2}}% |
| 1450 |
\gre@vepisemaorrare{#1}{#2}{\GreCPSemicirculus}{2}{}% |
| 1451 |
\relax % |
| 1452 |
\gre@trace@end% |
| 1453 |
}% |
| 1454 |
|
| 1455 |
\def\GreCirculus#1#2{% |
| 1456 |
\gre@trace{GreCirculus{#1}{#2}}% |
| 1457 |
\gre@vepisemaorrare{#1}{#2}{\GreCPCirculus}{2}{}% |
| 1458 |
\relax % |
| 1459 |
\gre@trace@end% |
| 1460 |
}% |
| 1461 |
|
| 1462 |
\def\GreReversedAccentus#1#2{% |
| 1463 |
\gre@trace{GreReversedAccentus{#1}{#2}}% |
| 1464 |
\gre@vepisemaorrare{#1}{#2}{\GreCPAccentusReversus}{2}{}% |
| 1465 |
\relax % |
| 1466 |
\gre@trace@end% |
| 1467 |
}% |
| 1468 |
|
| 1469 |
\def\GreReversedSemicirculus#1#2{% |
| 1470 |
\gre@trace{GreReversedSemicirculus{#1}{#2}}% |
| 1471 |
\gre@vepisemaorrare{#1}{#2}{\GreCPSemicirculusReversus}{2}{}% |
| 1472 |
\relax % |
| 1473 |
\gre@trace@end% |
| 1474 |
}% |
| 1475 |
|
| 1476 |
\def\GreMusicaFictaFlat#1#2{% |
| 1477 |
\gre@trace{GreMusicaFictaFlat{#1}{#2}}% |
| 1478 |
\gre@vepisemaorrare{#1}{#2}{\GreCPFlat}{2}{}% |
| 1479 |
\relax % |
| 1480 |
\gre@trace@end% |
| 1481 |
}% |
| 1482 |
|
| 1483 |
\def\GreMusicaFictaNatural#1#2{% |
| 1484 |
\gre@trace{GreMusicaFictaNatural{#1}{#2}}% |
| 1485 |
\gre@vepisemaorrare{#1}{#2}{\GreCPNatural}{2}{}% |
| 1486 |
\relax % |
| 1487 |
\gre@trace@end% |
| 1488 |
}% |
| 1489 |
|
| 1490 |
\def\GreMusicaFictaSharp#1#2{% |
| 1491 |
\gre@trace{GreMusicaFictaSharp{#1}{#2}}% |
| 1492 |
\gre@vepisemaorrare{#1}{#2}{\GreCPSharp}{2}{}% |
| 1493 |
\relax % |
| 1494 |
\gre@trace@end% |
| 1495 |
}% |
| 1496 |
|
| 1497 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1498 |
%% macros for the typesetting horizontal episema |
| 1499 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1500 |
|
| 1501 |
|
| 1502 |
% a macro that will help in the typesetting of a horizontal episema and additional lines, |
| 1503 |
% #1 is an offset glyph (see #3, below) |
| 1504 |
% #2 is the episema glyph |
| 1505 |
% #3 is a case number, similar in nature to #3 in gre@vepisemaorrareaux |
| 1506 |
% 0 : go back to the beginning of the previous glyph; this starts the |
| 1507 |
% episema at the beginning of the previous glyph |
| 1508 |
% 1 : stay at the end of the glyph; doesn't make much sense to use this |
| 1509 |
% 2 : go back the width of #1; this starts the episema at the glyph from |
| 1510 |
% the end that starts at #1's width from the end |
| 1511 |
% 3 : go back to the beginning of the previous glyph and then forward the |
| 1512 |
% width of #1; this starts the episema at the glyph from the start that |
| 1513 |
% starts just after #1's width from the start |
| 1514 |
% 4 : go back to the beginning of the previous glyph and then forward the |
| 1515 |
% width of #1, then back the width of #2; this ends the episema at the |
| 1516 |
% end of #1 |
| 1517 |
% #4 argument is the same as in hepisorline |
| 1518 |
\def\gre@hepisorlineaux#1#2#3#4{% |
| 1519 |
\gre@trace{gre@hepisorlineaux{#1}{#2}{#3}{#4}}% |
| 1520 |
\ifcase#3% case 0 |
| 1521 |
% first we set \gre@dimen@temp@three to the width of the last glyph |
| 1522 |
\gre@dimen@temp@three=\gre@dimen@lastglyphwidth\relax% |
| 1523 |
\or % case 1 |
| 1524 |
\gre@dimen@temp@three=0 pt\relax % |
| 1525 |
\or % case 2 |
| 1526 |
\setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% |
| 1527 |
\gre@dimen@temp@three=\wd\gre@box@temp@sign% |
| 1528 |
\or % case 3 |
| 1529 |
\setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% |
| 1530 |
\gre@dimen@temp@three=\dimexpr(\gre@dimen@lastglyphwidth - \wd\gre@box@temp@sign)\relax % |
| 1531 |
\or % case 4 |
| 1532 |
\setbox\gre@box@temp@sign=\hbox{\gre@font@music #1}% |
| 1533 |
\gre@dimen@temp@three=\dimexpr(\gre@dimen@lastglyphwidth - \wd\gre@box@temp@sign)\relax % |
| 1534 |
\setbox\gre@box@temp@sign=\hbox{\gre@font@music #2}% |
| 1535 |
\advance\gre@dimen@temp@three by \wd\gre@box@temp@sign % |
| 1536 |
\fi% |
| 1537 |
\kern-\gre@dimen@temp@three % |
| 1538 |
% then we draw the sign, and go back to the beginning of the sign |
| 1539 |
\setbox\gre@box@temp@sign=\hbox{\gre@font@music#2}% |
| 1540 |
% we set tempwidth to half a punctum malus half the sign width, so that the centers are aligned |
| 1541 |
\gre@dimen@temp@two=\wd\gre@box@temp@sign % |
| 1542 |
\gre@debugmsg{general}{gre@dimen@temp@two = \the\gre@dimen@temp@two}% |
| 1543 |
\ifcase#4% |
| 1544 |
%case of hepisema |
| 1545 |
\raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % |
| 1546 |
\or % |
| 1547 |
%case of hepisema at the bottom |
| 1548 |
\raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % |
| 1549 |
\or % case of a line at the top |
| 1550 |
\ifnum\gre@count@lastglyphiscavum=2\relax % |
| 1551 |
\gre@drawadditionalline{0}{\gre@dimen@temp@two}{0}{}{1}{}% |
| 1552 |
\else % |
| 1553 |
\gre@drawadditionalline{0}{\gre@dimen@temp@two}{1}{}{1}{}% |
| 1554 |
\fi % |
| 1555 |
\gre@dimen@temp@two=0pt\relax % |
| 1556 |
\or % case of a line at the bottom |
| 1557 |
\ifnum\gre@count@lastglyphiscavum=2\relax % |
| 1558 |
\gre@drawadditionalline{1}{\gre@dimen@temp@two}{0}{}{1}{}% |
| 1559 |
\else % |
| 1560 |
\gre@drawadditionalline{1}{\gre@dimen@temp@two}{1}{}{1}{}% |
| 1561 |
\fi % |
| 1562 |
\gre@dimen@temp@two=0pt\relax % |
| 1563 |
\or % |
| 1564 |
%case of choral sign |
| 1565 |
\raise \gre@dimen@glyphraisevalue \copy\gre@box@temp@sign % |
| 1566 |
\or % |
| 1567 |
\fi % |
| 1568 |
% and finally we go back to the end of the glyph, where we were first |
| 1569 |
\advance\gre@dimen@temp@three by -\gre@dimen@temp@two % |
| 1570 |
\kern\gre@dimen@temp@three % |
| 1571 |
\relax% |
| 1572 |
\gre@trace@end% |
| 1573 |
}% |
| 1574 |
|
| 1575 |
% another dumb top function |
| 1576 |
\def\GreAdditionalLine#1#2#3{% |
| 1577 |
\gre@trace{GreAdditionalLine{#1}{#2}{#3}}% |
| 1578 |
\ifgre@showlines % |
| 1579 |
\ifgre@boxing\else % |
| 1580 |
\xdef\gre@saved@dimen@glyphraise{\the\gre@dimen@glyphraisevalue}% |
| 1581 |
\gre@style@additionalstafflines % |
| 1582 |
\gre@hepisorline{\gre@pitch@dummy}{#1}{#2}{#3}{f}{}{}% |
| 1583 |
\endgre@style@additionalstafflines% |
| 1584 |
\gre@dimen@glyphraisevalue=\gre@saved@dimen@glyphraise\relax% |
| 1585 |
\fi % |
| 1586 |
\fi % |
| 1587 |
\relax % |
| 1588 |
\gre@trace@end% |
| 1589 |
}% |
| 1590 |
|
| 1591 |
% #1 0 for over staff, |
| 1592 |
% 1 for under staff |
| 1593 |
% #2 length of line |
| 1594 |
% #3 0 for no space before, |
| 1595 |
% 1 for \gre@space@dimen@additionallineswidth before, |
| 1596 |
% 2 for #4 space before |
| 1597 |
% #4 custom space before, used if #2 is 2 |
| 1598 |
% #5 0 for no space after, |
| 1599 |
% 1 for \gre@space@dimen@additionallineswidth after, |
| 1600 |
% 2 for #6 space after |
| 1601 |
% #6 custom space after, used if #4 is 2 |
| 1602 |
\def\GreDrawAdditionalLine#1#2#3#4#5#6{% |
| 1603 |
\gre@trace{GreDrawAdditionalLine{#1}{#2}{#3}{#4}{#5}{#6}}% |
| 1604 |
\ifgre@showlines % |
| 1605 |
\xdef\gre@saved@dimen@glyphraise{\the\gre@dimen@glyphraisevalue}% |
| 1606 |
\gre@style@additionalstafflines % |
| 1607 |
\gre@drawadditionalline{#1}{#2}{#3}{#4}{#5}{#6}% |
| 1608 |
\endgre@style@additionalstafflines% |
| 1609 |
\gre@dimen@glyphraisevalue=\gre@saved@dimen@glyphraise\relax% |
| 1610 |
\fi % |
| 1611 |
\relax % |
| 1612 |
\gre@trace@end% |
| 1613 |
} |
| 1614 |
\def\gre@drawadditionalline#1#2#3#4#5#6{% |
| 1615 |
\gre@trace{gre@drawadditionalline{#1}{#2}{#3}{#4}{#5}{#6}}% |
| 1616 |
\ifcase#3 % 0 |
| 1617 |
\gre@dimen@temp@five=0pt\relax % |
| 1618 |
\or % 1 |
| 1619 |
\gre@dimen@temp@five=\gre@space@dimen@additionallineswidth\relax % |
| 1620 |
\or % 2 |
| 1621 |
\gre@dimen@temp@five=#4\relax % |
| 1622 |
\fi % |
| 1623 |
\ifcase#5 % 0 |
| 1624 |
\gre@dimen@temp@four=0pt\relax % |
| 1625 |
\or % 1 |
| 1626 |
\gre@dimen@temp@four=\gre@space@dimen@additionallineswidth\relax % |
| 1627 |
\or % 2 |
| 1628 |
\gre@dimen@temp@four=#6\relax % |
| 1629 |
\fi % |
| 1630 |
\gre@dimen@temp@two=% |
| 1631 |
\dimexpr(#2 % |
| 1632 |
+ \gre@dimen@temp@five % |
| 1633 |
+ \gre@dimen@temp@four)\relax % |
| 1634 |
\ifcase#1 % 0 |
| 1635 |
\gre@dimen@glyphraisevalue=% |
| 1636 |
\dimexpr(\gre@dimen@additionalbottomspace % |
| 1637 |
+ \gre@space@dimen@spacebeneathtext % |
| 1638 |
+ \gre@space@dimen@spacelinestext % |
| 1639 |
+ \gre@dimen@currenttranslationheight % |
| 1640 |
+ \gre@count@stafflines\gre@dimen@interstafflinespace % |
| 1641 |
+ \gre@count@stafflines\gre@dimen@stafflineheight)\relax% |
| 1642 |
\or % 1 |
| 1643 |
\gre@dimen@glyphraisevalue=% |
| 1644 |
\dimexpr(\gre@dimen@additionalbottomspace % |
| 1645 |
+ \gre@space@dimen@spacebeneathtext % |
| 1646 |
+ \gre@space@dimen@spacelinestext % |
| 1647 |
+ \gre@dimen@currenttranslationheight % |
| 1648 |
- \gre@dimen@interstafflinespace % |
| 1649 |
- \gre@dimen@stafflineheight)\relax% |
| 1650 |
\fi % |
| 1651 |
\raise\gre@dimen@glyphraisevalue\hbox to 0pt{% |
| 1652 |
\kern-\gre@dimen@temp@five % |
| 1653 |
\vrule height \gre@dimen@stafflineheight % |
| 1654 |
width \gre@dimen@temp@two % |
| 1655 |
}% |
| 1656 |
\gre@trace@end% |
| 1657 |
} |
| 1658 |
|
| 1659 |
% a function to typeset a horizontal line (additional line or episema). |
| 1660 |
% This function must be called after a call to \GreGlyph. |
| 1661 |
% #1 is the letter of the height of the episema (not the height of the note |
| 1662 |
% it corresponds to. |
| 1663 |
% #2 is note position case as in the table above |
| 1664 |
% #3 is the ambitus for a two note episema at the diagonal stroke of a |
| 1665 |
% porrectus, porrectus flexus, orculus resupinus, or torculus resupinus |
| 1666 |
% flexus |
| 1667 |
% #4 is 0 for an horizontal episema, 1 for an horizontal episema under a |
| 1668 |
% note, 3 for a line at the bottom, 2 for a line at the top |
| 1669 |
% #5 is f for a normal episema, l for a small episema aligned left, |
| 1670 |
% c for a small episema aligned center, or r for a small episema |
| 1671 |
% aligned right |
| 1672 |
% #6 is the vertical nudge |
| 1673 |
% #7 is horizontal episema interline position case |
| 1674 |
%% 0 : auto |
| 1675 |
%% 1 : middle |
| 1676 |
%% 2 : low in space above note |
| 1677 |
%% 3 : high in space above note |
| 1678 |
%% 4 : low in space below note |
| 1679 |
%% 5 : high in space below note |
| 1680 |
\def\gre@hepisorline#1#2#3#4#5#6#7{{% |
| 1681 |
\gre@trace{gre@hepisorline{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% |
| 1682 |
\ifcase#4 % 0 |
| 1683 |
\gre@calculate@glyphraisevalue{#1}{9}{#7}% |
| 1684 |
\or % 1 |
| 1685 |
\gre@calculate@glyphraisevalue{#1}{5}{#7}% |
| 1686 |
\or % 2 |
| 1687 |
% the glyphraisevalue is ignored anyway... but it's just in case... |
| 1688 |
\gre@calculate@glyphraisevalue{\gre@pitch@ledger@above}{0}{}% |
| 1689 |
\or % 3 |
| 1690 |
\gre@calculate@glyphraisevalue{\gre@pitch@ledger@below}{0}{}% |
| 1691 |
\fi % |
| 1692 |
\global\gre@dimen@glyphraisevalue=\dimexpr\gre@dimen@glyphraisevalue#6\relax % |
| 1693 |
\gre@h@case{#2}{#3}{#4}{#5}% |
| 1694 |
\relax% |
| 1695 |
\gre@trace@end% |
| 1696 |
}}% |
| 1697 |
|
| 1698 |
% dumb top function |
| 1699 |
% #6 is a trick for bridges: if we must use a different height because of a |
| 1700 |
% bridge, use #6, otherwise use #1 |
| 1701 |
% #7 is used for setting heuristics |
| 1702 |
% #8 is the vertical nudge |
| 1703 |
% #9 is horizontal episema interline position case |
| 1704 |
%% 0 : auto |
| 1705 |
%% 1 : middle |
| 1706 |
%% 2 : low in space above note |
| 1707 |
%% 3 : high in space above note |
| 1708 |
%% 4 : low in space below note |
| 1709 |
%% 5 : high in space below note |
| 1710 |
\def\GreHEpisema#1#2#3#4#5#6#7#8#9{% |
| 1711 |
\gre@trace{GreHEpisema{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}% |
| 1712 |
\ifgre@boxing\else\ifgre@disablehepisema\else % |
| 1713 |
\gre@prephepisemaledgerlineheuristics% |
| 1714 |
#7% |
| 1715 |
\ifgre@hepisemabridge% |
| 1716 |
\gre@hepisorline{#6}{#2}{#3}{#4}{#5}{#8}{#9}% |
| 1717 |
\else % |
| 1718 |
\gre@hepisorline{#1}{#2}{#3}{#4}{#5}{#8}{#9}% |
| 1719 |
\fi % |
| 1720 |
\gre@resetledgerlineheuristics% |
| 1721 |
\fi\fi % |
| 1722 |
\relax % |
| 1723 |
\gre@trace@end% |
| 1724 |
}% |
| 1725 |
|
| 1726 |
\newif\ifgre@hepisemabridge |
| 1727 |
\gre@hepisemabridgetrue |
| 1728 |
|
| 1729 |
\def\gresethepisema#1{% |
| 1730 |
\gre@trace{gresethepisema{#1}}% |
| 1731 |
\IfStrEqCase{#1}{% |
| 1732 |
{bridge}% |
| 1733 |
{\gre@hepisemabridgetrue}% |
| 1734 |
{break}% |
| 1735 |
{\gre@hepisemabridgefalse}% |
| 1736 |
}[% all other cases |
| 1737 |
\gre@error{Unrecognized option, #1, for \protect\gresethepisema\MessageBreak Possible options are: 'bridge' and 'break'}% |
| 1738 |
]% |
| 1739 |
\gre@trace@end% |
| 1740 |
}% |
| 1741 |
|
| 1742 |
% same but for a "bridge episema" after the last note of a glyph (element, syllable) if the next episema is at the same height |
| 1743 |
% #1 is the height |
| 1744 |
% #2 is 0 for episema above, 1 for episema below |
| 1745 |
% #3 is the "space case" for the following note, if a punctum inclinatum |
| 1746 |
% #4 is for setting heuristics |
| 1747 |
% #5 is the vertical nudge |
| 1748 |
% #6 is horizontal episema interline position case |
| 1749 |
%% 0 : auto |
| 1750 |
%% 1 : middle |
| 1751 |
%% 2 : low in space above note |
| 1752 |
%% 3 : high in space above note |
| 1753 |
%% 4 : low in space below note |
| 1754 |
%% 5 : high in space below note |
| 1755 |
\def\GreHEpisemaBridge#1#2#3#4#5#6{% |
| 1756 |
\gre@trace{GreHEpisemaBridge{#1}{#2}{#3}{#4}{#5}{#6}}% |
| 1757 |
\ifgre@hepisemabridge% |
| 1758 |
\ifgre@boxing\else % |
| 1759 |
\gre@prephepisemaledgerlineheuristics% |
| 1760 |
#4% |
| 1761 |
\ifcase#2 % |
| 1762 |
\gre@calculate@glyphraisevalue{#1}{9}{#6}% |
| 1763 |
\or % |
| 1764 |
\gre@calculate@glyphraisevalue{#1}{5}{#6}% |
| 1765 |
\fi % |
| 1766 |
\global\gre@dimen@glyphraisevalue=\dimexpr\gre@dimen@glyphraisevalue#5\relax % |
| 1767 |
\IfStrEq{-1}{#3}{% |
| 1768 |
\raise\gre@dimen@glyphraisevalue\hbox to 0pt{\gre@font@music\gre@char@he@punctum{f}\hss}% |
| 1769 |
}{% |
| 1770 |
% special handling for punctum inclinatum |
| 1771 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPHEpisemaPunctumReduced}% |
| 1772 |
\gre@dimen@temp@four = \wd\gre@box@temp@width\relax % |
| 1773 |
\gre@get@spaceskip{#3}% |
| 1774 |
% convert rubber length to dimension... not perfect but works in the usual case |
| 1775 |
\gre@dimen@temp@three = 1\gre@skip@temp@four\relax % |
| 1776 |
\raise\gre@dimen@glyphraisevalue\hbox to 0pt{% |
| 1777 |
\loop\ifdim\gre@dimen@temp@three > 0pt\relax% |
| 1778 |
\advance\gre@dimen@temp@three by -\gre@dimen@temp@four\relax % |
| 1779 |
{\gre@font@music\GreCPHEpisemaPunctumReduced}% |
| 1780 |
\repeat % |
| 1781 |
\kern\gre@dimen@temp@three{\gre@font@music\GreCPHEpisemaPunctumReduced}% |
| 1782 |
\hss % |
| 1783 |
}% |
| 1784 |
}% |
| 1785 |
\gre@resetledgerlineheuristics% |
| 1786 |
\fi % |
| 1787 |
\fi % |
| 1788 |
\relax % |
| 1789 |
\gre@trace@end% |
| 1790 |
}% |
| 1791 |
|
| 1792 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1793 |
%% macros for the typesetting of bars |
| 1794 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1795 |
|
| 1796 |
% flag to indicate that lines behind an dotted bar should be hidden |
| 1797 |
\newif\ifgre@hidedottedbarlines |
| 1798 |
% default state is to hide them |
| 1799 |
\gre@hidedottedbarlinestrue |
| 1800 |
|
| 1801 |
% macro for manipulating above flag |
| 1802 |
\def\gresetlinesbehinddottedbar#1{% |
| 1803 |
\gre@trace{gresetlinesbehinddottedbar{#1}}% |
| 1804 |
\IfStrEqCase{#1}{% |
| 1805 |
{visible}% |
| 1806 |
{\gre@hidedottedbarlinesfalse}% |
| 1807 |
{invisible}% |
| 1808 |
{\gre@hidedottedbarlinestrue}% |
| 1809 |
}[% all other cases |
| 1810 |
\gre@error{Unrecognized option "#1" for \protect\gresetlinesbehinddottedbar\MessageBreak Possible options are: 'visible' and 'invisible'}% |
| 1811 |
]% |
| 1812 |
\gre@trace@end% |
| 1813 |
}% |
| 1814 |
|
| 1815 |
% we define two types of macro for each four bar : when it is inside a syllable, and when it is not |
| 1816 |
|
| 1817 |
\def\GreInVirgula#1#2#3{% |
| 1818 |
\gre@trace{GreInVirgula{#1}{#2}{#3}}% |
| 1819 |
\gre@writebar{0}{1}{#1}{#2}{#3}% |
| 1820 |
\relax% |
| 1821 |
\gre@trace@end% |
| 1822 |
}% |
| 1823 |
|
| 1824 |
\def\GreVirgula#1#2#3{% |
| 1825 |
\gre@trace{GreVirgula{#1}{#2}{#3}}% |
| 1826 |
\gre@writebar{0}{0}{#1}{#2}{#3}% |
| 1827 |
\relax% |
| 1828 |
\gre@trace@end% |
| 1829 |
}% |
| 1830 |
|
| 1831 |
\def\GreInVirgulaHigh#1#2#3{% |
| 1832 |
\gre@trace{GreInVirgulaHigh{#1}{#2}{#3}}% |
| 1833 |
\gre@writebar{14}{1}{#1}{#2}{#3}% |
| 1834 |
\relax% |
| 1835 |
\gre@trace@end% |
| 1836 |
}% |
| 1837 |
|
| 1838 |
\def\GreVirgulaHigh#1#2#3{% |
| 1839 |
\gre@trace{GreVirgulaHigh{#1}{#2}{#3}}% |
| 1840 |
\gre@writebar{14}{0}{#1}{#2}{#3}% |
| 1841 |
\relax% |
| 1842 |
\gre@trace@end% |
| 1843 |
}% |
| 1844 |
|
| 1845 |
\def\GreInVirgulaParen#1#2#3{% |
| 1846 |
\gre@trace{GreInVirgulaParen{#1}{#2}{#3}}% |
| 1847 |
\gre@writebar{19}{1}{#1}{#2}{#3}% |
| 1848 |
\relax% |
| 1849 |
\gre@trace@end% |
| 1850 |
}% |
| 1851 |
|
| 1852 |
\def\GreVirgulaParen#1#2#3{% |
| 1853 |
\gre@trace{GreVirgulaParen{#1}{#2}{#3}}% |
| 1854 |
\gre@writebar{19}{0}{#1}{#2}{#3}% |
| 1855 |
\relax% |
| 1856 |
\gre@trace@end% |
| 1857 |
}% |
| 1858 |
|
| 1859 |
\def\GreInVirgulaParenHigh#1#2#3{% |
| 1860 |
\gre@trace{GreInVirgulaParenHigh{#1}{#2}{#3}}% |
| 1861 |
\gre@writebar{21}{1}{#1}{#2}{#3}% |
| 1862 |
\relax% |
| 1863 |
\gre@trace@end% |
| 1864 |
}% |
| 1865 |
|
| 1866 |
\def\GreVirgulaParenHigh#1#2#3{% |
| 1867 |
\gre@trace{GreVirgulaParenHigh{#1}{#2}{#3}}% |
| 1868 |
\gre@writebar{21}{0}{#1}{#2}{#3}% |
| 1869 |
\relax% |
| 1870 |
\gre@trace@end% |
| 1871 |
}% |
| 1872 |
|
| 1873 |
\def\GreInDivisioMinimis#1#2#3{% |
| 1874 |
\gre@trace{GreInDivisioMinimis{#1}{#2}{#3}}% |
| 1875 |
\gre@writebar{17}{1}{#1}{#2}{#3}% |
| 1876 |
\relax% |
| 1877 |
\gre@trace@end% |
| 1878 |
}% |
| 1879 |
|
| 1880 |
\def\GreDivisioMinimis#1#2#3{% |
| 1881 |
\gre@trace{GreDivisioMinimis{#1}{#2}{#3}}% |
| 1882 |
\gre@writebar{17}{0}{#1}{#2}{#3}% |
| 1883 |
\relax% |
| 1884 |
\gre@trace@end% |
| 1885 |
}% |
| 1886 |
|
| 1887 |
\def\GreInDivisioMinimisHigh#1#2#3{% |
| 1888 |
\gre@trace{GreInDivisioMinimisHigh{#1}{#2}{#3}}% |
| 1889 |
\gre@writebar{18}{1}{#1}{#2}{#3}% |
| 1890 |
\relax% |
| 1891 |
\gre@trace@end% |
| 1892 |
}% |
| 1893 |
|
| 1894 |
\def\GreDivisioMinimisHigh#1#2#3{% |
| 1895 |
\gre@trace{GreDivisioMinimisHigh{#1}{#2}{#3}}% |
| 1896 |
\gre@writebar{18}{0}{#1}{#2}{#3}% |
| 1897 |
\relax% |
| 1898 |
\gre@trace@end% |
| 1899 |
}% |
| 1900 |
|
| 1901 |
\def\GreInDivisioMinima#1#2#3{% |
| 1902 |
\gre@trace{GreInDivisioMinima{#1}{#2}{#3}}% |
| 1903 |
\gre@writebar{1}{1}{#1}{#2}{#3}% |
| 1904 |
\relax% |
| 1905 |
\gre@trace@end% |
| 1906 |
}% |
| 1907 |
|
| 1908 |
\def\GreDivisioMinima#1#2#3{% |
| 1909 |
\gre@trace{GreDivisioMinima{#1}{#2}{#3}}% |
| 1910 |
\gre@writebar{1}{0}{#1}{#2}{#3}% |
| 1911 |
\relax% |
| 1912 |
\gre@trace@end% |
| 1913 |
}% |
| 1914 |
|
| 1915 |
\def\GreInDivisioMinimaHigh#1#2#3{% |
| 1916 |
\gre@trace{GreInDivisioMinimaHigh{#1}{#2}{#3}}% |
| 1917 |
\gre@writebar{15}{1}{#1}{#2}{#3}% |
| 1918 |
\relax% |
| 1919 |
\gre@trace@end% |
| 1920 |
}% |
| 1921 |
|
| 1922 |
\def\GreDivisioMinimaHigh#1#2#3{% |
| 1923 |
\gre@trace{GreDivisioMinimaHigh{#1}{#2}{#3}}% |
| 1924 |
\gre@writebar{15}{0}{#1}{#2}{#3}% |
| 1925 |
\relax% |
| 1926 |
\gre@trace@end% |
| 1927 |
}% |
| 1928 |
|
| 1929 |
\def\GreInDivisioMinimaParen#1#2#3{% |
| 1930 |
\gre@trace{GreInDivisioMinimaParen{#1}{#2}{#3}}% |
| 1931 |
\gre@writebar{20}{1}{#1}{#2}{#3}% |
| 1932 |
\relax% |
| 1933 |
\gre@trace@end% |
| 1934 |
}% |
| 1935 |
|
| 1936 |
\def\GreDivisioMinimaParen#1#2#3{% |
| 1937 |
\gre@trace{GreDivisioMinimaParen{#1}{#2}{#3}}% |
| 1938 |
\gre@writebar{20}{0}{#1}{#2}{#3}% |
| 1939 |
\relax% |
| 1940 |
\gre@trace@end% |
| 1941 |
}% |
| 1942 |
|
| 1943 |
\def\GreInDivisioMinimaParenHigh#1#2#3{% |
| 1944 |
\gre@trace{GreInDivisioMinimaHigh{#1}{#2}{#3}}% |
| 1945 |
\gre@writebar{22}{1}{#1}{#2}{#3}% |
| 1946 |
\relax% |
| 1947 |
\gre@trace@end% |
| 1948 |
}% |
| 1949 |
|
| 1950 |
\def\GreDivisioMinimaParenHigh#1#2#3{% |
| 1951 |
\gre@trace{GreDivisioMinimaHigh{#1}{#2}{#3}}% |
| 1952 |
\gre@writebar{22}{0}{#1}{#2}{#3}% |
| 1953 |
\relax% |
| 1954 |
\gre@trace@end% |
| 1955 |
}% |
| 1956 |
|
| 1957 |
\def\GreInDivisioMinor#1#2{% |
| 1958 |
\gre@trace{GreInDivisioMinor{#1}{#2}}% |
| 1959 |
\gre@writebar{2}{1}{#1}{#2}{0}% |
| 1960 |
\relax% |
| 1961 |
\gre@trace@end% |
| 1962 |
}% |
| 1963 |
|
| 1964 |
\def\GreDivisioMinor#1#2{% |
| 1965 |
\gre@trace{GreDivisioMinor{#1}{#2}}% |
| 1966 |
\gre@writebar{2}{0}{#1}{#2}{0}% |
| 1967 |
\relax% |
| 1968 |
\gre@trace@end% |
| 1969 |
}% |
| 1970 |
|
| 1971 |
\def\GreInDivisioMaior#1#2{% |
| 1972 |
\gre@trace{GreInDivisioMaior{#1}{#2}}% |
| 1973 |
\gre@writebar{3}{1}{#1}{#2}{0}% |
| 1974 |
\relax% |
| 1975 |
\gre@trace@end% |
| 1976 |
}% |
| 1977 |
|
| 1978 |
\def\GreDivisioMaior#1#2{% |
| 1979 |
\gre@trace{GreDivisioMaior{#1}{#2}}% |
| 1980 |
\gre@writebar{3}{0}{#1}{#2}{0}% |
| 1981 |
\relax% |
| 1982 |
\gre@trace@end% |
| 1983 |
}% |
| 1984 |
|
| 1985 |
\def\GreInDivisioMaiorDotted#1#2{% |
| 1986 |
\gre@trace{GreInDivisioMaiorDotted{#1}{#2}}% |
| 1987 |
\gre@writebar{16}{1}{#1}{#2}{0}% |
| 1988 |
\relax% |
| 1989 |
\gre@trace@end% |
| 1990 |
}% |
| 1991 |
|
| 1992 |
\def\GreDivisioMaiorDotted#1#2{% |
| 1993 |
\gre@trace{GreDivisioMaiorDotted{#1}{#2}}% |
| 1994 |
\gre@writebar{16}{0}{#1}{#2}{0}% |
| 1995 |
\relax% |
| 1996 |
\gre@trace@end% |
| 1997 |
}% |
| 1998 |
|
| 1999 |
\def\GreDominica#1#2#3{% |
| 2000 |
\gre@trace{GreDominica{#1}{#2}{#3}}% |
| 2001 |
\ifcase#1\or % |
| 2002 |
\gre@writebar{6}{0}{#2}{#3}{0}% |
| 2003 |
\or % |
| 2004 |
\gre@writebar{7}{0}{#2}{#3}{0}% |
| 2005 |
\or % |
| 2006 |
\gre@writebar{8}{0}{#2}{#3}{0}% |
| 2007 |
\or % |
| 2008 |
\gre@writebar{9}{0}{#2}{#3}{0}% |
| 2009 |
\or % |
| 2010 |
\gre@writebar{10}{0}{#2}{#3}{0}% |
| 2011 |
\or % |
| 2012 |
\gre@writebar{11}{0}{#2}{#3}{0}% |
| 2013 |
\or % |
| 2014 |
\gre@writebar{12}{0}{#2}{#3}{0}% |
| 2015 |
\or % |
| 2016 |
\gre@writebar{13}{0}{#2}{#3}{0}% |
| 2017 |
\fi % |
| 2018 |
\relax% |
| 2019 |
\gre@trace@end% |
| 2020 |
}% |
| 2021 |
|
| 2022 |
\def\GreInDominica#1#2#3{% |
| 2023 |
\gre@trace{GreInDominica{#1}{#2}{#3}}% |
| 2024 |
\ifcase#1\or % |
| 2025 |
\gre@writebar{6}{1}{#2}{#3}{0}% |
| 2026 |
\or % |
| 2027 |
\gre@writebar{7}{1}{#2}{#3}{0}% |
| 2028 |
\or % |
| 2029 |
\gre@writebar{8}{1}{#2}{#3}{0}% |
| 2030 |
\or % |
| 2031 |
\gre@writebar{9}{1}{#2}{#3}{0}% |
| 2032 |
\or % |
| 2033 |
\gre@writebar{10}{1}{#2}{#3}{0}% |
| 2034 |
\or % |
| 2035 |
\gre@writebar{11}{1}{#2}{#3}{0}% |
| 2036 |
\or % |
| 2037 |
\gre@writebar{12}{1}{#2}{#3}{0}% |
| 2038 |
\or % |
| 2039 |
\gre@writebar{13}{1}{#2}{#3}{0}% |
| 2040 |
\fi % |
| 2041 |
\relax% |
| 2042 |
\gre@trace@end% |
| 2043 |
}% |
| 2044 |
|
| 2045 |
\def\GreInDivisioFinalis#1#2{% |
| 2046 |
\gre@trace{GreInDivisioFinalis{#1}{#2}}% |
| 2047 |
\ifgre@endofscore % |
| 2048 |
\gre@writebar{5}{1}{#1}{#2}{0}% |
| 2049 |
\else % |
| 2050 |
\gre@writebar{4}{1}{#1}{#2}{0}% |
| 2051 |
\fi % |
| 2052 |
\relax% |
| 2053 |
\gre@trace@end% |
| 2054 |
}% |
| 2055 |
|
| 2056 |
\def\GreDivisioFinalis#1#2{% |
| 2057 |
\gre@trace{GreDivisioFinalis{#1}{#2}}% |
| 2058 |
\ifgre@endofscore % |
| 2059 |
\gre@writebar{5}{0}{#1}{#2}{0}% |
| 2060 |
\else % |
| 2061 |
\gre@writebar{4}{0}{#1}{#2}{0}% |
| 2062 |
\fi % |
| 2063 |
\relax% |
| 2064 |
\gre@trace@end% |
| 2065 |
}% |
| 2066 |
|
| 2067 |
% #1 is #2 of gre@writebar (@standalone or nothing) |
| 2068 |
% #2 is #3 of gre@writebar (@text or @notext, only if standalone) |
| 2069 |
% #3 is #5 of gre@writebar (@short or nothing) |
| 2070 |
% emits the suffix of the space |
| 2071 |
% this function cannot be traced because it appears inside \csname constructs |
| 2072 |
\def\gre@bar@space@suffix#1#2#3{% |
| 2073 |
\ifgre@newbarspacing % |
| 2074 |
\ifcase#1 % |
| 2075 |
\ifcase#3 % |
| 2076 |
\ifcase#2 @standalone@notext\or @standalone@text\fi % |
| 2077 |
\or % |
| 2078 |
\ifcase#2 @standalone@notext@short\or @standalone@text@short\fi % |
| 2079 |
\fi % |
| 2080 |
\else % |
| 2081 |
\ifcase#3 \or @short\fi % |
| 2082 |
\fi % |
| 2083 |
\else % |
| 2084 |
\ifcase#3 \or @short\fi % |
| 2085 |
\fi % |
| 2086 |
}% |
| 2087 |
|
| 2088 |
\newcount\gre@count@shiftaftermora |
| 2089 |
\gre@count@shiftaftermora=5 |
| 2090 |
|
| 2091 |
\def\gresetshiftaftermora#1{% |
| 2092 |
\gre@trace{gresetshiftaftermora{#1}}% |
| 2093 |
\IfStrEqCase{#1}{% |
| 2094 |
{always}% |
| 2095 |
{\gre@count@shiftaftermora=5}% |
| 2096 |
{notesonly}% |
| 2097 |
{\gre@count@shiftaftermora=4}% |
| 2098 |
{barsonly}% |
| 2099 |
{\gre@count@shiftaftermora=3}% |
| 2100 |
{barsnotextonly}% |
| 2101 |
{\gre@count@shiftaftermora=2}% |
| 2102 |
{barsinsideonly}% |
| 2103 |
{\gre@count@shiftaftermora=1}% |
| 2104 |
{never}% |
| 2105 |
{\gre@count@shiftaftermora=0}% |
| 2106 |
}[% all other cases |
| 2107 |
\gre@error{Unrecognized option "#1" in gresetshiftaftermora\MessageBreak Possible options are: 'always', 'barsonly', 'notesonly', 'barsnotextonly', 'barsinsideonly' and 'never'}% |
| 2108 |
]% |
| 2109 |
\gre@trace@end% |
| 2110 |
}% |
| 2111 |
|
| 2112 |
% width of a punctum mora, reinitalized at each score |
| 2113 |
\newdimen\gre@dimen@morawidth |
| 2114 |
|
| 2115 |
% sets gre@skip@punctummorashift to the (usually negative) shift to apply before |
| 2116 |
% a syllable following a punctum mora, to cancel its taking into account into |
| 2117 |
% horizontal placement. |
| 2118 |
% First argument is: |
| 2119 |
% - 1 for the general case |
| 2120 |
% - 2 when the punctum mora is before a bar |
| 2121 |
\def\gre@get@unkern@aftermora#1{% |
| 2122 |
\gre@trace{gre@get@unkern@aftermora{#1}}% |
| 2123 |
\ifdim\gre@dimen@morawidth=0pt\relax % |
| 2124 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@fontchar@punctummora}% |
| 2125 |
\global\gre@dimen@morawidth=\wd\gre@box@temp@width % |
| 2126 |
\fi % |
| 2127 |
\ifnum #1=1% |
| 2128 |
\global\gre@skip@punctummorashift=\glueexpr - \gre@dimen@morawidth - \gre@space@skip@spacebeforesigns + \gre@space@skip@moraadjustment\relax % |
| 2129 |
\else % |
| 2130 |
\global\gre@skip@punctummorashift=\glueexpr - \gre@dimen@morawidth - \gre@space@skip@spacebeforesigns + \gre@space@skip@moraadjustmentbar\relax % |
| 2131 |
\fi % |
| 2132 |
\relax % |
| 2133 |
\gre@trace@end% |
| 2134 |
} |
| 2135 |
|
| 2136 |
\def\gre@unkern@bar@aftermora{% |
| 2137 |
\gre@trace{gre@unkern@bar@aftermora}% |
| 2138 |
\ifgre@newbarspacing% |
| 2139 |
% don't apply a negative kern on the first glyph |
| 2140 |
% while boxing, otherwise the box width will be wrong |
| 2141 |
\ifgre@firstglyph % |
| 2142 |
\ifgre@boxing\else % |
| 2143 |
\gre@get@unkern@aftermora{2}% |
| 2144 |
\kern\gre@skip@punctummorashift % |
| 2145 |
\fi % |
| 2146 |
\else % |
| 2147 |
\gre@get@unkern@aftermora{2}% |
| 2148 |
\kern\gre@skip@punctummorashift % |
| 2149 |
\fi % |
| 2150 |
\else% |
| 2151 |
\gre@get@unkern@aftermora{2}% |
| 2152 |
\kern\gre@skip@punctummorashift % |
| 2153 |
\fi% |
| 2154 |
\relax % |
| 2155 |
\gre@trace@end% |
| 2156 |
} |
| 2157 |
|
| 2158 |
\newskip\gre@skip@bar@lastskip% skip after last bar |
| 2159 |
|
| 2160 |
%a macro to write a bar |
| 2161 |
%% 1: the type of the bar : 0 for virgula, 1 for minima, 2 for minor, |
| 2162 |
%% 3 for major, 4 for finalis, 5 for the last finalis, |
| 2163 |
%% 6 to 13 for dominican bars, 14 for high virgula, |
| 2164 |
%% 15 for high minima, 16 for dotted maior, |
| 2165 |
%% 17 for minimis, 18 for high minimis, |
| 2166 |
%% 19 for parenthesized virgula, |
| 2167 |
%% 20 for parenthesized minima, |
| 2168 |
%% 21 for high parenthesized virgula, |
| 2169 |
%% 22 for high parenthesized minima, |
| 2170 |
%% 2: is 0 if it is in a syllable containing only this bar, 1 otherwise |
| 2171 |
%% 3: is 0 if there's no text under the bar or 1 if there is text under the bar |
| 2172 |
%% 4: macros that may happen before the skip after the bar (typically GreVEpisema) |
| 2173 |
%% 5: 0 for the normal version of spaces, 1 for the short one (virgula and minima only) |
| 2174 |
\def\gre@writebar#1#2#3#4#5{% |
| 2175 |
\gre@trace{gre@writebar{#1}{#2}{#3}{#4}{#5}}% |
| 2176 |
% first, for the bar to be really centered, if the last glyph has a punctum |
| 2177 |
% mora, we kern of the corresponding space. We do it only in the case |
| 2178 |
% of a bar in the middle of other notes. |
| 2179 |
\ifgre@lastendswithmora % |
| 2180 |
\ifnum\gre@count@shiftaftermora=0\else\ifnum\gre@count@shiftaftermora=4\else % |
| 2181 |
% if bar doesn’t has its own syllable, then we need to take care of the kern after a punctum mora here |
| 2182 |
\ifcase #2\or % |
| 2183 |
\gre@unkern@bar@aftermora % |
| 2184 |
\fi % |
| 2185 |
\fi\fi % |
| 2186 |
\fi % |
| 2187 |
\gre@newglyphcommon % |
| 2188 |
\gre@calculate@glyphraisevalue{\gre@pitch@bar}{0}{}% bar glyphs are made to be at this height |
| 2189 |
\GreNoBreak % |
| 2190 |
% count indicating if we have to output space or not: |
| 2191 |
\gre@count@temp@one=0\relax % |
| 2192 |
\ifnum#2=1\relax % |
| 2193 |
\gre@count@temp@one=1\relax % |
| 2194 |
\else % |
| 2195 |
\ifgre@newbarspacing % |
| 2196 |
\gre@count@temp@one=1\relax % |
| 2197 |
\fi % |
| 2198 |
\fi % |
| 2199 |
\gre@skip@temp@four=0pt\relax % |
| 2200 |
\ifcase#1 % 0 : virgula |
| 2201 |
\ifnum\gre@count@temp@one=1\relax % |
| 2202 |
\gre@skip@temp@four = \csname gre@space@skip@bar@virgula\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2203 |
\gre@hskip\gre@skip@temp@four % |
| 2204 |
\GreNoBreak % |
| 2205 |
\fi % |
| 2206 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@virgula}% |
| 2207 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@virgula}% |
| 2208 |
#4\relax % |
| 2209 |
\ifnum\gre@count@temp@one=1\relax % |
| 2210 |
\GreNoBreak % |
| 2211 |
\gre@skip@temp@four = \csname gre@space@skip@bar@virgula\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2212 |
\gre@hskip\gre@skip@temp@four % |
| 2213 |
\fi % |
| 2214 |
\or % 1 : minima |
| 2215 |
\ifnum\gre@count@temp@one=1\relax % |
| 2216 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minima\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2217 |
\gre@hskip\gre@skip@temp@four % |
| 2218 |
\GreNoBreak % |
| 2219 |
\fi % |
| 2220 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@divisiominima}% |
| 2221 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@divisiominima}% |
| 2222 |
#4\relax % |
| 2223 |
\ifnum\gre@count@temp@one=1\relax % |
| 2224 |
\GreNoBreak % |
| 2225 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minima\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2226 |
\gre@hskip\gre@skip@temp@four % |
| 2227 |
\fi % |
| 2228 |
\or % 2 : minor |
| 2229 |
\ifnum\gre@count@temp@one=1\relax % |
| 2230 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minor\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2231 |
\gre@hskip\gre@skip@temp@four % |
| 2232 |
\GreNoBreak % |
| 2233 |
\fi % |
| 2234 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@divisiominor}% |
| 2235 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@divisiominor}% |
| 2236 |
#4\relax % |
| 2237 |
\ifnum\gre@count@temp@one=1\relax % |
| 2238 |
\GreNoBreak % |
| 2239 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minor\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2240 |
\gre@hskip\gre@skip@temp@four % |
| 2241 |
\fi % |
| 2242 |
\or % 3 : maior |
| 2243 |
\ifnum\gre@count@temp@one=1\relax % |
| 2244 |
\gre@skip@temp@four = \csname gre@space@skip@bar@maior\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2245 |
\gre@hskip\gre@skip@temp@four % |
| 2246 |
\GreNoBreak % |
| 2247 |
\fi % |
| 2248 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@divisiomaior}% |
| 2249 |
\gre@fontchar@divisiomaior % |
| 2250 |
#4\relax % |
| 2251 |
\ifnum\gre@count@temp@one=1\relax % |
| 2252 |
\GreNoBreak % |
| 2253 |
\gre@skip@temp@four = \csname gre@space@skip@bar@maior\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2254 |
\gre@hskip\gre@skip@temp@four % |
| 2255 |
\fi % |
| 2256 |
\or % 4 : finalis |
| 2257 |
\ifnum\gre@count@temp@one=1\relax % |
| 2258 |
\gre@skip@temp@four = \csname gre@space@skip@bar@finalis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2259 |
\gre@hskip\gre@skip@temp@four % |
| 2260 |
\GreNoBreak % |
| 2261 |
\fi % |
| 2262 |
\setbox\gre@box@temp@width=\hbox{\gre@fontchar@divisiofinalis}% |
| 2263 |
#4\relax % |
| 2264 |
\gre@fontchar@divisiofinalis% |
| 2265 |
\ifnum\gre@count@temp@one=1\relax % |
| 2266 |
\GreNoBreak % |
| 2267 |
\gre@skip@temp@four = \csname gre@space@skip@bar@finalis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2268 |
\gre@hskip\gre@skip@temp@four % |
| 2269 |
\fi % |
| 2270 |
\or % 5 : final finalis |
| 2271 |
\ifnum\gre@count@temp@one=1\relax % |
| 2272 |
\gre@skip@temp@four = \csname gre@space@skip@bar@finalfinalis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2273 |
\gre@hskip\gre@skip@temp@four % |
| 2274 |
\GreNoBreak % |
| 2275 |
\fi % |
| 2276 |
\setbox\gre@box@temp@width=\hbox{\gre@fontchar@divisiofinalis}% |
| 2277 |
#4\relax % |
| 2278 |
\gre@fontchar@divisiofinalis% |
| 2279 |
\ifgre@newbarspacing % |
| 2280 |
\GreNoBreak % |
| 2281 |
\gre@skip@temp@four = \csname gre@space@skip@bar@finalfinalis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2282 |
\gre@hskip\gre@skip@temp@four % |
| 2283 |
\GreNoBreak % |
| 2284 |
\fi % |
| 2285 |
\or % 6 : dominican bar 1 |
| 2286 |
\gre@calculate@glyphraisevalue{\gre@pitch@e}{0}{}% |
| 2287 |
% 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. |
| 2288 |
\advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% |
| 2289 |
\ifnum\gre@count@temp@one=1\relax % |
| 2290 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2291 |
\gre@hskip\gre@skip@temp@four % |
| 2292 |
\GreNoBreak % |
| 2293 |
\fi % |
| 2294 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% |
| 2295 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% |
| 2296 |
#4\relax % |
| 2297 |
\ifnum\gre@count@temp@one=1\relax % |
| 2298 |
\GreNoBreak % |
| 2299 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2300 |
\gre@hskip\gre@skip@temp@four % |
| 2301 |
\fi % |
| 2302 |
\or % 7 : dominican bar 2 |
| 2303 |
\gre@calculate@glyphraisevalue{\gre@pitch@e}{0}{}% |
| 2304 |
\advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% |
| 2305 |
\ifnum\gre@count@temp@one=1\relax % |
| 2306 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2307 |
\gre@hskip\gre@skip@temp@four % |
| 2308 |
\GreNoBreak % |
| 2309 |
\fi % |
| 2310 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% |
| 2311 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% |
| 2312 |
#4\relax % |
| 2313 |
\ifnum\gre@count@temp@one=1\relax % |
| 2314 |
\GreNoBreak % |
| 2315 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2316 |
\gre@hskip\gre@skip@temp@four % |
| 2317 |
\fi % |
| 2318 |
\or % 8 : dominican bar 3 |
| 2319 |
\ifnum\gre@count@temp@one=1\relax % |
| 2320 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2321 |
\gre@hskip\gre@skip@temp@four % |
| 2322 |
\GreNoBreak % |
| 2323 |
\fi % |
| 2324 |
\advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% |
| 2325 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% |
| 2326 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% |
| 2327 |
#4\relax % |
| 2328 |
\ifnum\gre@count@temp@one=1\relax % |
| 2329 |
\GreNoBreak % |
| 2330 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2331 |
\gre@hskip\gre@skip@temp@four % |
| 2332 |
\fi % |
| 2333 |
\or % 9 : dominican bar 4 |
| 2334 |
\ifnum\gre@count@temp@one=1\relax % |
| 2335 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2336 |
\gre@hskip\gre@skip@temp@four % |
| 2337 |
\GreNoBreak % |
| 2338 |
\fi % |
| 2339 |
\advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% |
| 2340 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% |
| 2341 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% |
| 2342 |
#4\relax % |
| 2343 |
\ifnum\gre@count@temp@one=1\relax % |
| 2344 |
\GreNoBreak % |
| 2345 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2346 |
\gre@hskip\gre@skip@temp@four % |
| 2347 |
\fi % |
| 2348 |
\or % 10 : dominican bar 5 |
| 2349 |
\gre@calculate@glyphraisevalue{\gre@pitch@i}{0}{}% |
| 2350 |
\advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% |
| 2351 |
\ifnum\gre@count@temp@one=1\relax % |
| 2352 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2353 |
\gre@hskip\gre@skip@temp@four % |
| 2354 |
\GreNoBreak % |
| 2355 |
\fi % |
| 2356 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% |
| 2357 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% |
| 2358 |
#4\relax % |
| 2359 |
\ifnum\gre@count@temp@one=1\relax % |
| 2360 |
\GreNoBreak % |
| 2361 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2362 |
\gre@hskip\gre@skip@temp@four % |
| 2363 |
\fi % |
| 2364 |
\or % 11 : dominican bar 6 |
| 2365 |
\gre@calculate@glyphraisevalue{\gre@pitch@i}{0}{}% |
| 2366 |
\advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% |
| 2367 |
\ifnum\gre@count@temp@one=1\relax % |
| 2368 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2369 |
\gre@hskip\gre@skip@temp@four % |
| 2370 |
\GreNoBreak % |
| 2371 |
\fi % |
| 2372 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% |
| 2373 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% |
| 2374 |
#4\relax % |
| 2375 |
\ifnum\gre@count@temp@one=1\relax % |
| 2376 |
\GreNoBreak % |
| 2377 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2378 |
\gre@hskip\gre@skip@temp@four % |
| 2379 |
\fi % |
| 2380 |
\or % 12 : dominican bar 7 |
| 2381 |
\gre@calculate@glyphraisevalue{\gre@pitch@k}{0}{}% |
| 2382 |
\advance\gre@dimen@glyphraisevalue by -\gre@dimen@stafflinediff\relax% |
| 2383 |
\ifnum\gre@count@temp@one=1\relax % |
| 2384 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2385 |
\gre@hskip\gre@skip@temp@four % |
| 2386 |
\GreNoBreak % |
| 2387 |
\fi % |
| 2388 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominican}% |
| 2389 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominican}% |
| 2390 |
#4\relax % |
| 2391 |
\ifnum\gre@count@temp@one=1\relax % |
| 2392 |
\GreNoBreak % |
| 2393 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2394 |
\gre@hskip\gre@skip@temp@four % |
| 2395 |
\fi % |
| 2396 |
\or % 13 : dominican bar 8 |
| 2397 |
\gre@calculate@glyphraisevalue{\gre@pitch@k}{0}{}% |
| 2398 |
\advance\gre@dimen@glyphraisevalue by \gre@dimen@stafflinediff\relax% |
| 2399 |
\ifnum\gre@count@temp@one=1\relax % |
| 2400 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2401 |
\gre@hskip\gre@skip@temp@four % |
| 2402 |
\GreNoBreak % |
| 2403 |
\fi % |
| 2404 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% |
| 2405 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\GreCPDivisioDominicanAlt}% |
| 2406 |
#4\relax % |
| 2407 |
\ifnum\gre@count@temp@one=1\relax % |
| 2408 |
\GreNoBreak % |
| 2409 |
\gre@skip@temp@four = \csname gre@space@skip@bar@dominican\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2410 |
\gre@hskip\gre@skip@temp@four % |
| 2411 |
\fi % |
| 2412 |
\or % 14 : high virgula |
| 2413 |
\ifnum\gre@count@temp@one=1\relax % |
| 2414 |
\gre@skip@temp@four = \csname gre@space@skip@bar@virgula\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2415 |
\gre@hskip\gre@skip@temp@four % |
| 2416 |
\GreNoBreak % |
| 2417 |
\fi % |
| 2418 |
\GreGlyphHeights{\gre@pitch@ledger@above}{\gre@pitch@ledger@above}% |
| 2419 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@virgulahigh}% |
| 2420 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@virgulahigh}% |
| 2421 |
\GreAdditionalLine{\GreOCaseBarVirgula}{0}{2}% |
| 2422 |
#4\relax % |
| 2423 |
\ifnum\gre@count@temp@one=1\relax % |
| 2424 |
\GreNoBreak % |
| 2425 |
\gre@skip@temp@four = \csname gre@space@skip@bar@virgula\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2426 |
\gre@hskip\gre@skip@temp@four % |
| 2427 |
\fi % |
| 2428 |
\or % 15 : high minima |
| 2429 |
\ifnum\gre@count@temp@one=1\relax % |
| 2430 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minima\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2431 |
\gre@hskip\gre@skip@temp@four % |
| 2432 |
\GreNoBreak % |
| 2433 |
\fi % |
| 2434 |
\GreGlyphHeights{\gre@pitch@ledger@above}{\gre@pitch@ledger@above}% |
| 2435 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@divisiominimahigh}% |
| 2436 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@divisiominimahigh}% |
| 2437 |
\GreAdditionalLine{\GreOCaseBarStandard}{0}{2}% |
| 2438 |
#4\relax % |
| 2439 |
\ifnum\gre@count@temp@one=1\relax % |
| 2440 |
\GreNoBreak % |
| 2441 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minima\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2442 |
\gre@hskip\gre@skip@temp@four % |
| 2443 |
\fi % |
| 2444 |
\or % 16 : dotted maior |
| 2445 |
\ifnum\gre@count@temp@one=1\relax % |
| 2446 |
\gre@skip@temp@four = \csname gre@space@skip@bar@maior\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2447 |
\gre@hskip\gre@skip@temp@four % |
| 2448 |
\GreNoBreak % |
| 2449 |
\fi % |
| 2450 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@divisiomaiordotted}% |
| 2451 |
\ifgre@hidedottedbarlines % |
| 2452 |
\hbox to 0pt{% |
| 2453 |
{% |
| 2454 |
\color{grebackgroundcolor}% |
| 2455 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@divisiomaiordottedbacking}% |
| 2456 |
}% |
| 2457 |
\hss % |
| 2458 |
}% |
| 2459 |
\fi % |
| 2460 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@divisiomaiordotted}% |
| 2461 |
#4\relax % |
| 2462 |
\ifnum\gre@count@temp@one=1\relax % |
| 2463 |
\GreNoBreak % |
| 2464 |
\gre@skip@temp@four = \csname gre@space@skip@bar@maior\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2465 |
\gre@hskip\gre@skip@temp@four % |
| 2466 |
\fi % |
| 2467 |
\or % 17 : minimis |
| 2468 |
\ifnum\gre@count@temp@one=1\relax % |
| 2469 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minimis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2470 |
\gre@hskip\gre@skip@temp@four % |
| 2471 |
\GreNoBreak % |
| 2472 |
\fi % |
| 2473 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@divisiominimis}% |
| 2474 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@divisiominimis}% |
| 2475 |
#4\relax % |
| 2476 |
\ifnum\gre@count@temp@one=1\relax % |
| 2477 |
\GreNoBreak % |
| 2478 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minimis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2479 |
\gre@hskip\gre@skip@temp@four % |
| 2480 |
\fi % |
| 2481 |
\or % 18 : high minimis |
| 2482 |
\ifnum\gre@count@temp@one=1\relax % |
| 2483 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minimis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2484 |
\gre@hskip\gre@skip@temp@four % |
| 2485 |
\GreNoBreak % |
| 2486 |
\fi % |
| 2487 |
\GreGlyphHeights{\gre@pitch@ledger@above}{\gre@pitch@ledger@above}% |
| 2488 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@divisiominimishigh}% |
| 2489 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@divisiominimishigh}% |
| 2490 |
\GreAdditionalLine{\GreOCaseBarStandard}{0}{2}% |
| 2491 |
#4\relax % |
| 2492 |
\ifnum\gre@count@temp@one=1\relax % |
| 2493 |
\GreNoBreak % |
| 2494 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minimis\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2495 |
\gre@hskip\gre@skip@temp@four % |
| 2496 |
\fi % |
| 2497 |
\or % 19 : parenthesized virgula |
| 2498 |
\ifnum\gre@count@temp@one=1\relax % |
| 2499 |
\gre@skip@temp@four = \csname gre@space@skip@bar@virgulaparen\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2500 |
\gre@hskip\gre@skip@temp@four % |
| 2501 |
\GreNoBreak % |
| 2502 |
\fi % |
| 2503 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@virgulaparen}% |
| 2504 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@virgulaparen}% |
| 2505 |
#4\relax % |
| 2506 |
\ifnum\gre@count@temp@one=1\relax % |
| 2507 |
\GreNoBreak % |
| 2508 |
\gre@skip@temp@four = \csname gre@space@skip@bar@virgulaparen\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2509 |
\gre@hskip\gre@skip@temp@four % |
| 2510 |
\fi % |
| 2511 |
\or % 20 : parenthesized minima |
| 2512 |
\ifnum\gre@count@temp@one=1\relax % |
| 2513 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minimaparen\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2514 |
\gre@hskip\gre@skip@temp@four % |
| 2515 |
\GreNoBreak % |
| 2516 |
\fi % |
| 2517 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@divisiominimaparen}% |
| 2518 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@divisiominimaparen}% |
| 2519 |
#4\relax % |
| 2520 |
\ifnum\gre@count@temp@one=1\relax % |
| 2521 |
\GreNoBreak % |
| 2522 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minimaparen\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2523 |
\gre@hskip\gre@skip@temp@four % |
| 2524 |
\fi % |
| 2525 |
\or % 21 : parenthesized high virgula |
| 2526 |
\ifnum\gre@count@temp@one=1\relax % |
| 2527 |
\gre@skip@temp@four = \csname gre@space@skip@bar@virgulaparen\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2528 |
\gre@hskip\gre@skip@temp@four % |
| 2529 |
\GreNoBreak % |
| 2530 |
\fi % |
| 2531 |
\GreGlyphHeights{\gre@pitch@ledger@above}{\gre@pitch@ledger@above}% |
| 2532 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@virgulaparenhigh}% |
| 2533 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@virgulaparenhigh}% |
| 2534 |
\GreAdditionalLine{\GreOCaseBarVirgulaParen}{0}{2}% |
| 2535 |
#4\relax % |
| 2536 |
\ifnum\gre@count@temp@one=1\relax % |
| 2537 |
\GreNoBreak % |
| 2538 |
\gre@skip@temp@four = \csname gre@space@skip@bar@virgulaparen\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2539 |
\gre@hskip\gre@skip@temp@four % |
| 2540 |
\fi % |
| 2541 |
\or % 22 : parenthesized high minima |
| 2542 |
\ifnum\gre@count@temp@one=1\relax % |
| 2543 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minimaparen\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2544 |
\gre@hskip\gre@skip@temp@four % |
| 2545 |
\GreNoBreak % |
| 2546 |
\fi % |
| 2547 |
\GreGlyphHeights{\gre@pitch@ledger@above}{\gre@pitch@ledger@above}% |
| 2548 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@divisiominimaparenhigh}% |
| 2549 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@divisiominimaparenhigh}% |
| 2550 |
\GreAdditionalLine{\GreOCaseBarParen}{0}{2}% |
| 2551 |
#4\relax % |
| 2552 |
\ifnum\gre@count@temp@one=1\relax % |
| 2553 |
\GreNoBreak % |
| 2554 |
\gre@skip@temp@four = \csname gre@space@skip@bar@minimaparen\gre@bar@space@suffix{#2}{#3}{#5}\endcsname\relax% |
| 2555 |
\gre@hskip\gre@skip@temp@four % |
| 2556 |
\fi % |
| 2557 |
\fi % |
| 2558 |
\global\gre@skip@bar@lastskip=\gre@skip@temp@four % |
| 2559 |
\gre@debugmsg{spacing}{Width of bar just printed: \the\wd\gre@box@temp@width}% |
| 2560 |
\gre@debugmsg{spacing}{Last bar space: \the\gre@skip@temp@four}% |
| 2561 |
\global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % |
| 2562 |
\directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% |
| 2563 |
\global\gre@firstglyphfalse % |
| 2564 |
\relax% |
| 2565 |
\gre@trace@end% |
| 2566 |
}% |
| 2567 |
|
| 2568 |
\def\gre@fontchar@divisiomaior{% |
| 2569 |
\ifnum\gre@stafflinefactor=17\relax % |
| 2570 |
%\gre@calculate@glyphraisevalue{\gre@pitch@bar}{0}{}% bar glyphs are made to be at this height |
| 2571 |
\raise\gre@dimen@glyphraisevalue\hbox{\gre@font@music\gre@char@bar@divisiomaior}% |
| 2572 |
\else % |
| 2573 |
\setbox\gre@box@temp@width=\hbox{\gre@font@music\gre@char@bar@divisiomaior}% |
| 2574 |
% we calculate the raise of the bar |
| 2575 |
\gre@dimen@temp@five=\dimexpr(\gre@dimen@additionalbottomspace % |
| 2576 |
+ \gre@space@dimen@spacebeneathtext % |
| 2577 |
+ \gre@space@dimen@spacelinestext % |
| 2578 |
+ \gre@dimen@currenttranslationheight)\relax% |
| 2579 |
% we calculate the height of the bar |
| 2580 |
\raise\gre@dimen@temp@five\hbox{\vrule height \gre@dimen@staffheight width \wd\gre@box@temp@width}% |
| 2581 |
\fi % |
| 2582 |
\relax % |
| 2583 |
}% |
| 2584 |
|
| 2585 |
\def\gre@fontchar@divisiofinalis{% |
| 2586 |
\gre@calculate@glyphraisevalue{\gre@pitch@bar}{0}{}% bar glyphs are made to be at this height |
| 2587 |
\gre@fontchar@divisiomaior % |
| 2588 |
\kern\gre@space@dimen@divisiofinalissep % |
| 2589 |
\GreNoBreak % |
| 2590 |
\gre@fontchar@divisiomaior % |
| 2591 |
}% |
| 2592 |
|
| 2593 |
% Flag to tell if we have to keep the localrightbox until the end |
| 2594 |
\newif\ifgre@keeprightbox% |
| 2595 |
|
| 2596 |
%macro to end a line with a divisio finalis |
| 2597 |
\def\GreFinalDivisioFinalis#1{% |
| 2598 |
\gre@trace{GreFinalDivisioFinalis{#1}}% |
| 2599 |
\GreBarSyllable{\GreSetThisSyllable{}{}{}{}{}}{}{}{1}{\GreSetNextSyllable{}{}{}{}{}\GreLastOfLine}{}{{16}{0}}{}{% |
| 2600 |
\ifgre@newbarspacing\else % |
| 2601 |
\gre@hskip\gre@space@skip@bar@finalfinalis % |
| 2602 |
\GreNoBreak % |
| 2603 |
\fi % |
| 2604 |
\GreLastOfScore % |
| 2605 |
\GreDivisioFinalis{0}{}% |
| 2606 |
#1% |
| 2607 |
}% |
| 2608 |
\relax% |
| 2609 |
\gre@trace@end% |
| 2610 |
}% |
| 2611 |
|
| 2612 |
%macro to end a line with a divisio maior |
| 2613 |
\def\GreFinalDivisioMaior#1{% |
| 2614 |
\gre@trace{GreFinalDivisioMaior{#1}}% |
| 2615 |
\GreBarSyllable{\GreSetThisSyllable{}{}{}{}{}}{}{}{1}{\GreSetNextSyllable{}{}{}{}{}\GreLastOfLine}{}{{16}{0}}{}{% |
| 2616 |
\GreLastOfScore % |
| 2617 |
\GreDivisioMaior{0}{}% |
| 2618 |
#1% |
| 2619 |
}% |
| 2620 |
\relax% |
| 2621 |
\gre@trace@end% |
| 2622 |
}% |
| 2623 |
|
| 2624 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2625 |
%% macros for filling holes of empty notes |
| 2626 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2627 |
|
| 2628 |
% flag to indicate that lines behind a punctum cavum should be hidden |
| 2629 |
\newif\ifgre@hidepclines |
| 2630 |
% default state is to not hide them |
| 2631 |
\gre@hidepclinesfalse |
| 2632 |
|
| 2633 |
% macro for manipulating above flag |
| 2634 |
\def\gresetlinesbehindpunctumcavum#1{% |
| 2635 |
\gre@trace{gresetlinesbehindpunctumcavum{#1}}% |
| 2636 |
\IfStrEqCase{#1}{% |
| 2637 |
{visible}% |
| 2638 |
{\gre@hidepclinesfalse}% |
| 2639 |
{invisible}% |
| 2640 |
{\gre@hidepclinestrue}% |
| 2641 |
}[% all other cases |
| 2642 |
\gre@error{Unrecognized option "#1" for \protect\gresetlinesbehindpunctumcavum\MessageBreak Possible options are: 'visible' and 'invisible'}% |
| 2643 |
]% |
| 2644 |
\gre@trace@end% |
| 2645 |
}% |
| 2646 |
|
| 2647 |
% flag to indicate that lines behind an alteration should be hidden |
| 2648 |
\newif\ifgre@hidealtlines |
| 2649 |
% default state is to not hide them |
| 2650 |
\gre@hidealtlinesfalse |
| 2651 |
|
| 2652 |
% macro for manipulating above flag |
| 2653 |
\def\gresetlinesbehindalteration#1{% |
| 2654 |
\gre@trace{gresetlinesbehindalteration{#1}}% |
| 2655 |
\IfStrEqCase{#1}{% |
| 2656 |
{visible}% |
| 2657 |
{\gre@hidealtlinesfalse}% |
| 2658 |
{invisible}% |
| 2659 |
{\gre@hidealtlinestrue}% |
| 2660 |
}[% all other cases |
| 2661 |
\gre@error{Unrecognized option "#1" for \protect\gresetlinesbehindalteration\MessageBreak Possible options are: 'visible' and 'invisible'}% |
| 2662 |
]% |
| 2663 |
\gre@trace@end% |
| 2664 |
}% |
| 2665 |
|
| 2666 |
% is last glyph a cavum? |
| 2667 |
\newcount\gre@count@lastglyphiscavum |
| 2668 |
% 0 if no |
| 2669 |
% 1 if current glyph is a cavum (set once the cavum is filled) |
| 2670 |
% 2 if previous glyph is a cavum (which is the most interesting information) |
| 2671 |
\gre@count@lastglyphiscavum=0 |
| 2672 |
|
| 2673 |
% #1 is the character with which we fill the hole, and we suppose that |
| 2674 |
% isonaline and glyphraisevalue are correctly set. |
| 2675 |
% #2 is 0 for alteration or 1 for normal cavum |
| 2676 |
\def\gre@fillhole#1#2{% |
| 2677 |
\gre@trace{gre@fillhole{#1}{#2}}% |
| 2678 |
\ifgre@boxing\else % |
| 2679 |
\global\gre@count@lastglyphiscavum=1\relax % |
| 2680 |
\setbox\gre@box@temp@sign=\hbox to 0pt {% |
| 2681 |
{\color{grebackgroundcolor}#1}% |
| 2682 |
\rule{0pt}{0pt}% this trick prevents the color from leaking out of this box |
| 2683 |
\hss}% |
| 2684 |
\luacolorProcessBox\gre@box@temp@sign% |
| 2685 |
\ifcase#2\raise \gre@dimen@glyphraisevalue\fi% |
| 2686 |
\copy\gre@box@temp@sign% |
| 2687 |
\GreNoBreak % |
| 2688 |
\fi % |
| 2689 |
\relax % |
| 2690 |
\gre@trace@end% |
| 2691 |
}% |
| 2692 |
|
| 2693 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2694 |
%% macros for typesetting alterations |
| 2695 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2696 |
|
| 2697 |
% the top level macro: |
| 2698 |
% #1 is the height |
| 2699 |
% #2 is the alteration type: 0 = none, 1 = flat, 2 = natural, 3 = sharp, |
| 2700 |
% 4/5/6 = parenthesized flat/natural/sharp, |
| 2701 |
% 7 = soft flat |
| 2702 |
% #3 is 1 if the alteration is the flat in a clef |
| 2703 |
% #4 are the signs to typeset before the glyph (typically additional bars, as they must be "behind" the glyph) |
| 2704 |
% #5 are the signs to typeset after the glyph (almost all signs) |
| 2705 |
% #6 is the line:char:column for a textedit link |
| 2706 |
\def\gre@alteration#1#2#3#4#5#6{% |
| 2707 |
\gre@trace{gre@alteration{#1}{#2}{#3}{#4}{#5}{#6}}% |
| 2708 |
\global\advance\gre@attr@alteration@id by 1\relax |
| 2709 |
\def\gre@alteration@type{#2}% |
| 2710 |
% Check if the alteration should be visible or not |
| 2711 |
\gre@alteration@isvisible{0}{\gre@alteration@type}% |
| 2712 |
% After the above check, we treat soft alterations like hard alterations |
| 2713 |
\ifnum\gre@alteration@type>6\relax |
| 2714 |
\edef\gre@alteration@type{\numexpr\gre@alteration@type-6\relax}% |
| 2715 |
\fi |
| 2716 |
\ifgre@alteration@isvisible |
| 2717 |
\gre@alteration@visible{#1}{\gre@alteration@type}{#3}{#4}{#5}{#6}% |
| 2718 |
\else |
| 2719 |
% Print an empty \hbox because it still needs to be counted |
| 2720 |
% Don't print #4 (ledger line) and #5 (not used anyway?) |
| 2721 |
\hbox |
| 2722 |
attr \gre@attrid@alteration@pitch=#1\relax |
| 2723 |
attr \gre@attrid@alteration@type=\gre@alteration@type\relax |
| 2724 |
{}% |
| 2725 |
\fi |
| 2726 |
} |
| 2727 |
|
| 2728 |
% Sets the behavior of soft alterations, which are not printed if the |
| 2729 |
% same alteration (at the same pitch) is already in effect. A (hard or |
| 2730 |
% soft) alteration's effect is always cancelled by another alteration, |
| 2731 |
% as well as argument #1, whose default is "note": |
| 2732 |
% "note" = effect ends immediately (i.e., print all soft alterations) |
| 2733 |
% "line" = effect extends to the end of the line |
| 2734 |
% In the future, "word" and "bar" may also be allowed. |
| 2735 |
\newif\ifgre@alteration@effect@note\gre@alteration@effect@notefalse |
| 2736 |
\newif\ifgre@alteration@effect@line\gre@alteration@effect@linetrue |
| 2737 |
\def\gresetalterationeffect#1{% |
| 2738 |
\global\gre@alteration@effect@notefalse |
| 2739 |
\global\gre@alteration@effect@linefalse |
| 2740 |
\IfStrEq{#1}{}{\gre@error{Empty argument for \protect\gresetalterationeffect. Allowed arguments are: 'note', 'line'}}{% |
| 2741 |
\def\gre@alteration@effect@process##1{% |
| 2742 |
\IfStrEqCase{##1}{% |
| 2743 |
{note}{\global\gre@alteration@effect@notetrue}% |
| 2744 |
{line}{\global\gre@alteration@effect@linetrue}% |
| 2745 |
}[\gre@error{Unrecognized argument '##1' for \protect\gresetalterationeffect. Allowed arguments are: 'note', 'line'}]}% |
| 2746 |
\gre@parsecommas{#1}{\gre@alteration@effect@process}% |
| 2747 |
}% |
| 2748 |
} |
| 2749 |
|
| 2750 |
% Test whether an alteration should be visible. |
| 2751 |
% #1: 0 for current alteration, 1 for next alteration. |
| 2752 |
% #2: alteration type |
| 2753 |
% Sets \ifgre@alteration@isvisibletrue or \ifgre@alteration@isvisiblefalse. |
| 2754 |
\newif\ifgre@alteration@isvisible |
| 2755 |
\def\gre@alteration@isvisible#1#2{% |
| 2756 |
\global\gre@alteration@isvisiblefalse |
| 2757 |
\ifnum#2>6\relax % soft |
| 2758 |
% alterationeffect includes "line" |
| 2759 |
\ifgre@alteration@effect@line |
| 2760 |
\gre@debugmsg{alteration}{line}% |
| 2761 |
\ifcase\directlua{gregoriotex.is_first_alteration(#1)}\relax |
| 2762 |
% 0: don't know |
| 2763 |
\global\gre@alteration@isvisibletrue |
| 2764 |
\or |
| 2765 |
% 1: first in line |
| 2766 |
\ifnum#2=8\relax % natural: don't print |
| 2767 |
\else |
| 2768 |
\global\gre@alteration@isvisibletrue |
| 2769 |
\fi |
| 2770 |
\or |
| 2771 |
% 2: different from previous |
| 2772 |
\global\gre@alteration@isvisibletrue |
| 2773 |
\or |
| 2774 |
% 3: not first |
| 2775 |
\fi |
| 2776 |
\fi |
| 2777 |
% alterationeffect includes "note" |
| 2778 |
\ifgre@alteration@effect@note |
| 2779 |
\gre@debugmsg{alteration}{note}% |
| 2780 |
\ifnum#2=8\relax % natural: don't print |
| 2781 |
\else |
| 2782 |
\global\gre@alteration@isvisibletrue |
| 2783 |
\fi |
| 2784 |
\fi |
| 2785 |
\else % hard: always visible |
| 2786 |
\global\gre@alteration@isvisibletrue |
| 2787 |
\fi |
| 2788 |
} |
| 2789 |
|
| 2790 |
\def\gre@alteration@visible#1#2#3#4#5#6{% |
| 2791 |
\gre@trace{gre@alteration@visible{#1}{#2}{#3}{#4}{#5}{#6}}% |
| 2792 |
\ifcase#2\relax |
| 2793 |
\or\def\gre@alteration@char{\gre@fontchar@flat}\def\gre@alteration@hole{\gre@fontchar@flathole}% flat |
| 2794 |
\or\def\gre@alteration@char{\gre@fontchar@natural}\def\gre@alteration@hole{\gre@fontchar@naturalhole}% natural |
| 2795 |
\or\def\gre@alteration@char{\gre@fontchar@sharp}\def\gre@alteration@hole{\gre@fontchar@sharphole}% sharp |
| 2796 |
\or\def\gre@alteration@char{\gre@fontchar@flatparen}\def\gre@alteration@hole{\gre@fontchar@flatparenhole}% parenthesized flat |
| 2797 |
\or\def\gre@alteration@char{\gre@fontchar@naturalparen}\def\gre@alteration@hole{\gre@fontchar@naturalparenhole}% parenthesized natural |
| 2798 |
\or\def\gre@alteration@char{\gre@fontchar@sharpparen}\def\gre@alteration@hole{\gre@fontchar@sharpparenhole}% parenthesized sharp |
| 2799 |
\else\gre@error{Invalid alteration type}% soft alterations should have been changed to hard |
| 2800 |
\fi |
| 2801 |
\setbox\gre@box@temp@width=\hbox |
| 2802 |
attr \gre@attrid@alteration@pitch=#1\relax |
| 2803 |
attr \gre@attrid@alteration@type=#2\relax |
| 2804 |
{\gre@pointandclick{\gre@alteration@char}{#6}}% |
| 2805 |
\ifnum#3=0\relax % |
| 2806 |
\gre@newglyphcommon % |
| 2807 |
\fi % |
| 2808 |
\ifgre@in@custos\else\relax % |
| 2809 |
\global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % |
| 2810 |
\fi % |
| 2811 |
% the three next lines are a trick to get the additional lines below the glyphs |
| 2812 |
\gre@skip@temp@one = \gre@dimen@lastglyphwidth\relax% |
| 2813 |
\kern\gre@skip@temp@one % |
| 2814 |
#4\relax % |
| 2815 |
\kern-\gre@skip@temp@one % |
| 2816 |
\gre@calculate@glyphraisevalue{#1}{0}{}% |
| 2817 |
\ifgre@hidealtlines % |
| 2818 |
\gre@fillhole{\gre@alteration@hole}{0}% |
| 2819 |
\fi % |
| 2820 |
\raise \gre@dimen@glyphraisevalue% |
| 2821 |
\copy\gre@box@temp@width% |
| 2822 |
#5\relax % |
| 2823 |
\ifnum#3=0\relax % |
| 2824 |
% we try to avoid line breaking after a flat or a natural |
| 2825 |
\GreNoBreak % |
| 2826 |
\gre@skip@temp@four = \gre@space@dimen@alterationspace\relax% |
| 2827 |
\ifgre@firstglyph% |
| 2828 |
\gre@debugmsg{bolshift}{making adjustments for leading alteration}% |
| 2829 |
\global\advance\gre@dimen@notesaligncenter by % |
| 2830 |
\dimexpr(\wd\gre@box@temp@width + \dimexpr\gre@skip@temp@four)\relax % |
| 2831 |
\kern\gre@skip@temp@four % |
| 2832 |
\global\gre@dimen@bolextra = \dimexpr(\wd\gre@box@temp@width + \dimexpr\gre@skip@temp@four)\relax% |
| 2833 |
\gre@debugmsg{bolshift}{bolextra: \the\gre@dimen@bolextra}% |
| 2834 |
\else % |
| 2835 |
\gre@hskip\gre@skip@temp@four % |
| 2836 |
\fi % |
| 2837 |
\GreNoBreak % |
| 2838 |
\directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% |
| 2839 |
\fi % |
| 2840 |
\relax % |
| 2841 |
\gre@trace@end% |
| 2842 |
}% |
| 2843 |
|
| 2844 |
% This macro typesets a flat on the height provided by #1. |
| 2845 |
% #2 is 1 if the flat is part of a clef. |
| 2846 |
|
| 2847 |
\def\GreFlat#1#2#3#4#5{% |
| 2848 |
\gre@trace{GreFlat{#1}{#2}{#3}{#4}{#5}}% |
| 2849 |
\gre@alteration{#1}{1}{#2}{#3}{#4}{#5}% |
| 2850 |
\relax% |
| 2851 |
\gre@trace@end% |
| 2852 |
}% |
| 2853 |
|
| 2854 |
% Same as the one before, but for parenthesized flats. |
| 2855 |
|
| 2856 |
\def\GreFlatParen#1#2#3#4#5{% |
| 2857 |
\gre@trace{GreFlatParen{#1}{#2}{#3}{#4}{#5}}% |
| 2858 |
\gre@alteration{#1}{4}{#2}{#3}{#4}{#5}% |
| 2859 |
\relax% |
| 2860 |
\gre@trace@end% |
| 2861 |
}% |
| 2862 |
|
| 2863 |
% Same as the one before, but for soft flats. |
| 2864 |
|
| 2865 |
\def\GreFlatSoft#1#2#3#4#5{% |
| 2866 |
\gre@trace{GreFlatSoft{#1}{#2}{#3}{#4}{#5}}% |
| 2867 |
\gre@alteration{#1}{7}{#2}{#3}{#4}{#5}% |
| 2868 |
\relax% |
| 2869 |
\gre@trace@end% |
| 2870 |
}% |
| 2871 |
|
| 2872 |
% Same as the one before, but for naturals. |
| 2873 |
|
| 2874 |
\def\GreNatural#1#2#3#4#5{% |
| 2875 |
\gre@trace{GreNatural{#1}{#2}{#3}{#4}{#5}}% |
| 2876 |
\gre@alteration{#1}{2}{#2}{#3}{#4}{#5}% |
| 2877 |
\relax% |
| 2878 |
\gre@trace@end% |
| 2879 |
}% |
| 2880 |
|
| 2881 |
% Same as the one before, but for parenthesized naturals. |
| 2882 |
|
| 2883 |
\def\GreNaturalParen#1#2#3#4#5{% |
| 2884 |
\gre@trace{GreNaturalParen{#1}{#2}{#3}{#4}{#5}}% |
| 2885 |
\gre@alteration{#1}{5}{#2}{#3}{#4}{#5}% |
| 2886 |
\relax% |
| 2887 |
\gre@trace@end% |
| 2888 |
}% |
| 2889 |
|
| 2890 |
% Same as the one before, but for soft naturals. |
| 2891 |
|
| 2892 |
\def\GreNaturalSoft#1#2#3#4#5{% |
| 2893 |
\gre@trace{GreNaturalSoft{#1}{#2}{#3}{#4}{#5}}% |
| 2894 |
\gre@alteration{#1}{8}{#2}{#3}{#4}{#5}% |
| 2895 |
\relax% |
| 2896 |
\gre@trace@end% |
| 2897 |
}% |
| 2898 |
|
| 2899 |
% Same as the one before, but for sharps. |
| 2900 |
|
| 2901 |
\def\GreSharp#1#2#3#4#5{% |
| 2902 |
\gre@trace{GreSharp{#1}{#2}{#3}{#4}{#5}}% |
| 2903 |
\gre@alteration{#1}{3}{#2}{#3}{#4}{#5}% |
| 2904 |
\relax% |
| 2905 |
\gre@trace@end% |
| 2906 |
}% |
| 2907 |
|
| 2908 |
% Same as the one before, but for parenthesized sharps. |
| 2909 |
|
| 2910 |
\def\GreSharpParen#1#2#3#4#5{% |
| 2911 |
\gre@trace{GreSharpParen{#1}{#2}{#3}{#4}{#5}}% |
| 2912 |
\gre@alteration{#1}{6}{#2}{#3}{#4}{#5}% |
| 2913 |
\relax% |
| 2914 |
\gre@trace@end% |
| 2915 |
}% |
| 2916 |
|
| 2917 |
% Same as the one before, but for soft sharps. |
| 2918 |
|
| 2919 |
\def\GreSharpSoft#1#2#3#4#5{% |
| 2920 |
\gre@trace{GreSharpSoft{#1}{#2}{#3}{#4}{#5}}% |
| 2921 |
\gre@alteration{#1}{9}{#2}{#3}{#4}{#5}% |
| 2922 |
\relax% |
| 2923 |
\gre@trace@end% |
| 2924 |
}% |
| 2925 |
|
| 2926 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2927 |
%% macros for typesetting punctum cavum |
| 2928 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2929 |
|
| 2930 |
\def\gresetpunctumcavum#1{% |
| 2931 |
\gre@trace{gresetpunctumcavum{#1}}% |
| 2932 |
\IfStrEqCase{#1}{% |
| 2933 |
{alternate}% |
| 2934 |
{% |
| 2935 |
\grechangecavumglyph{Punctum}{greciliae-hollow}{.caeciliae}[greciliae-hole][.caeciliae]% |
| 2936 |
\grechangecavumglyph{LineaPunctum}{greciliae-hollow}{.caeciliae}[greciliae-hole][.caeciliae]% |
| 2937 |
}% |
| 2938 |
{normal}% |
| 2939 |
{% |
| 2940 |
\greresetcavumglyph{Punctum}% |
| 2941 |
\greresetcavumglyph{LineaPunctum}% |
| 2942 |
}% |
| 2943 |
}[% all other cases |
| 2944 |
\gre@error{Unrecognized option "#1" for \protect\gresetpunctumcavum\MessageBreak Possible options are: 'alternate' and 'normal'}% |
| 2945 |
]% |
| 2946 |
\gre@trace@end% |
| 2947 |
}% |
| 2948 |
|
| 2949 |
\def\GreCavum#1{% |
| 2950 |
\gre@trace{GreCavum{#1}}% |
| 2951 |
\ifgre@hidepclines% |
| 2952 |
\gre@fillhole{{\gre@font@music@hole\csname GreHoleCP#1\endcsname}}{1}% |
| 2953 |
\fi % |
| 2954 |
{\gre@font@music@hollow\csname GreHollowCP#1\endcsname}% |
| 2955 |
\gre@trace@end% |
| 2956 |
}% |
| 2957 |
|
| 2958 |
% #1 is 0 for left or 1 for right bracket |
| 2959 |
% #2 is the height of the lowest note within the brackets |
| 2960 |
% #3 is the height of the highest note within the brackets |
| 2961 |
% #4 is the point-and-click string |
| 2962 |
\def\GreBracket#1#2#3#4{% |
| 2963 |
\gre@trace{GreBracket{#1}{#2}{#3}{#4}}% |
| 2964 |
\gre@newglyphcommon % |
| 2965 |
\ifcase\numexpr#1\relax\else\GreNoBreak\fi% no break before right bracket |
| 2966 |
\setbox\gre@box@temp@width=\hbox{\gre@pointandclick{\gre@font@music % |
| 2967 |
\csname GreCPBracket% |
| 2968 |
\ifcase\numexpr#1\relax Left\else Right\fi% |
| 2969 |
% Logic: |
| 2970 |
% if low pitch is on a line or below the staff: |
| 2971 |
% if high pitch is on a line or above the staff: |
| 2972 |
% use short bracket |
| 2973 |
% else: |
| 2974 |
% use normal bracket |
| 2975 |
% else: |
| 2976 |
% if high pitch is on a line or above the staff: |
| 2977 |
% use normal bracket |
| 2978 |
% else: |
| 2979 |
% use long bracket |
| 2980 |
\ifnum\numexpr#2\relax>\numexpr\gre@pitch@belowstaff\relax % low pitch not below staff |
| 2981 |
% numexpr+/ rounds rather than truncates |
| 2982 |
\ifnum\numexpr#2/2\relax=\numexpr(#2+1)/2\relax % =odd, low pitch not on a line |
| 2983 |
\ifnum\numexpr#3\relax<\numexpr\gre@pitch@abovestaff\relax % high pitch not above staff |
| 2984 |
\ifnum\numexpr#3/2\relax=\numexpr(#3+1)/2\relax % =odd, high pitch not on a line |
| 2985 |
Long% |
| 2986 |
\fi % |
| 2987 |
\fi % |
| 2988 |
\else % =even, low pitch on a line |
| 2989 |
\ifnum\numexpr#3\relax<\numexpr\gre@pitch@abovestaff\relax % high pitch not above staff |
| 2990 |
\ifnum\numexpr#3/2\relax=\numexpr(#3+1)/2\relax\else % =even, high pitch on a line |
| 2991 |
Short% |
| 2992 |
\fi % |
| 2993 |
\else % high pitch above staff |
| 2994 |
Short% |
| 2995 |
\fi % |
| 2996 |
\fi % |
| 2997 |
\else % low pitch below staff |
| 2998 |
% same as above! |
| 2999 |
\ifnum\numexpr#3\relax<\numexpr\gre@pitch@abovestaff\relax % high pitch not above staff |
| 3000 |
\ifnum\numexpr#3/2\relax=\numexpr(#3+1)/2\relax\else % =even, high pitch on a line |
| 3001 |
Short% |
| 3002 |
\fi % |
| 3003 |
\else % high pitch above staff |
| 3004 |
Short% |
| 3005 |
\fi % |
| 3006 |
\fi % |
| 3007 |
\ifcase\numexpr#3-#2\relax % |
| 3008 |
Zero% |
| 3009 |
\or One% |
| 3010 |
\or Two% |
| 3011 |
\or Three% |
| 3012 |
\or Four% |
| 3013 |
\or Five% |
| 3014 |
\or Six% |
| 3015 |
\or Seven% |
| 3016 |
\or Eight% |
| 3017 |
\or Nine% |
| 3018 |
\or Ten% |
| 3019 |
\or Eleven% |
| 3020 |
\or Twelve% |
| 3021 |
\or Thirteen% |
| 3022 |
\or Fourteen% |
| 3023 |
\fi% |
| 3024 |
\endcsname % |
| 3025 |
}{#4}}% |
| 3026 |
\global\gre@dimen@lastglyphwidth=\wd\gre@box@temp@width % |
| 3027 |
\gre@calculate@glyphraisevalue{#2}{17}{}% |
| 3028 |
\raise\gre@dimen@glyphraisevalue% |
| 3029 |
\copy\gre@box@temp@width% |
| 3030 |
\ifcase\numexpr#1\relax |
| 3031 |
\GreNoBreak% no break after left bracket |
| 3032 |
\ifgre@firstglyph% |
| 3033 |
\gre@debugmsg{bolshift}{making adjustments for leading bracket}% |
| 3034 |
\global\advance\gre@dimen@notesaligncenter by \wd\gre@box@temp@width\relax % |
| 3035 |
\global\gre@dimen@bolextra = \wd\gre@box@temp@width\relax% |
| 3036 |
\gre@debugmsg{bolshift}{bolextra: \the\gre@dimen@bolextra}% |
| 3037 |
\fi % |
| 3038 |
\GreNoBreak% no break after left bracket |
| 3039 |
\fi % |
| 3040 |
\directlua{gregoriotex.adjust_line_height(\gre@insidediscretionary)}% |
| 3041 |
\gre@endofglyphcommon % |
| 3042 |
\relax% |
| 3043 |
\gre@trace@end% |
| 3044 |
}% |