]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/incipit.ly
Doc-es: various updates.
[lilypond.git] / input / regression / incipit.ly
1 \version "2.18.0"
2
3 \header {
4   texidoc = "Incipits can be printed using an @code{InstrumentName}
5 grob."
6 }
7
8 \score {
9   \new Staff {
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 =
15       #(lambda (grob)
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' }
21                           #})
22                 (score (ly:make-score music))
23                 (indent (ly:output-def-lookup layout 'indent))
24                 (incipit-width (ly:output-def-lookup layout 'incipit-width
25                  (* indent 0.5))))
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)))
33
34     %% the instrument name definition is separated:
35     \set Staff.instrumentName = #"Instrument"
36     c'4 d' e' f'
37     g'1
38   }
39   \layout {
40     indent = 5\cm
41     incipit-width = 3\cm
42   }
43 }