1 %% DO NOT EDIT this file manually; it is automatically
2 %% generated from LSR http://lsr.di.unimi.it
3 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
4 %% and then run scripts/auxiliar/makelsr.py
6 %% This file is in the public domain.
10 lsrtags = "expressive-marks, really-cool, scheme-language, text"
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 added text will change the direction according to the direction of
16 the hairpin. The Hairpin is aligned to DynamicText.
18 The example also illustrates how to modify the way an object is
19 normally printed, using some Scheme code.
22 doctitle = "Center text below hairpin dynamics"
25 hairpinWithCenteredText =
26 #(define-music-function (text) (markup?)
28 \once \override Voice.Hairpin.after-line-breaking =
30 (let* ((stencil (ly:hairpin::print grob))
31 (par-y (ly:grob-parent grob Y))
32 (dir (ly:grob-property par-y 'direction))
33 (new-stencil (ly:stencil-aligned-to
34 (ly:stencil-combine-at-edge
35 (ly:stencil-aligned-to stencil X CENTER)
37 (ly:stencil-aligned-to
38 (grob-interpret-markup grob text) X CENTER))
40 (staff-space (ly:output-def-lookup
41 (ly:grob-layout grob) 'staff-space))
43 (ly:output-def-lookup (ly:grob-layout grob) 'line-thickness))
44 (par-x (ly:grob-parent grob X))
45 (dyn-text (grob::has-interface par-x 'dynamic-text-interface))
46 (dyn-text-stencil-x-length
49 (ly:stencil-extent (ly:grob-property par-x 'stencil) X))
54 (+ staff-space dyn-text-stencil-x-length)
55 (* 0.5 staff-line-thickness)) 0)))
57 (ly:grob-set-property! grob 'Y-offset 0)
58 (ly:grob-set-property! grob 'stencil
59 (ly:stencil-translate-axis
65 \hairpinWithCenteredText \markup { \italic molto }
68 \hairpinWithCenteredText \markup { \larger moltissimo }
70 \layout { ragged-right = ##f }