Update .ly files.
[lilypond.git] / input / regression / incipit.ly
blob31d9e6f252d66609a15f4ffa8384c0e536de3477
1 \header {
3 texidoc = "Incipit can be printed using an InstrumentName grob."
7 \version "2.12.0"
9 %% to avoid warnings:
10 #(set-object-property! 'music 'backend-type? ly:music?)
11 #(set-object-property! 'music 'backend-doc "Incipit music")
13 \score {
14 \new Staff {
15 %% All this would be shortcuted by an appropriate music function:
16 \override Staff.InstrumentName #'music = ##{ \clef "petrucci-c1" c'4 d' e' f' #}
17 \override Staff.InstrumentName #'self-alignment-X = #RIGHT
18 \override Staff.InstrumentName #'self-alignment-Y = #UP
19 \override Staff.InstrumentName #'Y-offset = #4
20 \override Staff.InstrumentName #'padding = #0
21 \override Staff.InstrumentName #'stencil =
22 #(lambda (grob)
23 (let* ((instrument-name (ly:grob-property grob 'long-text))
24 (layout (ly:output-def-clone (ly:grob-layout grob)))
25 (music (make-music 'SequentialMusic
26 'elements (list (make-music 'ContextSpeccedMusic
27 'context-type 'MensuralStaff
28 'element (make-music 'PropertySet
29 'symbol 'instrumentName
30 'value instrument-name))
31 (ly:grob-property grob 'music))))
32 (score (ly:make-score music))
33 (mm (ly:output-def-lookup layout 'mm))
34 (indent (ly:output-def-lookup layout 'indent))
35 (incipit-width (ly:output-def-lookup layout 'incipit-width))
36 (scaled-incipit-width (if (number? incipit-width)
37 (* incipit-width mm)
38 (* indent 0.5))))
39 (ly:output-def-set-variable! layout 'indent (- indent scaled-incipit-width))
40 (ly:output-def-set-variable! layout 'line-width indent)
41 (ly:output-def-set-variable! layout 'ragged-right #f)
42 (ly:score-add-output-def! score layout)
43 (set! (ly:grob-property grob 'long-text)
44 (markup #:score score))
45 (ly:system-start-text::print grob)))
47 %% the instrument name definition is separated:
48 \set Staff.instrumentName = \markup Instrument
49 c'4 d' e' f' g'1
51 \layout {
52 ragged-right = ##t
53 indent = 5\cm
54 incipit-width = 3 \cm