Armide : acte 3 scène 2
[nenuvar.git] / common / markup.ily
blob13c69dda8a2cb78f2eed42f2ef80b8f12d4a419d
1 %%% markup.ily -- generic markup commands
2 %%%
3 %%% Author: Nicolas Sceaux <nicolas.sceaux@free.fr>
4 %%%
5 %%% Markup commands
6 %%% ===============
7 %%%   \vspace <amount>
8 %%%     like \hspace, but for vertical space
9 %%%
10 %%%   \smallCaps <string>
11 %%%     like built-in \smallCaps, but dealing with accented letters
12 %%%
13 %%%   \when-property <symbol> <markup>
14 %%%     if symbol is find in properties, interpret the markup
15 %%%     otherwise, return an empty stencil
16 %%%
17 %%%   \line-width-ratio <ratio> <markup>
18 %%%     interpret markup with a line-width set to current line-width * ratio
19 %%%
20 %%%   \copyright
21 %%%     build a copyight line, using the maintainer and copyrightYear
22 %%%     header variables.
23 %%%
24 %%%   \wordwrap-center <markup-list>
25 %%%     like wordwrap, but center align the lines
26 %%%
27 %%% Markup lines commands
28 %%% =====================
29 %%%   \wordwrap-center-lines <markup-list>
30 %%%     make a markup list composed centered lines of text.
32 %%% Redefinition of \column, \justify and \wordwrap
33 %%% to fix spacing around blocks
34 #(define-markup-command (column layout props args) (markup-list?)
35    #:properties ((baseline-skip))
36    (let ((arg-stencils (interpret-markup-list layout props args)))
37      (stack-lines DOWN 0.0 0
38                   (space-lines baseline-skip
39                                (remove ly:stencil-empty? arg-stencils)))))
41 #(define-markup-command (justify layout props args)
42      (markup-list?)
43    #:properties ((baseline-skip)
44                  wordwrap-internal-markup-list)
45    (stack-lines
46     DOWN 0.0 0
47     (space-lines baseline-skip
48                  (wordwrap-internal-markup-list layout props #t args))))
50 #(define-markup-command (wordwrap layout props args)
51      (markup-list?)
52    #:properties ((baseline-skip)
53                  wordwrap-internal-markup-list)
54   (stack-lines
55    DOWN 0.0 0
56    (space-lines baseline-skip
57                 (wordwrap-internal-markup-list layout props #f args))))
59 %%%
60 %%%
62 #(define-markup-command (vspace layout props amount) (number?)
63   "This produces a invisible object taking vertical space."
64   (let ((amount (* amount 3.0)))
65     (if (> amount 0)
66         (ly:make-stencil "" (cons -1 1) (cons 0 amount))
67         (ly:make-stencil "" (cons -1 1) (cons amount amount)))))
69 #(define-markup-command (copyright layout props) ()
70   (let* ((maintainer (chain-assoc-get 'header:maintainer props))
71          (this-year (+ 1900 (tm:year (gmtime (current-time)))))
72          (year (string->number (or (chain-assoc-get 'header:copyrightYear props)
73                                    (number->string this-year)))))
74     (interpret-markup layout props
75      (markup "Copyright ©" 
76              (if (= year this-year)
77                  (format #f "~a" this-year)
78                  (format #f "~a-~a" year this-year))
79              maintainer))))
81 #(define-markup-command (today layout props) ()
82   (let ((today (gmtime (current-time))))
83    (interpret-markup layout props
84      (format #f "~a-~a-~a"
85              (+ 1900 (tm:year today))
86              (1+ (tm:mon today))
87              (tm:mday today)))))
89 #(define-markup-command (today-french layout props) ()
90    (let* ((date (gmtime (current-time)))
91           (months '#("janvier" "février" "mars" "avril"
92                                "mai" "juin" "juillet" "août"
93                                "septembre" "octobre" "novembre"
94                                "décembre"))
95           (day (if (= (tm:mday date) 1)
96                    (markup (#:concat ("1" #:super "er")))
97                    (number->string (tm:mday date))))
98           (month (vector-ref months (tm:mon date)))
99           (year (number->string (+ 1900 (tm:year date)))))
100      (interpret-markup
101       layout props (markup day month year))))
103 #(define-markup-command (when-property layout props symbol markp) (symbol? markup?)
104   (if (chain-assoc-get symbol props)
105       (interpret-markup layout props markp)
106       (ly:make-stencil '()  '(1 . -1) '(1 . -1))))
108 #(define-markup-command (apply-fromproperty layout props fn symbol)
109   (procedure? symbol?)
110   (let ((m (chain-assoc-get symbol props)))
111     (if (markup? m)
112         (interpret-markup layout props (fn m))
113         empty-stencil)))
115 #(define-markup-command (line-width-ratio layout props width-ratio arg)
116   (number? markup?)
117   (interpret-markup layout props
118    (markup #:override (cons 'line-width (* width-ratio
119                                            (chain-assoc-get 'line-width props)))
120            arg)))
122 #(define-markup-list-command (line-width-ratio-lines layout props width-ratio args)
123   (number? markup-list?)
124   (interpret-markup-list layout props
125     (make-override-lines-markup-list
126       (cons 'line-width (* width-ratio
127                            (chain-assoc-get 'line-width props)))
128       args)))
130 #(define-markup-list-command (with-line-width-ratio layout props width-ratio args)
131   (number? markup-list?)
132   (let* ((line-width (chain-assoc-get 'line-width props))
133          (new-line-width (* width-ratio line-width))
134          (indent (* 0.5 (- line-width new-line-width)))
135          (stencils (interpret-markup-list layout
136                      (cons `((line-width . ,new-line-width)) props)
137                      args)))
138     (interpret-markup-list layout props
139       (map (lambda (stencil)
140              (markup #:hspace indent #:stencil stencil))
141            stencils))))
143 #(define-markup-command (force-line-width-ratio layout props ratio arg)
144      (number? markup?)
145    (let* ((new-line-width (* ratio (chain-assoc-get 'line-width props)))
146           (line-stencil (interpret-markup layout props
147                                   (markup #:override (cons 'line-width new-line-width)
148                                           arg)))
149           (gap (max 0
150                     (- new-line-width
151                        (interval-length (ly:stencil-extent line-stencil X))))))
152      (interpret-markup layout props (markup #:concat (#:stencil line-stencil #:hspace gap)))))
154 #(define-markup-list-command (two-column-lines layout props col1 col2)
155    (markup-list? markup-list?)
156    (interpret-markup-list layout props
157                           (make-column-lines-markup-list
158                            (let ((result '()))
159                              (let map-on-lists ((col1 col1)
160                                                 (col2 col2))
161                                (if (and (null? col1) (null? col2))
162                                    (reverse! result)
163                                    (let ((line-col1 (if (null? col1) "" (car col1)))
164                                          (line-col2 (if (null? col2) "" (car col2)))
165                                          (rest-col1 (if (null? col1) '() (cdr col1)))
166                                          (rest-col2 (if (null? col2) '() (cdr col2))))
167                                      (set! result (cons
168                                                    (markup #:fill-line
169                                                            (#:null
170                                                             #:force-line-width-ratio 0.45 line-col1
171                                                             #:null
172                                                             #:force-line-width-ratio 0.45 line-col2
173                                                             #:null))
174                                                    result))
175                                      (map-on-lists rest-col1 rest-col2))))))))
177 #(define-markup-command (tacet-lyrics layout props score text)
178      (markup? markup-list?)
179    #:properties ((column-number 2))
180    (interpret-markup
181     layout props
182     #{\markup\column {
183         \fontsize #-2 \override #`(column-number . ,column-number)
184         \column\page-columns {
185           \fontsize #2 \line { \hspace #10 Tacet $score }
186           \null
187           $text
188         }
189       } #}))
191 #(define-markup-command (tacet layout props num) (number?)
192    (let ((score (ly:make-score
193                  (make-music
194                   'SequentialMusic
195                   'elements (list (make-music
196                                    'MultiMeasureRestMusic
197                                    'duration (ly:make-duration 0 0 num))
198                                   (make-music
199                                    'ContextSpeccedMusic
200                                    'context-type 'Timing
201                                    'element (make-music
202                                              'PropertySet
203                                              'value ""
204                                              'symbol 'whichBar)))))))
205      (ly:score-add-output-def! score #{ \layout {
206       indent = 0
207       ragged-right = ##t
208       \context { \Score skipBars = ##t }
209       \context {
210         \Staff
211         \remove "Time_signature_engraver"
212         \remove "Clef_engraver"
213         \override StaffSymbol.line-count = #1
214         \override StaffSymbol.transparent = ##t
215         \override MultiMeasureRest #'expand-limit = #2
216       }
217     } #})
218      (interpret-markup
219       layout props
220       #{ \markup { \hspace #10 Tacet $(make-score-markup score) } #})))
222 #(define-markup-command (lyrics layout props text)
223      (markup-list?)
224    #:properties ((column-number 2))
225    (interpret-markup
226     layout props
227     #{\markup\column {
228         \fontsize #-2 \override #`(column-number . ,column-number)
229         \column\page-columns { $text } } #}))
231 #(define-markup-list-command (indented-lines layout props indent args)
232   (number? markup-list?)
233   (let* ((new-line-width (- (chain-assoc-get 'line-width props) indent))
234          (lines (interpret-markup-list layout
235                  (cons `((line-width . ,new-line-width)) props)
236                  args)))
237    (interpret-markup-list layout props
238     (map (lambda (line)
239           (markup #:hspace indent #:stencil line))
240      lines))))
242 #(define-markup-list-command (wordwrap-center-lines layout props args)
243   (markup-list?)
244   (map (lambda (stencil)
245         (interpret-markup layout props (markup #:fill-line (#:stencil stencil))))
246    (interpret-markup-list layout props (make-wordwrap-lines-markup-list args))))
248 #(define-markup-list-command (centered-lines layout props args)
249   (markup-list?)
250   (let ((baseline-skip (chain-assoc-get 'baseline-skip props)))
251     (space-lines baseline-skip
252       (interpret-markup-list layout props
253         (map (lambda (arg) (markup #:fill-line (arg)))
254              args)))))
256 #(define-markup-list-command (fontsize-lines layout props increment args)
257    (number? markup-list?)
258    #:properties ((font-size 0)
259                  (word-space 1)
260                  (baseline-skip 2))
261    (interpret-markup-list layout
262                           (cons `((baseline-skip . ,(* baseline-skip (magstep increment)))
263                                   (word-space . ,(* word-space (magstep increment)))
264                                   (font-size . ,(+ font-size increment)))
265                                 props)
266                           args))
268 #(define-markup-list-command (abs-fontsize-lines layout props size args)
269   (number? markup-list?)
270   (let* ((ref-size (ly:output-def-lookup layout 'text-font-size 12))
271          (text-props (list (ly:output-def-lookup layout 'text-font-defaults)))
272          (ref-word-space (chain-assoc-get 'word-space text-props 0.6))
273          (ref-baseline (chain-assoc-get 'baseline-skip text-props 3))
274          (magnification (/ size ref-size)))
275     (interpret-markup-list layout
276                            (cons `((baseline-skip . ,(* magnification ref-baseline))
277                                    (word-space . ,(* magnification ref-word-space))
278                                    (font-size . ,(magnification->font-size magnification)))
279                                  props)
280                            args)))
282 #(define-markup-command (wordwrap-center layout props args) (markup-list?)
283   (interpret-markup layout props
284    (make-column-markup
285     (make-wordwrap-center-lines-markup-list args))))
287 #(define (page-ref-aux layout props label gauge next)
288   (let* ((gauge-stencil
289           (interpret-markup layout props
290                             (make-concat-markup (list gauge next))))
291          (x-ext (ly:stencil-extent gauge-stencil X))
292          (y-ext (ly:stencil-extent gauge-stencil Y)))
293     (ly:make-stencil
294      `(delay-stencil-evaluation
295        ,(delay (ly:stencil-expr
296                 (let* ((table (ly:output-def-lookup layout 'label-page-table))
297                        (label-page (and (list? table) (assoc label table)))
298                        (page-number (and label-page (cdr label-page)))
299                        (page-markup (if page-number
300                                         (markup #:page-link page-number
301                                             #:concat ((format "~a" page-number)
302                                                       next))
303                                         (markup #:concat ("?" next))))
304                        (page-stencil (interpret-markup layout props page-markup))
305                        (gap (- (interval-length x-ext)
306                                (interval-length (ly:stencil-extent page-stencil X)))))
307                   (interpret-markup layout props
308                                     (markup #:concat (page-markup #:hspace gap)))))))
309      x-ext
310      y-ext)))
312 #(define-markup-command (page-refI layout props label next)
313   (symbol? markup?)
314   (page-ref-aux layout props label "0" next))
316 #(define-markup-command (page-refII layout props label next)
317   (symbol? markup?)
318   (page-ref-aux layout props label "00" next))
320 #(define-markup-command (page-refIII layout props label next)
321   (symbol? markup?)
322   (page-ref-aux layout props label "000" next))
324 #(define-markup-command (super layout props arg) (markup?)
325   (ly:stencil-translate-axis
326    (interpret-markup
327     layout
328     (cons `((font-size . ,(- (chain-assoc-get 'font-size props 0) 3))) props)
329     arg)
330    (* 0.25 (chain-assoc-get 'baseline-skip props))
331    Y))
333 #(define-markup-list-command (paragraph layout props text) (markup-list?)
334   (let ((indentation (markup #:pad-to-box (cons 0 3) (cons 0 0) #:null)))
335     (interpret-markup-list layout props
336        (make-justified-lines-markup-list (cons indentation text)))))
338 #(define-markup-list-command (columns paper props text) (markup-list?)
339   (interpret-markup-list paper props
340     (make-column-lines-markup-list text)))
342 #(define-markup-command (separation-line layout props width) (number?)
343   (interpret-markup layout props
344    (markup #:fill-line (#:draw-line (cons (/ (* 20 width) (*staff-size*)) 0)))))
346 #(define-markup-command (sep layout props) ()
347    (interpret-markup layout props
348                      (markup #:pad-around 1 #:fill-line (#:draw-line '(50 . 0)))))
350 #(define-markup-command (boxed-justify layout props text) (markup-list?)
351   (interpret-markup layout props
352    (make-override-markup '(box-padding . 1)
353     (make-box-markup
354      (make-column-markup
355       (make-justified-lines-markup-list text))))))
357 #(define-markup-command (after-system layout props arg) (markup?)
358    (let ((stencil (interpret-markup layout props arg)))
359      (ly:make-stencil (ly:stencil-expr (ly:stencil-aligned-to stencil Y DOWN))
360                       (ly:stencil-extent stencil X)
361                       '(1 . -1))))
363 %%% Guile does not deal with accented letters
364 #(use-modules (ice-9 regex))
365 %%;; actually defined below, in a closure
366 #(define-public string-upper-case #f)
367 #(define accented-char-upper-case? #f)
368 #(define accented-char-lower-case? #f)
370 %%;; an accented character is seen as two characters by guile
371 #(let ((lower-case-accented-string "éèêëáàâäíìîïóòôöúùûüçœæ")
372        (upper-case-accented-string "ÉÈÊËÁÀÂÄÍÌÎÏÓÒÔÖÚÙÛÜÇŒÆ"))
373    (define (group-by-2 chars result)
374       (if (or (null? chars) (null? (cdr chars)))
375           (reverse! result)
376           (group-by-2 (cddr chars)
377                       (cons (string (car chars) (cadr chars))
378                             result))))
379    (let ((lower-case-accented-chars
380           (group-by-2 (string->list lower-case-accented-string) (list)))
381          (upper-case-accented-chars
382           (group-by-2 (string->list upper-case-accented-string) (list))))
383      (set! string-upper-case
384            (lambda (str)
385              (define (replace-chars str froms tos)
386                (if (null? froms)
387                    str
388                    (replace-chars (regexp-substitute/global #f (car froms) str
389                                                             'pre (car tos) 'post)
390                                   (cdr froms)
391                                   (cdr tos))))
392              (string-upcase (replace-chars str
393                                            lower-case-accented-chars
394                                            upper-case-accented-chars))))
395      (set! accented-char-upper-case?
396            (lambda (char1 char2)
397              (member (string char1 char2) upper-case-accented-chars string=?)))
398      (set! accented-char-lower-case?
399            (lambda (char1 char2)
400              (member (string char1 char2) lower-case-accented-chars string=?)))))
402 #(define-markup-command (smallCaps layout props text) (markup?)
403   "Turn @code{text}, which should be a string, to small caps.
404 @example
405 \\markup \\small-caps \"Text between double quotes\"
406 @end example"
407   (define (string-list->markup strings lower)
408     (let ((final-string (string-upper-case
409                          (apply string-append (reverse strings)))))
410       (if lower
411           (markup #:fontsize -2 final-string)
412           final-string)))
413   (define (make-small-caps rest-chars currents current-is-lower prev-result)
414     (if (null? rest-chars)
415         (make-concat-markup (reverse! (cons (string-list->markup
416                                               currents current-is-lower)
417                                             prev-result)))
418         (let* ((ch1 (car rest-chars))
419                (ch2 (and (not (null? (cdr rest-chars))) (cadr rest-chars)))
420                (this-char-string (string ch1))
421                (is-lower (char-lower-case? ch1))
422                (next-rest-chars (cdr rest-chars)))
423           (cond ((and ch2 (accented-char-lower-case? ch1 ch2))
424                  (set! this-char-string (string ch1 ch2))
425                  (set! is-lower #t)
426                  (set! next-rest-chars (cddr rest-chars)))
427                 ((and ch2 (accented-char-upper-case? ch1 ch2))
428                  (set! this-char-string (string ch1 ch2))
429                  (set! is-lower #f)
430                  (set! next-rest-chars (cddr rest-chars))))
431           (if (or (and current-is-lower is-lower)
432                   (and (not current-is-lower) (not is-lower)))
433               (make-small-caps next-rest-chars
434                                (cons this-char-string currents)
435                                is-lower
436                                prev-result)
437               (make-small-caps next-rest-chars
438                                (list this-char-string)
439                                is-lower
440                                (if (null? currents)
441                                    prev-result
442                                    (cons (string-list->markup
443                                             currents current-is-lower)
444                                          prev-result)))))))
445   (interpret-markup layout props
446     (if (string? text)
447         (make-small-caps (string->list text) (list) #f (list))
448         text)))
450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
451 %%% Character lists, inline quoted scores, etc.
453 startQuote =
454 #(define-music-function (parser location bar-num) (number?)
455    #{ \override Score.BarNumber #'break-visibility = #'#(#f #f #t)
456       \bar ""
457       \set Score.currentBarNumber = #bar-num #})
459 tinyQuote = {
460   \override Score.StaffSymbol #'staff-space = #(magstep -3)
461   \set Score . fontSize = #-3
464 quoteLayout = \layout {
465   indent = 0
466   ragged-right = ##t
467   \context { \Staff \remove "Time_signature_engraver" }
468   \context { \Voice \override Script #'avoid-slur = #'outside }
469   \context {
470     \Score
471     \override StaffGrouper.staff-staff-spacing.basic-distance = #1
472     \override BarNumber.break-visibility = #'#(#f #f #t)
473   }
476 tinyLayout = \layout {
477   \context {
478     \Score
479     \override StaffSymbol #'staff-space = #(magstep -2)
480     fontSize = #-2
481   }
482   \context { \FiguredBass \override BassFigure.font-size = #-2 }
485 tinyQuoteLayout = \layout {
486   \quoteLayout
487   \context {
488     \Score
489     \override StaffSymbol #'staff-space = #(magstep -3)
490     fontSize = #-3
491   }
492   \context { \FiguredBass \override BassFigure.font-size = #-3 }
495 quoteEmptyLayout = \layout {
496   indent = 0
497   ragged-right = ##t
498   \context { \Score skipBars = ##t }
499   \context {
500     \Staff
501     \remove "Time_signature_engraver"
502     \remove "Clef_engraver"
503     \remove "Staff_symbol_engraver"
504     \override MultiMeasureRest #'expand-limit = #2
505   }
508 smallLayout = \layout {
509   \context {
510     \Staff fontSize = #-1
511     \override StaffSymbol.staff-space = #(magstep -1)
512   }
513   \context { \Lyrics fontSize = #-1 }
514   \context { \FiguredBass \override BassFigure.font-size = #-1 }
515   \context { \Voice \override Script.avoid-slur = #'outside }
516   \context { \CueVoice \override Script.avoid-slur = #'outside }
517   \context {
518     \Score
519     \override NonMusicalPaperColumn.line-break-permission = #'allow
520     \override NonMusicalPaperColumn.page-break-permission = #'allow
521   }
524 onlyNotesLayout = \layout {
525   indent = 0
526   \context {
527     \Staff
528     \remove "Time_signature_engraver"
529     \remove "Clef_engraver"
530     \remove "Staff_symbol_engraver"
531   }
532   \context { \Score \remove "Bar_number_engraver" }
535 characterLayout = \layout {
536   \quoteLayout
537   line-width = #(if (eqv? #t (ly:get-option 'ancient-style))
538                     (* 10 mm)
539                     (* 18 mm))
540   ragged-right = ##f
541   \context {
542     \Staff
543     \override Clef #'full-size-change = ##t
544     \remove "Bar_engraver"
545   }
546   \context {
547     \Voice
548     \remove "Stem_engraver"
549   }
552 characterAmbitus =
553 #(define-music-function (parser location clef1 clef2 low-note high-note)
554      (string? string? ly:music? ly:music?)
555    (let* ((low-pitch (ly:music-property low-note 'pitch))
556           (high-pitch (ly:music-property high-note 'pitch))
557           (chord (make-music
558                   'EventChord
559                   'elements (list (make-music
560                                    'NoteEvent
561                                    'duration (ly:make-duration 2 0 1 1)
562                                    'pitch low-pitch)
563                                   (make-music
564                                    'NoteEvent
565                                    'duration (ly:make-duration 2 0 1 1)
566                                    'pitch high-pitch)))))
567      (if (eqv? #t (ly:get-option 'ancient-style))
568          #{ \new Staff { \clef $clef1 $chord } #}
569          #{ \new Staff {
570   \clef $clef1 s16
571   \set Staff.forceClef = ##t
572   \clef $clef2 s8. $chord s2
573 } #})))
576 #(define-markup-command (character-ambitus layout props name ambitus)
577      (markup? markup?)
578    #:properties ((character-width-ratio 16/20)
579                  (ambitus-width-ratio 3/20))
580    (stack-lines
581     DOWN 0 0
582     (list empty-stencil
583           (interpret-markup layout props
584                             (markup 
585                              #:force-line-width-ratio ambitus-width-ratio
586                              #:vcenter #:fill-line (#:null #:left-align ambitus)
587                              #:hspace 2
588                              #:force-line-width-ratio character-width-ratio
589                              #:vcenter #:smallCaps name)))))
591 #(define-markup-command (character-two-columns layout props col1 col2)
592      (markup? markup?)
593    #:properties ((word-space 0.6)
594                  (character-width-ratio 10/30)
595                  (ambitus-width-ratio 4/30))
596    (interpret-markup
597     layout props
598     #{ \markup
599        \override #`(character-width-ratio . ,character-width-ratio)
600        \override #`(ambitus-width-ratio . ,ambitus-width-ratio)
601        \fill-line {
602          \null
603          \override #`(word-space . ,word-space) $col1
604          \hspace #3
605          \override #`(word-space . ,word-space) $col2
606          \null
607        } #}))
609 #(define-markup-command (character-three-columns layout props col1 col2 col3)
610      (markup? markup? markup?)
611    #:properties ((word-space 0.6))
612    (interpret-markup
613     layout props
614     (markup (#:concat (#:override `(word-space . ,word-space) col1
615                                   #:hspace 3
616                                   #:override `(word-space . ,word-space) col2
617                                   #:hspace 3
618                                   #:override `(word-space . ,word-space) col3)))))
620 #(define-markup-command (sline layout props args) (markup-list?)
621    (interpret-markup layout props
622                      (make-line-markup (cons (make-hspace-markup 4) args))))
624 %% Verse margins
625 #(define-markup-command (verse layout props syllab-count words)
626      (number? markup-list?)
627    (interpret-markup
628     layout props
629     (if (< syllab-count 12)
630         (make-line-markup (cons (make-hspace-markup (* 1.5 (- 12 syllab-count)))
631                                 words))
632         (make-line-markup words))))
635 %%% Foot notes
636 \paper {
637   footnote-auto-numbering = ##t
638   footnote-numbering-function =
639   #(lambda (num)
640      (markup #:small #:box (number->string (+ 1 num))))
641   footnote-separator-markup = \markup\override #'(span-factor . 1/4) \draw-hline
642   footnote-padding = 2\mm
643   footnote-footer-padding = 1\mm
646 #(define (make-footnote-here-music offset note)
647    (make-music 'FootnoteEvent
648                'X-offset (car offset)
649                'Y-offset (cdr offset)
650                'automatically-numbered #t
651                'text (make-null-markup)
652                'footnote-text note))
653 footnoteHere =
654 #(define-music-function (parser this-location offset note)
655      (number-pair? markup?)
656      (set! location #f)
657    #{ <>-\tweak footnote-music #(make-footnote-here-music offset note)
658        ^\markup\transparent\box "1" #})
660 footnoteHereFull =
661 #(define-music-function (parser this-location offset note)
662      (number-pair? markup?)
663    (set! location #f)
664    (if (symbol? (ly:get-option 'part))
665        (make-music 'Music 'void #t)
666        #{ <>-\tweak footnote-music #(make-footnote-here-music offset note)
667           ^\markup\transparent\box "1" #}))
669 footnoteHereNoSpace =
670 #(define-music-function (parser this-location offset note)
671      (number-pair? markup?)
672      (set! location #f)
673      #{ <>-\tweak footnote-music #(make-footnote-here-music offset note)
674         ^\markup\null #})
677 textSpanner =
678 #(define-music-function (parser this-location text)
679      (markup?)
680    #{
681 \once\override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER
682 \once\override TextSpanner.bound-details.left.text =
683 \markup\whiteout { $text \hspace #1 }
684 \once\override TextSpanner.bound-details.left-broken.text = \markup\transparent t %##f