4 texidoc = "Incipits can be printed using an @code{InstrumentName}
10 %% All this would be shortcuted by an appropriate music function:
11 \override Staff.InstrumentName.self-alignment-X = #RIGHT
12 \override Staff.InstrumentName.self-alignment-Y = ##f
13 \override Staff.InstrumentName.padding = #0
14 \override Staff.InstrumentName.stencil =
16 (let* ((instrument-name (ly:grob-property grob 'long-text))
17 (layout (ly:output-def-clone (ly:grob-layout grob)))
18 (music #{ \new MensuralStaff
19 \with { instrumentName = #instrument-name }
20 { \clef "petrucci-c1" c'4 d' e' f' }
22 (score (ly:make-score music))
23 (indent (ly:output-def-lookup layout 'indent))
24 (incipit-width (ly:output-def-lookup layout 'incipit-width
26 (ly:output-def-set-variable! layout 'indent (- indent incipit-width))
27 (ly:output-def-set-variable! layout 'line-width indent)
28 (ly:output-def-set-variable! layout 'ragged-right #f)
29 (ly:score-add-output-def! score layout)
30 (set! (ly:grob-property grob 'long-text)
31 (markup #:score score))
32 (system-start-text::print grob)))
34 %% the instrument name definition is separated:
35 \set Staff.instrumentName = #"Instrument"