]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/center-text-below-hairpin-dynamics.ly
77e171d7765e15357cd2b6235116144f1568784e
[lilypond.git] / Documentation / snippets / center-text-below-hairpin-dynamics.ly
1 %% DO NOT EDIT this file manually; it is automatically
2 %% generated from LSR http://lsr.dsi.unimi.it
3 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
4 %% and then run scripts/auxiliar/makelsr.py
5 %%
6 %% This file is in the public domain.
7 \version "2.15.43"
8
9 \header {
10   lsrtags = "expressive-marks, really-cool, scheme-language, text"
11
12   texidoc = "
13 This example provides a function to typeset a hairpin (de)crescendo
14 with some additional text below it, such as @qq{molto} or @qq{poco}.
15 The example also illustrates how to modify the way an object is
16 normally printed, using some Scheme code.
17
18 "
19   doctitle = "Center text below hairpin dynamics"
20 } % begin verbatim
21
22
23 hairpinWithCenteredText =
24 #(define-music-function (parser location text) (markup?)
25 #{
26   \override Voice.Hairpin #'stencil = #(lambda (grob)
27     (ly:stencil-aligned-to
28      (ly:stencil-combine-at-edge
29       (ly:stencil-aligned-to (ly:hairpin::print grob) X CENTER)
30       Y DOWN
31       (ly:stencil-aligned-to (grob-interpret-markup grob text) X CENTER))
32      X LEFT))
33 #})
34
35 hairpinMolto = \hairpinWithCenteredText \markup { \italic molto }
36 hairpinMore = \hairpinWithCenteredText \markup { \larger moltissimo }
37
38 \layout { ragged-right = ##f }
39
40 \relative c' {
41   \hairpinMolto
42   c2\< c\f
43   \hairpinMore
44   c2\< c\f
45 }