syllabify : prise en compte langues sans espace insécable avant les
[nenuvar.git] / common / markup.ily
blob57cd168886ddfb321e40b0af2480269b7d3da0ea
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
118     layout props
119     #{ \markup\override
120          #`(line-width . ,(* width-ratio
121                              (or (chain-assoc-get 'line-width props)
122                                  (ly:output-def-lookup layout 'line-width))))
123          $arg #}))
125 #(define-markup-list-command (line-width-ratio-lines layout props width-ratio args)
126   (number? markup-list?)
127   (interpret-markup-list layout props
128     (make-override-lines-markup-list
129       (cons 'line-width (* width-ratio
130                            (chain-assoc-get 'line-width props)))
131       args)))
133 #(define-markup-list-command (with-line-width-ratio layout props width-ratio args)
134   (number? markup-list?)
135   (let* ((line-width (chain-assoc-get 'line-width props))
136          (new-line-width (* width-ratio line-width))
137          (indent (* 0.5 (- line-width new-line-width)))
138          (stencils (interpret-markup-list layout
139                      (cons `((line-width . ,new-line-width)) props)
140                      args)))
141     (interpret-markup-list layout props
142       (map (lambda (stencil)
143              (markup #:hspace indent #:stencil stencil))
144            stencils))))
146 #(define-markup-command (force-line-width-ratio layout props ratio arg)
147      (number? markup?)
148    (let* ((new-line-width (* ratio (chain-assoc-get 'line-width props)))
149           (line-stencil (interpret-markup layout props
150                                   (markup #:override (cons 'line-width new-line-width)
151                                           arg)))
152           (gap (max 0
153                     (- new-line-width
154                        (interval-length (ly:stencil-extent line-stencil X))))))
155      (interpret-markup layout props (markup #:concat (#:stencil line-stencil #:hspace gap)))))
157 #(define-markup-list-command (two-column-lines layout props col1 col2)
158    (markup-list? markup-list?)
159    (interpret-markup-list layout props
160                           (make-column-lines-markup-list
161                            (let ((result '()))
162                              (let map-on-lists ((col1 col1)
163                                                 (col2 col2))
164                                (if (and (null? col1) (null? col2))
165                                    (reverse! result)
166                                    (let ((line-col1 (if (null? col1) "" (car col1)))
167                                          (line-col2 (if (null? col2) "" (car col2)))
168                                          (rest-col1 (if (null? col1) '() (cdr col1)))
169                                          (rest-col2 (if (null? col2) '() (cdr col2))))
170                                      (set! result (cons
171                                                    (markup #:fill-line
172                                                            (#:null
173                                                             #:force-line-width-ratio 0.45 line-col1
174                                                             #:null
175                                                             #:force-line-width-ratio 0.45 line-col2
176                                                             #:null))
177                                                    result))
178                                      (map-on-lists rest-col1 rest-col2))))))))
180 #(define-markup-command (tacet-lyrics layout props score text)
181      (markup? markup-list?)
182    #:properties ((column-number 2))
183    (interpret-markup
184     layout props
185     #{\markup\column {
186         \fontsize #-2 \override #`(column-number . ,column-number)
187         \column\page-columns {
188           \fontsize #2 \line { \hspace #10 Tacet $score }
189           \null
190           $text
191         }
192       } #}))
194 #(define-markup-command (tacet layout props num) (number?)
195    (let ((score (ly:make-score
196                  (make-music
197                   'SequentialMusic
198                   'elements (list (make-music
199                                    'MultiMeasureRestMusic
200                                    'duration (ly:make-duration 0 0 num))
201                                   (make-music
202                                    'ContextSpeccedMusic
203                                    'context-type 'Timing
204                                    'element (make-music
205                                              'PropertySet
206                                              'value ""
207                                              'symbol 'whichBar)))))))
208      (ly:score-add-output-def! score #{ \layout {
209       indent = 0
210       ragged-right = ##t
211       \context {
212         \Score
213         skipBars = ##t
214         fontSize = #-4
215         \override StaffSymbol.staff-space = #(magstep -4)
216       }
217       \context {
218         \Staff
219         \remove "Time_signature_engraver"
220         \remove "Clef_engraver"
221         \override StaffSymbol.line-count = #1
222         \override StaffSymbol.transparent = ##t
223         \override MultiMeasureRest #'expand-limit = #2
224       }
225     } #})
226      (interpret-markup
227       layout props
228       #{ \markup { \hspace #10 Tacet
229           \with-dimensions #'(-1 . 1) #'(-1 . 2) $(make-score-markup score) } #})))
231 #(define-markup-command (lyrics layout props text)
232      (markup-list?)
233    #:properties ((column-number 2))
234    (interpret-markup
235     layout props
236     #{\markup\column {
237         \fontsize #-2 \override #`(column-number . ,column-number)
238         \column\page-columns { $text } } #}))
240 #(define-markup-list-command (indented-lines layout props indent args)
241   (number? markup-list?)
242   (let* ((new-line-width (- (chain-assoc-get 'line-width props) indent))
243          (lines (interpret-markup-list layout
244                  (cons `((line-width . ,new-line-width)) props)
245                  args)))
246    (interpret-markup-list layout props
247     (map (lambda (line)
248           (markup #:hspace indent #:stencil line))
249      lines))))
251 #(define-markup-list-command (wordwrap-center-lines layout props args)
252   (markup-list?)
253   (map (lambda (stencil)
254         (interpret-markup layout props (markup #:fill-line (#:stencil stencil))))
255    (interpret-markup-list layout props (make-wordwrap-lines-markup-list args))))
257 #(define-markup-list-command (centered-lines layout props args)
258   (markup-list?)
259   (let ((baseline-skip (chain-assoc-get 'baseline-skip props)))
260     (space-lines baseline-skip
261       (interpret-markup-list layout props
262         (map (lambda (arg) (markup #:fill-line (arg)))
263              args)))))
265 #(define-markup-list-command (fontsize-lines layout props increment args)
266    (number? markup-list?)
267    #:properties ((font-size 0)
268                  (word-space 1)
269                  (baseline-skip 2))
270    (interpret-markup-list layout
271                           (cons `((baseline-skip . ,(* baseline-skip (magstep increment)))
272                                   (word-space . ,(* word-space (magstep increment)))
273                                   (font-size . ,(+ font-size increment)))
274                                 props)
275                           args))
277 #(define-markup-list-command (abs-fontsize-lines layout props size args)
278   (number? markup-list?)
279   (let* ((ref-size (ly:output-def-lookup layout 'text-font-size 12))
280          (text-props (list (ly:output-def-lookup layout 'text-font-defaults)))
281          (ref-word-space (chain-assoc-get 'word-space text-props 0.6))
282          (ref-baseline (chain-assoc-get 'baseline-skip text-props 3))
283          (magnification (/ size ref-size)))
284     (interpret-markup-list layout
285                            (cons `((baseline-skip . ,(* magnification ref-baseline))
286                                    (word-space . ,(* magnification ref-word-space))
287                                    (font-size . ,(magnification->font-size magnification)))
288                                  props)
289                            args)))
291 #(define-markup-command (wordwrap-center layout props args) (markup-list?)
292   (interpret-markup layout props
293    (make-column-markup
294     (make-wordwrap-center-lines-markup-list args))))
296 #(define (page-ref-aux layout props label gauge next)
297   (let* ((gauge-stencil
298           (interpret-markup layout props
299                             (make-concat-markup (list gauge next))))
300          (x-ext (ly:stencil-extent gauge-stencil X))
301          (y-ext (ly:stencil-extent gauge-stencil Y)))
302     (ly:make-stencil
303      `(delay-stencil-evaluation
304        ,(delay (ly:stencil-expr
305                 (let* ((table (ly:output-def-lookup layout 'label-page-table))
306                        (label-page (and (list? table) (assoc label table)))
307                        (page-number (and label-page (cdr label-page)))
308                        (page-markup (if page-number
309                                         (markup #:page-link page-number
310                                             #:concat ((format "~a" page-number)
311                                                       next))
312                                         (markup #:concat ("?" next))))
313                        (page-stencil (interpret-markup layout props page-markup))
314                        (gap (- (interval-length x-ext)
315                                (interval-length (ly:stencil-extent page-stencil X)))))
316                   (interpret-markup layout props
317                                     (markup #:concat (page-markup #:hspace gap)))))))
318      x-ext
319      y-ext)))
321 #(define-markup-command (page-refI layout props label next)
322   (symbol? markup?)
323   (page-ref-aux layout props label "0" next))
325 #(define-markup-command (page-refII layout props label next)
326   (symbol? markup?)
327   (page-ref-aux layout props label "00" next))
329 #(define-markup-command (page-refIII layout props label next)
330   (symbol? markup?)
331   (page-ref-aux layout props label "000" next))
333 #(define-markup-command (super layout props arg) (markup?)
334   (ly:stencil-translate-axis
335    (interpret-markup
336     layout
337     (cons `((font-size . ,(- (chain-assoc-get 'font-size props 0) 3))) props)
338     arg)
339    (* 0.25 (chain-assoc-get 'baseline-skip props))
340    Y))
342 #(define-markup-list-command (paragraph layout props text) (markup-list?)
343   (let ((indentation (markup #:pad-to-box (cons 0 3) (cons 0 0) #:null)))
344     (interpret-markup-list layout props
345        (make-justified-lines-markup-list (cons indentation text)))))
347 #(define-markup-list-command (columns paper props text) (markup-list?)
348   (interpret-markup-list paper props
349     (make-column-lines-markup-list text)))
351 #(define-markup-command (separation-line layout props width) (number?)
352   (interpret-markup layout props
353    (markup #:fill-line (#:draw-line (cons (/ (* 20 width) (*staff-size*)) 0)))))
355 #(define-markup-command (sep layout props) ()
356    (interpret-markup layout props
357                      (markup #:pad-around 1 #:fill-line (#:draw-line '(50 . 0)))))
359 #(define-markup-command (boxed-justify layout props text) (markup-list?)
360   (interpret-markup layout props
361    (make-override-markup '(box-padding . 1)
362     (make-box-markup
363      (make-column-markup
364       (make-justified-lines-markup-list text))))))
366 #(define-markup-command (after-system layout props arg) (markup?)
367    (let ((stencil (interpret-markup layout props arg)))
368      (ly:make-stencil (ly:stencil-expr (ly:stencil-aligned-to stencil Y DOWN))
369                       (ly:stencil-extent stencil X)
370                       '(1 . -1))))
372 %%% Guile does not deal with accented letters
373 #(use-modules (ice-9 regex))
374 %%;; actually defined below, in a closure
375 #(define-public string-upper-case #f)
376 #(define accented-char-upper-case? #f)
377 #(define accented-char-lower-case? #f)
379 %%;; an accented character is seen as two characters by guile
380 #(let ((lower-case-accented-string "éèêëáàâäíìîïóòôöúùûüçœæ")
381        (upper-case-accented-string "ÉÈÊËÁÀÂÄÍÌÎÏÓÒÔÖÚÙÛÜÇŒÆ"))
382    (define (group-by-2 chars result)
383       (if (or (null? chars) (null? (cdr chars)))
384           (reverse! result)
385           (group-by-2 (cddr chars)
386                       (cons (string (car chars) (cadr chars))
387                             result))))
388    (let ((lower-case-accented-chars
389           (group-by-2 (string->list lower-case-accented-string) (list)))
390          (upper-case-accented-chars
391           (group-by-2 (string->list upper-case-accented-string) (list))))
392      (set! string-upper-case
393            (lambda (str)
394              (define (replace-chars str froms tos)
395                (if (null? froms)
396                    str
397                    (replace-chars (regexp-substitute/global #f (car froms) str
398                                                             'pre (car tos) 'post)
399                                   (cdr froms)
400                                   (cdr tos))))
401              (string-upcase (replace-chars str
402                                            lower-case-accented-chars
403                                            upper-case-accented-chars))))
404      (set! accented-char-upper-case?
405            (lambda (char1 char2)
406              (member (string char1 char2) upper-case-accented-chars string=?)))
407      (set! accented-char-lower-case?
408            (lambda (char1 char2)
409              (member (string char1 char2) lower-case-accented-chars string=?)))))
411 #(define-markup-command (smallCaps layout props text) (markup?)
412   "Turn @code{text}, which should be a string, to small caps.
413 @example
414 \\markup \\small-caps \"Text between double quotes\"
415 @end example"
416   (define (string-list->markup strings lower)
417     (let ((final-string (string-upper-case
418                          (apply string-append (reverse strings)))))
419       (if lower
420           (markup #:fontsize -2 final-string)
421           final-string)))
422   (define (make-small-caps rest-chars currents current-is-lower prev-result)
423     (if (null? rest-chars)
424         (make-concat-markup (reverse! (cons (string-list->markup
425                                               currents current-is-lower)
426                                             prev-result)))
427         (let* ((ch1 (car rest-chars))
428                (ch2 (and (not (null? (cdr rest-chars))) (cadr rest-chars)))
429                (this-char-string (string ch1))
430                (is-lower (char-lower-case? ch1))
431                (next-rest-chars (cdr rest-chars)))
432           (cond ((and ch2 (accented-char-lower-case? ch1 ch2))
433                  (set! this-char-string (string ch1 ch2))
434                  (set! is-lower #t)
435                  (set! next-rest-chars (cddr rest-chars)))
436                 ((and ch2 (accented-char-upper-case? ch1 ch2))
437                  (set! this-char-string (string ch1 ch2))
438                  (set! is-lower #f)
439                  (set! next-rest-chars (cddr rest-chars))))
440           (if (or (and current-is-lower is-lower)
441                   (and (not current-is-lower) (not is-lower)))
442               (make-small-caps next-rest-chars
443                                (cons this-char-string currents)
444                                is-lower
445                                prev-result)
446               (make-small-caps next-rest-chars
447                                (list this-char-string)
448                                is-lower
449                                (if (null? currents)
450                                    prev-result
451                                    (cons (string-list->markup
452                                             currents current-is-lower)
453                                          prev-result)))))))
454   (interpret-markup layout props
455     (if (string? text)
456         (make-small-caps (string->list text) (list) #f (list))
457         text)))
459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
460 %%% Character lists, inline quoted scores, etc.
462 startQuote =
463 #(define-music-function (parser location bar-num) (number?)
464    #{ \override Score.BarNumber #'break-visibility = #'#(#f #f #t)
465       \bar ""
466       \set Score.currentBarNumber = #bar-num #})
468 tinyQuote = {
469   \override Score.StaffSymbol #'staff-space = #(magstep -3)
470   \set Score . fontSize = #-3
471   \override BassFigure.font-size = #-1
474 quoteLayout = \layout {
475   indent = 0
476   ragged-right = ##t
477   \context { \Staff \remove "Time_signature_engraver" }
478   \context { \Voice \override Script #'avoid-slur = #'outside }
479   \context {
480     \Score
481     \override StaffGrouper.staff-staff-spacing.basic-distance = #1
482     \override BarNumber.break-visibility = #'#(#f #f #t)
483   }
486 tinyLayout = \layout {
487   \context {
488     \Score
489     \override StaffSymbol #'staff-space = #(magstep -2)
490     fontSize = #-2
491   }
492   \context { \FiguredBass \override BassFigure.font-size = #-2 }
495 tinyQuoteLayout = \layout {
496   \quoteLayout
497   \context {
498     \Score
499     \override StaffSymbol #'staff-space = #(magstep -3)
500     fontSize = #-3
501   }
502   \context { \FiguredBass \override BassFigure.font-size = #-3 }
505 quoteEmptyLayout = \layout {
506   indent = 0
507   ragged-right = ##t
508   \context { \Score skipBars = ##t }
509   \context {
510     \Staff
511     \remove "Time_signature_engraver"
512     \remove "Clef_engraver"
513     \remove "Staff_symbol_engraver"
514     \override MultiMeasureRest #'expand-limit = #2
515   }
518 smallLayout = \layout {
519   \context {
520     \Staff fontSize = #-1
521     \override StaffSymbol.staff-space = #(magstep -1)
522   }
523   \context { \Lyrics fontSize = #-1 }
524   \context { \FiguredBass \override BassFigure.font-size = #-1 }
525   \context { \Voice \override Script.avoid-slur = #'outside }
526   \context { \CueVoice \override Script.avoid-slur = #'outside }
527   \context {
528     \Score
529     \override NonMusicalPaperColumn.line-break-permission = #'allow
530     \override NonMusicalPaperColumn.page-break-permission = #'allow
531   }
534 onlyNotesLayout = \layout {
535   indent = 0
536   \context {
537     \Staff
538     \remove "Time_signature_engraver"
539     \remove "Clef_engraver"
540     \remove "Staff_symbol_engraver"
541   }
542   \context { \Score \remove "Bar_number_engraver" }
545 #(define-markup-command (character-ambitus layout props old-clef new-clef ambitus)
546      (string? string? ly:music?)
547    (let* ((low-pitch (ly:music-property
548                       (car (ly:music-property ambitus 'elements))
549                       'pitch))
550           (high-pitch (ly:music-property
551                        (cadr (ly:music-property ambitus 'elements))
552                        'pitch))
553           (chord (make-music
554                   'EventChord
555                   'elements (list (make-music
556                                    'NoteEvent
557                                    'duration (ly:make-duration 2 0 1 1)
558                                    'pitch low-pitch)
559                                   (make-music
560                                    'NoteEvent
561                                    'duration (ly:make-duration 2 0 1 1)
562                                    'pitch high-pitch))))
563           (score #{ \markup { \null \raise#1 \score {
564   \new Staff {
565     \clef $old-clef s8
566     \set Staff.forceClef = ##t \clef $new-clef s8
567     $chord
568   }
569   \layout {
570     \quoteLayout
571     line-width = #14
572     ragged-right = ##f
573     \context {
574       \Staff
575       \override Clef #'full-size-change = ##t
576       \remove "Bar_engraver"
577     }
578     \context {
579       \Voice
580       \remove "Stem_engraver"
581     }
582     \context {
583       \Score
584       \override StaffSymbol #'staff-space = #(magstep -2)
585       fontSize = #-2
586       \override NonMusicalPaperColumn #'line-break-permission = ##f
587     }
588   }
589 } \hspace#1 } #})
590                  (score-stencil (interpret-markup layout props score)))
591           (ly:make-stencil (ly:stencil-expr score-stencil)
592                            (ly:stencil-extent score-stencil X)
593                            '(-2.5 . 4.5))))
595 #(define-markup-command (character-two-columns layout props col1 col2)
596      (markup? markup?)
597    #:properties ((word-space 0.6)
598                  (character-width-ratio 10/30)
599                  (ambitus-width-ratio 4/30))
600    (interpret-markup
601     layout props
602     #{ \markup
603        \override #`(character-width-ratio . ,character-width-ratio)
604        \override #`(ambitus-width-ratio . ,ambitus-width-ratio)
605        \fill-line {
606          \null
607          \override #`(word-space . ,word-space) $col1
608          \hspace #3
609          \override #`(word-space . ,word-space) $col2
610          \null
611        } #}))
613 #(define-markup-command (character-three-columns layout props col1 col2 col3)
614      (markup? markup? markup?)
615    #:properties ((word-space 0.6))
616    (interpret-markup
617     layout props
618     (markup (#:concat (#:override `(word-space . ,word-space) col1
619                                   #:hspace 3
620                                   #:override `(word-space . ,word-space) col2
621                                   #:hspace 3
622                                   #:override `(word-space . ,word-space) col3)))))
624 #(define-markup-command (sline layout props args) (markup-list?)
625    (interpret-markup layout props
626                      (make-line-markup (cons (make-hspace-markup 4) args))))
628 %% Verse margins
629 #(define-markup-command (verse layout props syllab-count words)
630      (number? markup-list?)
631    (interpret-markup
632     layout props
633     (if (< syllab-count 12)
634         (make-line-markup (cons (make-hspace-markup (* 1.5 (- 12 syllab-count)))
635                                 words))
636         (make-line-markup words))))
639 %%% Foot notes
640 \paper {
641   footnote-auto-numbering = ##t
642   footnote-numbering-function =
643   #(lambda (num)
644      (markup #:small #:box (number->string (+ 1 num))))
645   footnote-separator-markup = \markup\override #'(span-factor . 1/4) \draw-hline
646   footnote-padding = 2\mm
647   footnote-footer-padding = 1\mm
650 #(define (make-footnote-here-music offset note)
651    (make-music 'FootnoteEvent
652                'X-offset (car offset)
653                'Y-offset (cdr offset)
654                'automatically-numbered #t
655                'text (make-null-markup)
656                'footnote-text note))
657 footnoteHere =
658 #(define-music-function (parser this-location offset note)
659      (number-pair? markup?)
660      (set! location #f)
661    #{ <>-\tweak footnote-music #(make-footnote-here-music offset note)
662        ^\markup\transparent\box "1" #})
664 footnoteHereFull =
665 #(define-music-function (parser this-location offset note)
666      (number-pair? markup?)
667    (set! location #f)
668    (if (symbol? (ly:get-option 'part))
669        (make-music 'Music 'void #t)
670        #{ <>-\tweak footnote-music #(make-footnote-here-music offset note)
671           ^\markup\transparent\box "1" #}))
673 footnoteHereNoSpace =
674 #(define-music-function (parser this-location offset note)
675      (number-pair? markup?)
676      (set! location #f)
677      #{ <>-\tweak footnote-music #(make-footnote-here-music offset note)
678         ^\markup\null #})
681 textSpanner =
682 #(define-music-function (parser this-location text)
683      (markup?)
684    #{
685 \once\override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER
686 \once\override TextSpanner.bound-details.left.text =
687 \markup\whiteout { $text \hspace #1 }
688 \once\override TextSpanner.bound-details.left-broken.text = \markup\transparent t %##f