4 texidoc = "Incipits can be printed using an @code{InstrumentName}
8 %% to prevent warnings/programming errors:
10 (set-object-property! 'music 'backend-type? ly:music?)
11 (set-object-property! 'music 'backend-doc "Incipit music")
12 (ly:add-interface 'incipit-interface "An incipit." '(music))
13 (let* ((instrument-def (assoc 'InstrumentName all-grob-descriptions))
14 (meta-def (assoc 'meta (cdr instrument-def)))
15 (interfaces-def (assoc 'interfaces (cdr meta-def)))
16 (interfaces (cdr interfaces-def)))
17 (set-cdr! interfaces-def (cons 'incipit-interface interfaces))))
21 %% All this would be shortcuted by an appropriate music function:
22 \override Staff.InstrumentName.music = ##{ \clef "petrucci-c1" c'4 d' e' f' #}
23 \override Staff.InstrumentName.self-alignment-X = #RIGHT
24 \override Staff.InstrumentName.padding = #0
25 \override Staff.InstrumentName.stencil =
27 (let* ((instrument-name (ly:grob-property grob 'long-text))
28 (layout (ly:output-def-clone (ly:grob-layout grob)))
29 (music (make-sequential-music
30 (list (context-spec-music
31 (make-sequential-music
32 (list (make-property-set
33 'instrumentName instrument-name)
34 (make-grob-property-set
36 'Y-extent '(-4 . 4))))
38 (ly:grob-property grob 'music))))
39 (score (ly:make-score music))
40 (indent (ly:output-def-lookup layout 'indent))
41 (incipit-width (ly:output-def-lookup layout 'incipit-width
43 (ly:output-def-set-variable! layout 'indent (- indent incipit-width))
44 (ly:output-def-set-variable! layout 'line-width indent)
45 (ly:output-def-set-variable! layout 'ragged-right #f)
46 (ly:score-add-output-def! score layout)
47 (set! (ly:grob-property grob 'long-text)
48 (markup #:score score))
49 (system-start-text::print grob)))
51 %% the instrument name definition is separated:
52 \set Staff.instrumentName = #"Instrument"