]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/horizontally-aligning-custom-dynamics-e.g.-sempre-pp,-piu-f,-subito-p.ly
d55e49707cf8b86c83e048b6ef3530795d41ac9d
[lilypond.git] / Documentation / snippets / horizontally-aligning-custom-dynamics-e.g.-sempre-pp,-piu-f,-subito-p.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.14.2"
8
9 \header {
10   lsrtags = "expressive-marks, tweaks-and-overrides, correction-wanted, version-specific"
11
12 %% Translation of GIT committish: 57f9346bb030f49336a858fcbf1519366fe56454
13   texidocfr = "
14 Certaines indication de nuance requièrent un complément textuel, comme
15 « sempre pp ».  Dans la mesure où les nuances sont habituellement
16 centrées sous la note, le @emph{pp} se trouvera repoussé loin après la
17 note à laquelle il s'applique.
18
19 Différentes approches permettent de correctement aligner horizontalement
20 ce « sempre pp » :
21
22 -- Un simple @code{\\once \\override DynamicText #'X-offset = #-9.2}
23    avant la note considérée de telle sorte que la nuance soit décalée
24    manuellement à la bonne place.  Inconvénient : il faut le faire
25    manuellement à chaque fois qu'intervient ce @emph{markup}.
26
27 -- L'intégration d'un rembourrage (@code{#:hspace 7.1}) à la définition
28    de cette nuance personnalisée afin qu'une fois centrée par lilypond
29    elle soit correctement alignée.  Inconvénient : le rembourrage
30    occupera exactement cet espace et ne permettra à aucun autre
31    @emph{markup} ou nuance d'apparaître à cet endroit.
32
33 -- L'application d'un décalage au script de nuance
34    @code{\\once \\override @dots{} #'X-offset = @dots{}}.
35    Inconvénient : là aussi il faut le faire à chaque fois.
36
37 -- L'attribution arbitraire d'une dimension à 0 du texte additionnel à
38    l'aide d'un @code{#:with-dimensions '(0 . 0) '(0 . 0)}.
39    Inconvénient : lilypond considère que « sempre » n'occupe pas
40    d'espace, et donc pourra mettre à cet endroit d'autres éléments, ce
41    qui pourrait générer des collisions qui ne seront pas détectées par
42    les routines @emph{ad hoc}.  D'autre part, il semble persister un
43    espacement, ce qui laisse l'impression d'un alignement différent en
44    l'absence de texte additionnel.
45
46 -- L'ajout, explicite, du décalage directement dans la fonction Scheme
47    du script de nuance.
48
49 -- La définition d'un alignement explicite au sein du script de nuance.
50    Ceci ne sera suivi d'effet, par défaut, qu'en jouant sur
51    @code{X-offset}.  Inconvénient : il faut définir
52    @code{DynamicText #'X-offset}, ce qui s'appliquera à toutes les
53    nuances textuelles.  Par ailleurs, l'alignement sera réalisé sur le
54    bord droit du texte additionnel, non sur le milieu de @emph{pp}.
55
56 "
57   doctitlefr = "Alignement de nuances personnalisées comme \"sempre pp\" \"più f\" \"subito p\""
58
59   texidoc = "
60 Some dynamic expressions involve additional text, like @qq{sempre pp}.
61 Since dynamics are usually centered under the note, the \\pp would be
62 displayed way after the note it applies to.
63
64 To correctly align the @qq{sempre pp} horizontally, so that it is
65 aligned as if it were only the \\pp, there are several approaches:
66
67 * Simply use @code{\\once\\override DynamicText #'X-offset = #-9.2}
68 before the note with the dynamics to manually shift it to the correct
69 position. Drawback: This has to be done manually each time you use that
70 dynamic markup... * Add some padding (@code{#:hspace 7.1}) into the
71 definition of your custom dynamic mark, so that after lilypond
72 center-aligns it, it is already correctly aligned. Drawback: The
73 padding really takes up that space and does not allow any other markup
74 or dynamics to be shown in that position.
75
76 * Shift the dynamic script @code{\\once\\override ... #'X-offset = ..}.
77 Drawback: @code{\\once\\override} is needed for every invocation!
78
79 * Set the dimensions of the additional text to 0 (using
80 @code{#:with-dimensions '(0 . 0) '(0 . 0)}). Drawback: To LilyPond
81 @qq{sempre} has no extent, so it might put other stuff there and create
82 collisions (which are not detected by the collision detection!). Also,
83 there seems to be some spacing, so it's not exactly the same alignment
84 as without the additional text
85
86 * Add an explicit shifting directly inside the scheme function for the
87 dynamic-script.
88
89 * Set an explicit alignment inside the dynamic-script. By default, this
90 won't have any effect, only if one sets X-offset! Drawback: One needs
91 to set @code{DynamicText #'X-offset}, which will apply to all dynamic
92 texts! Also, it is aligned at the right edge of the additional text,
93 not at the center of pp.
94
95
96
97
98 "
99   doctitle = "Horizontally aligning custom dynamics (e.g. \"sempre pp\" \"piu f\" \"subito p\")"
100 } % begin verbatim
101
102
103 \header { title = "Horizontally aligning custom dynamics" }
104
105 \paper { ragged-right = ##f }
106
107 % Solution 1: Using a simple markup with a particular halign value
108 % Drawback: It's a markup, not a dynamic command, so \dynamicDown
109 %           etc. will have no effect
110 semppMarkup = \markup { \halign #1.4 \italic "sempre" \dynamic "pp" }
111
112 % Solution 2: Using a dynamic script & shifting with
113 %             \once \override ... #'X-offset = ..
114 % Drawback: \once \override needed for every invocation
115 semppK =
116 #(make-dynamic-script
117   (markup #:line
118           (#:normal-text
119            #:italic "sempre"
120            #:dynamic "pp")))
121
122 % Solution 3: Padding the dynamic script so the center-alignment
123 %             puts it at the correct position
124 % Drawback: the padding really reserves the space, nothing else can be there
125 semppT =
126 #(make-dynamic-script
127   (markup #:line
128           (#:normal-text
129            #:italic "sempre"
130            #:dynamic "pp"
131            #:hspace 7.1)))
132
133 % Solution 4: Dynamic, setting the dimensions of the additional text to 0
134 % Drawback: To lilypond "sempre" has no extent, so it might put
135 %           other stuff there => collisions
136 % Drawback: Also, there seems to be some spacing, so it's not exactly the
137 %           same alignment as without the additional text
138 semppM =
139 #(make-dynamic-script
140   (markup #:line
141           (#:with-dimensions '(0 . 0) '(0 . 0)
142                              #:right-align
143                              #:normal-text
144                              #:italic "sempre"
145                              #:dynamic "pp")))
146
147 % Solution 5: Dynamic with explicit shifting inside the scheme function
148 semppG =
149 #(make-dynamic-script
150   (markup #:hspace 0
151           #:translate '(-18.85 . 0)
152           #:line (#:normal-text
153                   #:italic "sempre"
154                   #:dynamic "pp")))
155
156 % Solution 6: Dynamic with explicit alignment. This has only effect
157 %             if one sets X-offset!
158 % Drawback: One needs to set DynamicText #'X-offset!
159 % Drawback: Aligned at the right edge of the additional text,
160 %           not at the center of pp
161 semppMII =
162 #(make-dynamic-script
163   (markup #:line (#:right-align
164                   #:normal-text
165                   #:italic "sempre"
166                   #:dynamic "pp")))
167
168 \context StaffGroup <<
169   \context Staff = "s" <<
170     \set Staff.instrumentName = #"Normal"
171     \relative c'' {
172       \key es \major
173       c4\pp c\p c c | c\ff c c\pp c
174     }
175   >>
176   \context Staff = "sMarkup" <<
177     \set Staff.instrumentName = \markup \column { Normal markup }
178     \relative c'' {
179       \key es \major
180       c4-\semppMarkup c\p c c | c\ff c c-\semppMarkup c
181     }
182   >>
183   \context Staff = "sK" <<
184     \set Staff.instrumentName = \markup \column { Explicit shifting }
185     \relative c'' {
186       \key es \major
187       \once \override DynamicText #'X-offset = #-9.2
188       c4\semppK c\p c c
189       c4\ff c
190       \once \override DynamicText #'X-offset = #-9.2
191       c4\semppK c
192     }
193   >>
194   \context Staff = "sT" <<
195     \set Staff.instrumentName = \markup \column { Right padding }
196     \relative c'' {
197       \key es \major
198       c4\semppT c\p c c | c\ff c c\semppT c
199     }
200   >>
201   \context Staff = "sM" <<
202     \set Staff.instrumentName = \markup \column { Setting dimension "to zero" }
203     \relative c'' {
204       \key es \major
205       c4\semppM c\p c c | c\ff c c\semppM c
206     }
207   >>
208   \context Staff = "sG" <<
209     \set Staff.instrumentName = \markup \column { Shifting inside dynamics }
210     \relative c'' {
211       \key es \major
212       c4\semppG c\p c c | c\ff c c\semppG c
213     }
214   >>
215   \context Staff = "sMII" <<
216     \set Staff.instrumentName = \markup \column { Alignment inside dynamics }
217     \relative c'' {
218       \key es \major
219       % Setting to ##f (false) gives the same result
220       \override DynamicText #'X-offset = #0
221       c4\semppMII c\p c c | c\ff c c\semppMII c
222     }
223   >>
224 >>
225