Debian Codegraph @

texk/gregorio/gregorio-src/tex/gregoriotex-signs.lua

raw symbols SCIP
1 --GregorioTeX Signs Lua support file.
2 --
3 --Copyright (C) 2015-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 -- this file contains lua functions to support signs used by GregorioTeX.
21
22 -- GREGORIO_VERSION 6.1.0
23
24 local err = gregoriotex.module.err
25 local warn = gregoriotex.module.warn
26 local info = gregoriotex.module.info
27 local log = gregoriotex.module.log
28 local debugmessage = gregoriotex.module.debugmessage
29
30 -- Note offset cases:
31 -- here are the common values for both hepisema (and consequently also for
32 -- additional lines) and vepisema
33 -- this indicates the note
34 local offset_cases = {
35 -- punctum as last note (works with pes)
36 {
37 case = 'FinalPunctum',
38 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctum}{1}{0}{#2}{#3}{#4}]],
39 h = [[\gre@hepisorlineaux{\GreCPPunctum}{\gre@char@he@punctum{#4}}{2}{#3}]],
40 },
41 -- deminutus as last note
42 {
43 case = 'FinalDeminutus',
44 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctumDeminutus}{1}{0}{#2}{#3}{#4}]],
45 h = [[\gre@hepisorlineaux{\GreCPPunctumDeminutus}{\gre@char@he@initio{#4}}{2}{#3}]],
46 },
47 -- second-to-last note, disconnected from prior note, with a second ambitus
48 -- of at least two, when last note is a standard punctum (like the second
49 -- note of hig)
50 {
51 case = 'PenultBeforePunctumWide',
52 v = [[\gre@vepisemaorrareaux{\GreCPFlexusNobarTwoNothing}{\GreCPPunctum}{2}{0}{#2}{#3}{#4}]],
53 -- a kind of flexus, it has the good width
54 h = [[\gre@hepisorlineaux{\GreCPFlexusNobarTwoNothing}{\gre@char@he@punctum{#4}}{2}{#3}]],
55 },
56 -- second-to-last note, when last note is a deminutus
57 {
58 case = 'PenultBeforeDeminutus',
59 v = [[\gre@vepisemaorrareaux{0}{\GreCPFlexusTwoDeminutus}{1}{0}{#2}{#3}{#4}]],
60 -- in order to go to the good place, we first make a kern of - the glyph
61 -- before deminutus, which has the same width as a standard flexus deminutus
62 h = [[\gre@hepisorlineaux{\GreCPFlexusTwoDeminutus}{\gre@char@he@punctum{#4}}{2}{#3}]],
63 },
64 -- third-to-last note, when the last note is a punctum (for porrectus flexus)
65 {
66 case = 'AntepenultBeforePunctum',
67 v = [[\gre@vepisemaorrareaux{\GreCPTorculusOneTwoNothing}{\GreCPPunctum}{2}{0}{#2}{#3}{#4}]],
68 -- is a torculus, it has the good width
69 h = [[\gre@hepisorlineaux{\GreCPTorculusOneTwoNothing}{\gre@char@he@punctum{#4}}{2}{#3}]],
70 },
71 -- third-to-last note, when the last notes is a deminutus (for porrectus
72 -- flexus)
73 {
74 case = 'AntepenultBeforeDeminutus',
75 v = [[\gre@vepisemaorrareaux{\GreCPTorculusTwoTwoDeminutus}{\GreCPPunctum}{2}{0}{#2}{#3}{#4}]],
76 -- torculus deminutus has the good width
77 h = [[\gre@hepisorlineaux{\GreCPTorculusTwoTwoDeminutus}{\gre@char@he@punctum{#4}}{2}{#3}]],
78 },
79 -- standard punctum as first note, disconnected from next note
80 {
81 case = 'InitialPunctum',
82 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctum}{0}{0}{#2}{#3}{#4}]],
83 h = [[\gre@hepisorlineaux{0}{\gre@char@he@punctum{#4}}{0}{#3}]],
84 },
85 -- initio debilis (always the first note)
86 {
87 case = 'InitioDebilis',
88 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctumDeminutus}{0}{0}{#2}{#3}{#4}]],
89 -- we assume that the initio-debilis has the same width as a punctum
90 -- deminutus
91 h = [[\gre@hepisorlineaux{0}{\gre@char@he@initio{#4}}{0}{#3}]],
92 },
93 -- first note of a non-auctus porrectus with a second ambitus of at least two
94 {
95 case = 'PorrNonAuctusInitialWide',
96 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctum}{0}{0}{#2}{#3}{#4}]],
97 -- we do (for now) the same as case 6
98 h = [[\gre@hepisorlineaux{0}{\gre@char@he@porrectus{#2}{#4}}{0}{#3}]],
99 },
100 -- first note of a non-auctus porrectus with a second ambitus of one
101 {
102 case = 'PorrNonAuctusInitialOne',
103 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctum}{0}{0}{#2}{#3}{#4}]],
104 h = [[\gre@hepisorlineaux{0}{\gre@char@he@porrectus@amone{#2}{#4}}{0}{#3}]],
105 },
106 -- first note of an auctus porrectus, regardless of second ambitus
107 {
108 case = 'PorrAuctusInitialAny',
109 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctum}{0}{0}{#2}{#3}{#4}]],
110 h = [[\gre@hepisorlineaux{0}{\gre@char@he@porrectusfl{#2}{#4}}{0}{#3}]],
111 },
112 -- punctum inclinatum as last note
113 {
114 case = 'FinalInclinatum',
115 v = [[\gre@vepisemaorrareaux{0}{\GreCPDescendensPunctumInclinatum}{0}{30\the\gre@factor }{#2}{#3}{#4}]],
116 h = [[\gre@hepisorlineaux{\GreCPDescendensPunctumInclinatum}{\gre@char@he@inclinatum{#4}}{2}{#3}]],
117 },
118 -- punctum inclinatum deminutus as last note
119 {
120 case = 'FinalInclinatumDeminutus',
121 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctumInclinatumDeminutus}{0}{0}{#2}{#3}{#4}]],
122 h = [[\gre@hepisorlineaux{\GreCPPunctumInclinatumDeminutus}{\gre@char@he@inclinatumdem{#4}}{2}{#3}]],
123 },
124 -- stropha as last note
125 {
126 case = 'FinalStropha',
127 v = [[\gre@vepisemaorrareaux{0}{\GreCPStropha}{0}{0}{#2}{#3}{#4}]],
128 h = [[\gre@hepisorlineaux{\GreCPStropha}{\gre@char@he@stropha{#4}}{2}{#3}]],
129 },
130 -- quilisma as last note
131 {
132 case = 'FinalQuilisma',
133 v = [[\gre@vepisemaorrareaux{0}{\GreCPQuilisma}{0}{0}{#2}{#3}{#4}]],
134 h = [[\gre@hepisorlineaux{\GreCPQuilisma}{\gre@char@he@quilisma{#4}}{2}{#3}]],
135 },
136 -- oriscus as last note
137 {
138 case = 'FinalOriscus',
139 v = [[\gre@vepisemaorrareaux{0}{\GreCPAscendensOriscus}{0}{0}{#2}{#3}{#4}]],
140 h = [[\gre@hepisorlineaux{\GreCPAscendensOriscus}{\gre@char@he@oriscus{#4}}{2}{#3}]],
141 },
142 -- second-to-last note, with a second ambitus of one, when last note is a
143 -- standard punctum (like the second note of ghg)
144 {
145 case = 'PenultBeforePunctumOne',
146 v = [[\gre@vepisemaorrareaux{\GreCPFlexusNobarOneNothing}{\GreCPPunctum}{2}{0}{#2}{#3}{#4}]],
147 h = [[\gre@hepisorlineaux{\GreCPFlexusNobarOneNothing}{\gre@char@he@punctum{#4}}{2}{#3}]],
148 },
149 -- "upper smaller punctum" as last note (concerning simple podatus, podatus,
150 -- and torculus resupinus)
151 {
152 case = 'FinalUpperPunctum',
153 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctumSmall}{1}{-30\the\gre@factor}{#2}{#3}{#4}]],
154 h = [[\gre@hepisorlineaux{\GreCPPunctumSmall}{\gre@char@he@smallpunctum{#4}}{2}{#3}]],
155 },
156 -- oriscus as first note, disconnected from next note
157 {
158 case = 'InitialOriscus',
159 v = [[\gre@vepisemaorrareaux{0}{\GreCPDescendensOriscus}{0}{0}{#2}{#3}{#4}]],
160 h = [[\gre@hepisorlineaux{0}{\gre@char@he@oriscus{#4}}{0}{#3}]],
161 },
162 -- quilisma as first note, disconnected from next note
163 {
164 case = 'InitialQuilisma',
165 v = [[\gre@vepisemaorrareaux{0}{\GreCPQuilisma}{0}{0}{#2}{#3}{#4}]],
166 h = [[\gre@hepisorlineaux{0}{\gre@char@he@quilisma{#4}}{0}{#3}]],
167 },
168 -- second note of a non-auctus torculus resupinus starting with a punctum,
169 -- with a first and second ambitus of at least two
170 {
171 case = 'TorcResNonAuctusSecondWideWide',
172 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@punctum@two}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
173 h = [[\gre@hepisorlineaux{\GreCPLeadingPunctumTwo}{\gre@char@he@porrectus{#2}{#4}}{3}{#3}]],
174 },
175 -- second note of a non-auctus torculus resupinus starting with a punctum,
176 -- with a first ambitus of one and a second ambitus of at least two
177 {
178 case = 'TorcResNonAuctusSecondOneWide',
179 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@punctum@one}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
180 h = [[\gre@hepisorlineaux{\GreCPLeadingPunctumOne}{\gre@char@he@porrectus{#2}{#4}}{3}{#3}]],
181 },
182 -- second note of a non-auctus torculus resupinus initio debilis with any
183 -- first ambitus and a second ambitus of at least two
184 {
185 case = 'TorcResDebilisNonAuctusSecondAnyWide',
186 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@debilis}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
187 h = [[\gre@hepisorlineaux{\GreCPLeadingPunctumOneInitioDebilis}{\gre@char@he@porrectus{#2}{#4}}{3}{#3}]],
188 },
189 -- linea punctum (cavum) as last note
190 {
191 case = 'FinalLineaPunctum',
192 v = [[\gre@vepisemaorrareaux{0}{\GreCPLineaPunctum}{1}{0}{#2}{#3}{#4}]],
193 -- the episema is not quite long enough so I assumed a different width
194 -- for now...
195 h = [[\gre@hepisorlineaux{\GreCPPesQuadratumOneInitioDefilisDescendens}{\gre@char@he@punctum{#4}}{2}{#3}]],
196 },
197 -- standard bar
198 {
199 case = 'BarStandard',
200 v = [[\gre@vepisemaorrareaux{0}{\gre@char@bar@divisiominima}{1}{0}{#2}{#3}{#4}]],
201 h = [[\gre@hepisorlineaux{\gre@char@bar@divisiominima}{\gre@char@he@barstandard{#4}}{2}{#3}]],
202 },
203 -- virgula
204 {
205 case = 'BarVirgula',
206 v = [[\gre@vepisemaorrareaux{0}{\gre@char@bar@virgula}{1}{0}{#2}{#3}{#4}]],
207 h = [[\gre@hepisorlineaux{\gre@char@bar@virgula}{\gre@char@he@barvirgula{#4}}{2}{#3}]],
208 },
209 -- divisio finalis
210 {
211 case = 'BarDivisioFinalis',
212 v = [[\gre@vepisemaorrareaux{0}{\gre@fontchar@divisiofinalis}{1}{0}{#2}{#3}{#4}]],
213 },
214 -- parenthesized bar
215 {
216 case = 'BarParen',
217 v = [[\gre@vepisemaorrareaux{0}{\gre@char@bar@divisiominimaparen}{1}{0}{#2}{#3}{#4}]],
218 h = [[\gre@hepisorlineaux{\gre@char@bar@divisiominimaparen}{\gre@char@he@barparen{#4}}{2}{#3}]],
219 },
220 -- parenthesized virgula
221 {
222 case = 'BarVirgulaParen',
223 v = [[\gre@vepisemaorrareaux{0}{\gre@char@bar@virgulaparen}{1}{0}{#2}{#3}{#4}]],
224 h = [[\gre@hepisorlineaux{\gre@char@bar@virgulaparen}{\gre@char@he@barvirgulaparen{#4}}{2}{#3}]],
225 },
226 -- second note of a non-auctus torculus resupinus starting with a quilisma,
227 -- with a first and second ambitus of at least two
228 {
229 case = 'TorcResQuilismaNonAuctusSecondWideWide',
230 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@quilisma@two}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
231 h = [[\gre@hepisorlineaux{\GreCPLeadingQuilismaTwo}{\gre@char@he@porrectus{#2}{#4}}{3}{#3}]],
232 },
233 -- second note of a non-auctus torculus resupinus starting with an oriscus,
234 -- with a first and second ambitus of at least two
235 {
236 case = 'TorcResOriscusNonAuctusSecondWideWide',
237 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@oriscus@two}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
238 h = [[\gre@hepisorlineaux{\GreCPLeadingOriscusTwo}{\gre@char@he@porrectus{#2}{#4}}{3}{#3}]],
239 },
240 -- second note of a non-auctus torculus resupinus starting with a quilisma,
241 -- with a first ambitus of one and and second ambitus of at least two
242 {
243 case = 'TorcResQuilismaNonAuctusSecondOneWide',
244 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@quilisma@one}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
245 h = [[\gre@hepisorlineaux{\GreCPLeadingQuilismaOne}{\gre@char@he@porrectus{#2}{#4}}{3}{#3}]],
246 },
247 -- second note of a non-auctus torculus resupinus starting with an oriscus,
248 -- with a first ambitus of one and and second ambitus of at least two
249 {
250 case = 'TorcResOriscusNonAuctusSecondOneWide',
251 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@oriscus@one}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
252 h = [[\gre@hepisorlineaux{\GreCPLeadingOriscusOne}{\gre@char@he@porrectus{#2}{#4}}{3}{#3}]],
253 },
254 -- second note of a non-auctus torculus resupinus starting with a punctum,
255 -- with a first ambitus of at least two and a second ambitus of one
256 {
257 case = 'TorcResNonAuctusSecondWideOne',
258 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@punctum@two}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
259 h = [[\gre@hepisorlineaux{\GreCPLeadingPunctumTwo}{\gre@char@he@porrectus@amone{#2}{#4}}{3}{#3}]],
260 },
261 -- second note of a non-auctus torculus resupinus initio debilis with any
262 -- first ambitus and a second ambitus of one
263 {
264 case = 'TorcResDebilisNonAuctusSecondAnyOne',
265 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@debilis}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
266 h = [[\gre@hepisorlineaux{\GreCPLeadingPunctumOneInitioDebilis}{\gre@char@he@porrectus@amone{#2}{#4}}{3}{#3}]],
267 },
268 -- second note of a non-auctus torculus resupinus starting with a quilisma,
269 -- with a first ambitus of at least two and a second ambitus of one
270 {
271 case = 'TorcResQuilismaNonAuctusSecondWideOne',
272 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@quilisma@two}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
273 h = [[\gre@hepisorlineaux{\GreCPLeadingQuilismaTwo}{\gre@char@he@porrectus@amone{#2}{#4}}{3}{#3}]],
274 },
275 -- second note of a non-auctus torculus resupinus starting with an oriscus,
276 -- with a first ambitus of at least two and a second ambitus of one
277 {
278 case = 'TorcResOriscusNonAuctusSecondWideOne',
279 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@oriscus@two}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
280 h = [[\gre@hepisorlineaux{\GreCPLeadingOriscusTwo}{\gre@char@he@porrectus@amone{#2}{#4}}{3}{#3}]],
281 },
282 -- second note of a non-auctus torculus resupinus starting with a punctum,
283 -- with a first and second ambitus of one
284 {
285 case = 'TorcResNonAuctusSecondOneOne',
286 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@punctum@one}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
287 h = [[\gre@hepisorlineaux{\GreCPLeadingPunctumOne}{\gre@char@he@porrectus@amone{#2}{#4}}{3}{#3}]],
288 },
289 -- second note of a non-auctus torculus resupinus starting with a quilisma,
290 -- with a first and second ambitus of one
291 {
292 case = 'TorcResQuilismaNonAuctusSecondOneOne',
293 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@quilisma@one}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
294 h = [[\gre@hepisorlineaux{\GreCPLeadingQuilismaOne}{\gre@char@he@porrectus@amone{#2}{#4}}{3}{#3}]],
295 },
296 -- second note of a non-auctus torculus resupinus starting with an oriscus,
297 -- with a first and second ambitus of one
298 {
299 case = 'TorcResOriscusNonAuctusSecondOneOne',
300 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@oriscus@one}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
301 h = [[\gre@hepisorlineaux{\GreCPLeadingOriscusOne}{\gre@char@he@porrectus@amone{#2}{#4}}{3}{#3}]],
302 },
303 -- second note of an auctus torculus resupinus starting with a punctum, with
304 -- a first ambitus of at least two and any second ambitus
305 {
306 case = 'TorcResAuctusSecondWideAny',
307 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@punctum@two}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
308 h = [[\gre@hepisorlineaux{\GreCPLeadingPunctumTwo}{\gre@char@he@porrectusfl{#2}{#4}}{3}{#3}]],
309 },
310 -- second note of an auctus torculus resupinus initio debilis with any first
311 -- and second ambitus
312 {
313 case = 'TorcResDebilisAuctusSecondAnyAny',
314 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@debilis}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
315 h = [[\gre@hepisorlineaux{\GreCPLeadingPunctumOneInitioDebilis}{\gre@char@he@porrectusfl{#2}{#4}}{3}{#3}]],
316 },
317 -- second note of an auctus torculus resupinus starting with a quilisma, with
318 -- a first ambitus of at least two and any second ambitus
319 {
320 case = 'TorcResQuilismaAuctusSecondWideAny',
321 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@quilisma@two}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
322 h = [[\gre@hepisorlineaux{\GreCPLeadingQuilismaTwo}{\gre@char@he@porrectusfl{#2}{#4}}{3}{#3}]],
323 },
324 -- second note of an auctus torculus resupinus starting with an oriscus, with
325 -- a first ambitus of at least two and any second ambitus
326 {
327 case = 'TorcResOriscusAuctusSecondWideAny',
328 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@oriscus@two}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
329 h = [[\gre@hepisorlineaux{\GreCPLeadingOriscusTwo}{\gre@char@he@porrectusfl{#2}{#4}}{3}{#3}]],
330 },
331 -- second note of an auctus torculus resupinus starting with a punctum, with
332 -- a first ambitus of one and any second ambitus
333 {
334 case = 'TorcResAuctusSecondOneAny',
335 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@punctum@one}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
336 h = [[\gre@hepisorlineaux{\GreCPLeadingPunctumOne}{\gre@char@he@porrectusfl{#2}{#4}}{3}{#3}]],
337 },
338 -- second note of an auctus torculus resupinus starting with a quilisma, with
339 -- a first ambitus of one and any second ambitus
340 {
341 case = 'TorcResQuilismaAuctusSecondOneAny',
342 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@quilisma@one}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
343 h = [[\gre@hepisorlineaux{\GreCPLeadingQuilismaOne}{\gre@char@he@porrectusfl{#2}{#4}}{3}{#3}]],
344 },
345 -- second note of an auctus torculus resupinus starting with an oriscus, with
346 -- a first ambitus of one and any second ambitus
347 {
348 case = 'TorcResOriscusAuctusSecondOneAny',
349 v = [[\gre@vepisemaorrareaux{\gre@char@fuse@oriscus@one}{\GreCPPunctum}{3}{0}{#2}{#3}{#4}]],
350 h = [[\gre@hepisorlineaux{\GreCPLeadingOriscusOne}{\gre@char@he@porrectusfl{#2}{#4}}{3}{#3}]],
351 },
352 -- second-to-last note connected to prior note, with a second ambitus of at
353 -- least two, when last note is a standard punctum (like the second note of
354 -- gig)
355 {
356 case = 'ConnectedPenultBeforePunctumWide',
357 v = [[\gre@vepisemaorrareaux{\GreCPFlexusLineBL}{\GreCPPunctumLineBLBR}{2}{0}{#2}{#3}{#4}]],
358 h = [[\gre@hepisorlineaux{\GreCPFlexusLineBL}{\gre@char@he@punctum@line@blbr{#4}}{2}{#3}]],
359 },
360 -- second-to-last note connected to prior note, with a second ambitus of one,
361 -- when last note is a standard punctum (like the second note of gih)
362 {
363 case = 'ConnectedPenultBeforePunctumOne',
364 v = [[\gre@vepisemaorrareaux{\GreCPFlexusAmOneLineBL}{\GreCPPunctumLineBL}{2}{0}{#2}{#3}{#4}]],
365 h = [[\gre@hepisorlineaux{\GreCPFlexusAmOneLineBL}{\gre@char@he@punctum@line@bl{#4}}{2}{#3}]],
366 },
367 -- standard punctum as first note, connected to next higher note
368 {
369 case = 'InitialConnectedPunctum',
370 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctumLineTR}{0}{0}{#2}{#3}{#4}]],
371 h = [[\gre@hepisorlineaux{0}{\gre@char@he@punctum@line@tr{#4}}{0}{#3}]],
372 },
373 -- "virga" as first note, connected to next lower note
374 {
375 case = 'InitialConnectedVirga',
376 v = [[\gre@vepisemaorrareaux{0}{\GreCPVirgaBaseLineBL}{0}{0}{#2}{#3}{#4}]],
377 h = [[\gre@hepisorlineaux{0}{\gre@char@he@virgabase@line@bl{#4}}{0}{#3}]],
378 },
379 -- quilisma as first note, connected to next higher note
380 {
381 case = 'InitialConnectedQuilisma',
382 v = [[\gre@vepisemaorrareaux{0}{\GreCPQuilismaLineTR}{0}{0}{#2}{#3}{#4}]],
383 h = [[\gre@hepisorlineaux{0}{\gre@char@he@quilisma@line@tr{#4}}{0}{#3}]],
384 },
385 -- oriscus as first note, connected to next higher note
386 {
387 case = 'InitialConnectedOriscus',
388 v = [[\gre@vepisemaorrareaux{0}{\GreCPAscendensOriscusLineTR}{0}{0}{#2}{#3}{#4}]],
389 h = [[\gre@hepisorlineaux{0}{\gre@char@he@oriscus@line@tr{#4}}{0}{#3}]],
390 },
391 -- punctum as last note, connected to prior higher note
392 {
393 case = 'FinalConnectedPunctum',
394 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctum}{1}{0}{#2}{#3}{#4}]],
395 h = [[\gre@hepisorlineaux{\GreCPPunctumLineTL}{\gre@char@he@punctum@line@tl{#4}}{2}{#3}]],
396 },
397 -- auctus as last note, connected to prior lower note
398 {
399 case = 'FinalConnectedAuctus',
400 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctumAuctusLineBL}{1}{0}{#2}{#3}{#4}]],
401 h = [[\gre@hepisorlineaux{\GreCPPunctumAuctusLineBL}{\gre@char@he@punctumauctus@line@bl{#4}}{2}{#3}]],
402 },
403 -- virga aucta as last note
404 {
405 case = 'FinalVirgaAuctus',
406 v = [[\gre@vepisemaorrareaux{0}{\GreCPVirgaReversaDescendens}{1}{0}{#2}{#3}{#4}]],
407 h = [[\gre@hepisorlineaux{\GreCPVirgaReversaDescendens}{\gre@char@he@punctumauctus@line@bl{#4}}{2}{#3}]],
408 },
409 -- "virga" as last note, connected to prior lower note
410 {
411 case = 'FinalConnectedVirga',
412 v = [[\gre@vepisemaorrareaux{0}{\GreCPVirga}{1}{0}{#2}{#3}{#4}]],
413 h = [[\gre@hepisorlineaux{\GreCPVirga}{\gre@char@he@virga{#4}}{2}{#3}]],
414 },
415 -- "virga" as first note, disconnected from next note
416 {
417 case = 'InitialVirga',
418 v = [[\gre@vepisemaorrareaux{0}{\GreCPVirga}{0}{0}{#2}{#3}{#4}]],
419 h = [[\gre@hepisorlineaux{0}{\gre@char@he@virga{#4}}{0}{#3}]],
420 },
421 -- "oriscus" as the middle note of a salicus with a second ambitus of at
422 -- least two
423 {
424 case = 'SalicusOriscusWide',
425 v = [[\gre@vepisemaorrareaux{\GreCPPesAscendensOriscusThreeNothing}{\GreCPAscendensOriscusLineBLTR}{3}{0}{#2}{#3}{#4}]],
426 h = [[\gre@hepisorlineaux{\GreCPPesAscendensOriscusThreeNothing}{\gre@char@he@salicus@oriscus{#4}}{4}{#3}]],
427 },
428 -- "oriscus" as the middle note of a salicus with a second ambitus of one
429 {
430 case = 'SalicusOriscusOne',
431 v = [[\gre@vepisemaorrareaux{\GreCPPesAscendensOriscusOneNothing}{\GreCPAscendensOriscus}{3}{0}{#2}{#3}{#4}]],
432 h = [[\gre@hepisorlineaux{\GreCPPesAscendensOriscusOneNothing}{\gre@char@he@salicus@oriscus{#4}}{4}{#3}]],
433 },
434 -- punctum fused to the next note
435 {
436 case = 'LeadingPunctum',
437 v = [[\gre@vepisemaorrareaux{0}{\GreCPPunctum}{0}{0}{#2}{#3}{#4}]],
438 h = [[\gre@hepisorlineaux{\GreCPPunctumTwoUp}{\gre@char@he@punctum{#4}}{2}{#3}]],
439 },
440 -- qulisma fused to the next note
441 {
442 case = 'LeadingQuilisma',
443 v = [[\gre@vepisemaorrareaux{0}{\GreCPQuilisma}{0}{0}{#2}{#3}{#4}]],
444 h = [[\gre@hepisorlineaux{\GreCPQuilismaTwoUp}{\gre@char@he@quilisma{#4}}{2}{#3}]],
445 },
446 -- oriscus fused to the next note
447 {
448 case = 'LeadingOriscus',
449 v = [[\gre@vepisemaorrareaux{0}{\GreCPAscendensOriscus}{0}{0}{#2}{#3}{#4}]],
450 h = [[\gre@hepisorlineaux{\GreCPAscendensOriscusTwoUp}{\gre@char@he@oriscus{#4}}{2}{#3}]],
451 },
452 -- flat
453 {
454 case = 'Flat',
455 v = [[\gre@vepisemaorrareaux{0}{\GreCPFlat}{1}{0}{#2}{#3}{#4}]],
456 h = [[\gre@hepisorlineaux{\GreCPFlat}{\gre@char@he@flat{#4}}{2}{#3}]],
457 },
458 -- sharp
459 {
460 case = 'Sharp',
461 v = [[\gre@vepisemaorrareaux{0}{\GreCPSharp}{1}{0}{#2}{#3}{#4}]],
462 h = [[\gre@hepisorlineaux{\GreCPSharp}{\gre@char@he@sharp{#4}}{2}{#3}]],
463 },
464 -- natural
465 {
466 case = 'Natural',
467 v = [[\gre@vepisemaorrareaux{0}{\GreCPNatural}{1}{0}{#2}{#3}{#4}]],
468 h = [[\gre@hepisorlineaux{\GreCPNatural}{\gre@char@he@natural{#4}}{2}{#3}]],
469 },
470 -- parenthesized flat
471 {
472 case = 'FlatParen',
473 v = [[\gre@vepisemaorrareaux{0}{\GreCPFlatParen}{1}{0}{#2}{#3}{#4}]],
474 h = [[\gre@hepisorlineaux{\GreCPFlatParen}{\gre@char@he@flatparen{#4}}{2}{#3}]],
475 },
476 -- parenthesized sharp
477 {
478 case = 'SharpParen',
479 v = [[\gre@vepisemaorrareaux{0}{\GreCPSharpParen}{1}{0}{#2}{#3}{#4}]],
480 h = [[\gre@hepisorlineaux{\GreCPSharpParen}{\gre@char@he@sharpparen{#4}}{2}{#3}]],
481 },
482 -- parenthesized natural
483 {
484 case = 'NaturalParen',
485 v = [[\gre@vepisemaorrareaux{0}{\GreCPNaturalParen}{1}{0}{#2}{#3}{#4}]],
486 h = [[\gre@hepisorlineaux{\GreCPNaturalParen}{\gre@char@he@naturalparen{#4}}{2}{#3}]],
487 },
488 -- soft flat
489 {
490 case = 'FlatSoft',
491 v = [[\gre@vepisemaorrareaux{0}{\GreCPFlat}{1}{0}{#2}{#3}{#4}]],
492 h = [[\gre@hepisorlineaux{\GreCPFlat}{\gre@char@he@flat{#4}}{2}{#3}]],
493 },
494 -- soft sharp
495 {
496 case = 'SharpSoft',
497 v = [[\gre@vepisemaorrareaux{0}{\GreCPSharp}{1}{0}{#2}{#3}{#4}]],
498 h = [[\gre@hepisorlineaux{\GreCPSharp}{\gre@char@he@sharp{#4}}{2}{#3}]],
499 },
500 -- soft natural
501 {
502 case = 'NaturalSoft',
503 v = [[\gre@vepisemaorrareaux{0}{\GreCPNatural}{1}{0}{#2}{#3}{#4}]],
504 h = [[\gre@hepisorlineaux{\GreCPNatural}{\gre@char@he@natural{#4}}{2}{#3}]],
505 },
506 }
507
508 local function emit_offset_macros()
509 local i, item
510 for i, item in ipairs(offset_cases) do
511 debugmessage('offsetcase', [[\def\GreOCase%s{%d}]], item.case, i)
512 tex.sprint(string.format([[\def\GreOCase%s{%d}]], item.case, i))
513 end
514 tex.sprint([[\def\gre@v@case#1#2#3#4{]])
515 tex.sprint([[\ifcase#1\gre@bug{Invalid note offset case: \string#1}]])
516 for i, item in ipairs(offset_cases) do
517 tex.sprint([[\or]])
518 if item.v then
519 tex.sprint(item.v)
520 end
521 end
522 tex.sprint([[\else\gre@bug{Invalid note 2 offset case: \string#1}]])
523 tex.sprint([[\fi}]])
524 tex.sprint([[\def\gre@h@case#1#2#3#4{]])
525 tex.sprint([[\ifcase#1\gre@bug{Invalid note offset case: \string#1}]])
526 for i, item in ipairs(offset_cases) do
527 tex.sprint([[\or]])
528 if item.h then
529 tex.sprint(item.h)
530 end
531 end
532 tex.sprint([[\else\gre@bug{Invalid note offset case: \string#1}]])
533 tex.sprint([[\fi}]])
534 end
535
536 gregoriotex.emit_offset_macros = emit_offset_macros