]> git.donarmstrong.com Git - lilypond.git/blob - input/new/center-text-below-hairpin-dynamics.ly
Merge commit 'origin' into beamlets2
[lilypond.git] / input / new / center-text-below-hairpin-dynamics.ly
1 \version "2.12.0"
2
3 \header {
4   lsrtags = "expressive-marks, text"
5
6   texidoc = "
7 This example provides a function to typeset a hairpin (de)crescendo
8 with some additional text below it, such as \"molto\" or \"poco\". The
9 example also illustrates how to modify the way an object is normally
10 printed, using some Scheme code.
11 "
12   doctitle = "Center text below hairpin dynamics"
13 }
14
15 hairpinWithCenteredText =
16 #(define-music-function (parser location text) (markup?)
17 #{
18   \override Voice.Hairpin #'stencil = #(lambda (grob)
19     (ly:stencil-aligned-to
20      (ly:stencil-combine-at-edge
21       (ly:stencil-aligned-to (ly:hairpin::print grob) X CENTER)
22       Y DOWN
23       (ly:stencil-aligned-to (grob-interpret-markup grob $text) X CENTER))
24      X LEFT))
25 #})
26
27 hairpinMolto = \hairpinWithCenteredText \markup { \italic molto }
28 hairpinMore = \hairpinWithCenteredText \markup { \larger moltissimo }
29
30 \layout { ragged-right = ##f }
31
32 {
33   \hairpinMolto c'2\< c'\f
34   \hairpinMore  c'2\< c'\f
35 }