]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/ja/notation/changing-defaults.itely
Doc-ja: update NR and fix links
[lilypond.git] / Documentation / ja / notation / changing-defaults.itely
1 @c -*- coding: utf-8; mode: texinfo; documentlanguage: ja -*-
2
3 @ignore
4     Translation of GIT committish: 6647daf0d6c8459d2b52bfc3a2a40bad4672fc7a
5
6     When revising a translation, copy the HEAD committish of the
7     version that you are working on.  For details, see the Contributors'
8     Guide, node Updating translation committishes..
9 @end ignore
10
11 @c \version "2.15.20"
12
13 @c Translators: Yoshiki Sawada
14 @c Translation status: post-GDP
15
16 @node デフォルトを変更する
17 @chapter デフォルトを変更する
18 @translationof Changing defaults
19
20 LilyPond はデフォルトで最高品質の出力を提供できるよう設計されています。@c
21 それにもかかわらず、@c
22 デフォルトのレイアウトを変更する必要が発生する場合もあります。@c
23 レイアウトは、@q{プロパティ} と呼ばれる多数の @q{つまみとスイッチ} によって@c
24 制御されています。@c
25 これらのプロパティにアクセスし、変更するための手引は学習マニュアルの中にあります
26 -- @rlearning{出力を調整する} を参照してください。@c
27 まずはこれを読むべきです。@c
28 本章は同様の内容をカバーしていますが、@c
29 よりリファレンス マニュアルに適したスタイルで提供します。
30
31 @cindex Internals Reference (内部リファレンス)
32
33 調整のために利用できる制御の定義についての説明は、@c
34 別のドキュメントの中にあります: @rinternalsnamed{Top,内部リファレンス} です。@c
35 このマニュアルは利用可能なすべての変数、関数、それにオプションを@c
36 リストアップしています。@c
37 これは HTML ドキュメントとして記述されていて、@c
38 @uref{http://@/lilypond@/.org/@/doc/@/stable/@/Documentation/@/internals/,オンライン}
39 で入手可能であり、@c
40 LilyPond ドキュメント パッケージにも含まれています。
41
42 内部的には、LilyPond は Scheme (LISP 派生語) を用いて機能を提供しています。@c
43 レイアウトについての決定をオーバライドすることは、@c
44 プログラムの内部にアクセスすることであり、@c
45 Scheme 入力が必要になります。@c
46 Scheme の要素は、@code{.ly} の中で、@c
47 ハッシュ記号 @code{#} を付けて記述します。@footnote{@rextend{Scheme tutorial}
48 の中に、Scheme 形式で数、リスト、文字列、それに記号を入力するための@c
49 簡単な手引きがあります。}
50
51
52 @menu
53 * コンテキストを理解する::
54 * 内部リファレンスの説明::
55 * プロパティを変更する::
56 * 役に立つコンセプトとプロパティ::
57 * 高度な調整::
58 * 音楽関数を使用する::
59 @end menu
60
61
62 @node コンテキストを理解する
63 @section コンテキストを理解する
64 @translationof Interpretation contexts
65
66 このセクションでは、コンテキストとは何なのか、@c
67 それをどのように変更するのかについて説明します。
68
69 @menu
70 * コンテキストの説明::
71 * コンテキストを作成する::
72 * コンテキストを残しておく::
73 * コンテキストのプラグインを変更する::
74 * コンテキストのデフォルト設定を変更する::
75 * 新しいコンテキストを定義する::
76 * コンテキストの配置順序::
77 @end menu
78
79 @seealso
80 学習マニュアル:
81 @rlearning{コンテキストとエングラーバ}
82
83 インストールされているファイル:
84 @file{ly/@/engraver@/-init@/.ly},
85 @file{ly/@/performer@/-init@/.ly}
86
87 コード断片集:
88 @rlsr{Contexts and engravers}
89
90 内部リファレンス:
91 @rinternals{Contexts},
92 @rinternals{Engravers and Performers}
93
94
95 @node コンテキストの説明
96 @subsection コンテキストの説明
97 @translationof Contexts explained
98
99 @ignore
100 @c TODO Rethink and rewrite
101
102 >> > > - list of contexts: my *danger unmaintainable*
103 >> > > alarm just went off.  I'm
104
105 I knew it would... And leaving out some of them is perfectly fine
106 with me.
107 I do think that a list like this, with the main contexts and a
108 brief
109 description of  what they do (perhaps also with a note about what
110 default
111 behavior is associated with each of them, but this may be
112 unmanageable),
113 should be there, and then we could simply list the remaining ones
114 without
115 further explanation and with links to the IR.
116 @end ignore
117
118 @c TODO Improve layout, order and consistency of wording -td
119
120 @c TODO Add introduction which explains contexts in generality  -td
121
122 @c TODO Describe propagation of property values -td
123
124 コンテキストは階層的に配置されます:
125
126 @menu
127 * Score - すべてのコンテキストのマスタ::
128 * 上位コンテキスト - 譜コンテナ::
129 * 中位コンテキスト - 譜::
130 * 下位コンテキスト - ボイス::
131 @end menu
132
133 @node Score - すべてのコンテキストのマスタ
134 @unnumberedsubsubsec Score - すべてのコンテキストのマスタ
135 @translationof Score - the master of all contexts
136
137 これは最上位の記譜コンテキストです。@c
138 他のコンテキストが Score コンテキストを保持することはできません。@c
139 デフォルトでは、Score コンテキストが拍子記号の管理を扱い、@c
140 音部記号、拍子記号、調号などのアイテムが譜間で揃っていることを保証します。
141
142 Score コンテキストは、@code{\score @{@dots{}@}} や @code{\layout @{@dots{}@}}
143 ブロックが処理されたときに暗黙的にインスタンス化されます。@c
144 @c また、@code{\new Score} コマンドが実行されたときに@c
145 @c 明示的にインスタンス化されます。
146
147
148 @node 上位コンテキスト - 譜コンテナ
149 @unnumberedsubsubsec 上位コンテキスト - 譜コンテナ
150 @translationof Top-level contexts - staff containers
151
152 @strong{@emph{StaffGroup}}
153
154 譜をグループ化して、左端に角括弧を付けます。@c
155 このコンテキストに保持されている譜の小節線は垂直につながります。@c
156 @code{StaffGroup} は譜のコレクション、@c
157 それに左端の角括弧と延長された小節線だけを保持します。
158
159 @strong{@emph{ChoirStaff}}
160
161 保持されている譜の小節線が垂直につながらないことを除けば、@c
162 @code{StaffGroup} と同じです。
163
164 @strong{@emph{GrandStaff}}
165
166 譜をグループ化して、左端に波括弧を付けます。@c
167 このコンテキストに保持されている譜の小節線は垂直につながります。@c
168
169 @strong{@emph{PianoStaff}}
170
171 @code{GrandStaff} と似ていますが、@c
172 各システムの左端に楽器名を付けることができます。
173
174
175 @node 中位コンテキスト - 譜
176 @unnumberedsubsubsec 中位コンテキスト - 譜
177 @translationof Intermediate-level contexts - staves
178
179 @strong{@emph{Staff}}
180
181 音部記号、小節線、調、臨時記号を扱います。@c
182 このコンテキストは @code{Voice} コンテキストを保持することができます。
183
184 @strong{@emph{RhythmicStaff}}
185
186 @code{Staff} と似ていますが、リズムを表示するためのものです。@c
187 ピッチは無視され、音符は線として表示されます。
188
189 @strong{@emph{TabStaff}}
190
191 タブ譜を生成するためのコンテキストです。@c
192 デフォルトでは、音楽表記を 6 線のギター タブ譜として配置します。
193
194 @strong{@emph{DrumStaff}}
195
196 打楽器の譜刻を扱います。@c
197 @code{DrumVoice} を保持することができます。
198
199 @strong{@emph{VaticanaStaff}}
200
201 @code{Staff} と同じですが、@c
202 グレゴリア形式の楽曲を譜刻するためにデザインされている点が異なります。
203
204 @strong{@emph{MensuralStaff}}
205
206 @code{Staff} と同じでが、@c
207 定量形式の楽曲を譜刻するためにデザインされている点が異なります。
208
209 @node 下位コンテキスト - ボイス
210 @unnumberedsubsubsec 下位コンテキスト - ボイス
211 @translationof Bottom-level contexts - voices
212
213 Voice レベルのコンテキストはある特定のプロパティを初期化し、@c
214 適切なエングラーバを開始させます。@c
215 下位コンテキストであるため、他のコンテキストを保持することはできません。
216
217 @strong{@emph{Voice}}
218
219 譜の上にあるボイスに相当します。@c
220 このコンテキストは、強弱記号、符幹、連桁、上付き/下付き文字、タイ、@c
221 それに休符の変換を扱います。@c
222 1 つの譜に複数のボイスを配置する必要がある場合、@c
223 ボイスを明示的にインスタンス化する必要があります。
224
225 @strong{@emph{VaticanaVoice}}
226
227 @code{Voice} と同じですが、@c
228 グレゴリア形式の楽曲を譜刻するためにデザインされている点が異なります。
229
230 @strong{@emph{MensuralVoice}}
231
232 @code{Voice} と同じですが、@c
233 定量形式の楽曲を譜刻するためにデザインされている点が異なります。
234
235 @strong{@emph{Lyrics}}
236
237 歌詞を保持するボイスに相当します。単一行の歌詞の表示を扱います。
238
239 @strong{@emph{DrumVoice}}
240
241 打楽器譜で使用されるボイス コンテキストです。
242
243 @strong{@emph{FiguredBass}}
244
245 このコンテキストの中で、@c
246 @code{\figuremode} モードで記述された入力から
247 @code{BassFigure} オブジェクトが作成されます。
248
249 @strong{@emph{TabVoice}}
250
251 @code{TabStaff} コンテキスト内部で使用されるボイス コンテキストです。@c
252 通常、暗黙的に作成されます。
253
254 @strong{@emph{CueVoice}}
255
256 小さなサイズの音符を描画するために使用されるボイス コンテキストです。@c
257 主に合図音符を譜に付け加えることを目的としています。@c
258 @ref{合図音符をフォーマットする} を参照してください。@c
259 通常、暗黙的に作成されます。
260
261 @strong{@emph{ChordNames}}
262
263 コード ネームを譜刻します。
264
265 @ignore
266 TODO
267
268 Then the following, which I don't know what to do with:
269
270     * GregorianTranscriptionVoice
271     * GregorianTranscriptionStaff
272
273     * FretBoards
274         Engraves fretboards from chords. Not easy... Not
275 documented.
276         There is now some documentation on FretBoards in the NR, under
277          instrument-specific notation -- cds.
278
279     * NoteNames
280
281     * Global
282         Hard coded entry point for LilyPond. Cannot be tuned.
283     * Devnull
284         Silently discards all musical information given to this
285 context.
286
287 @end ignore
288
289 @node コンテキストを作成する
290 @subsection コンテキストを作成する
291 @translationof Creating contexts
292
293 @c TODO more complete descriptions rather than learning style
294
295 ボイスと譜が 1 つだけの楽譜では、コンテキストは自動的に作成されます。@c
296 もっと複雑な楽譜では、手動でコンテキストを作成する必要があります。@c
297 コンテキスを作成するために 3 つのコマンドがあります。
298
299 @itemize
300
301 @item
302 もっとも簡単なコマンドは @code{\new} であり、@c
303 もっとも素早く入力できるコマンドでもあります。@c
304 このコマンドは音楽表記の前に置きます。例えば、以下のように:
305
306 @funindex \new
307 @cindex new contexts (新しいコンテキスト)
308 @cindex Context, creating (コンテキストを作成する)
309
310 @example
311 \new @var{type} @var{music expression}
312 @end example
313
314 @noindent
315 ここで、@var{type} はコンテキスト名 (@code{Staff} や @code{Voice} など) です。@c
316 このコマンドは新しいコンテキストを作成し、@c
317 そのコンテキストに付属する @var{音楽表記} の解釈を開始します。
318
319 @code{\new} の実際的な使用例には、多くの譜を持つ楽譜があります。@c
320 それぞれの譜に配置される各パートの前に @code{\new Staff} を記述します。
321
322 @lilypond[quote,verbatim,relative=2,ragged-right,fragment]
323 <<
324   \new Staff { c4 c }
325   \new Staff { d4 d }
326 >>
327 @end lilypond
328
329 @code{\new} コマンドは、コンテキストに名前を与えることもできます:
330
331 @example
332 \new @var{type} = @var{id} @var{music}
333 @end example
334
335 しかしながら、ユーザが指定したコンテキスト名は、
336 そのコンテキスト以前に同じ名前を与えられたコンテキストが無い場合にのみ、@c
337 使用できます。
338
339
340 @funindex \context
341
342 @item
343 @code{\new} と同様に、@c
344 @code{\context} コマンドも音楽表記をコンテキスト オブジェクトに代入します。@c
345 しかしながら、このコマンドはコンテキストに明示的に名前を与えます。@c
346 構文は以下の通りです:
347
348 @example
349 \context @var{type} = @var{id} @var{music}
350 @end example
351
352 この構文は @var{id} という名前の @var{type} タイプのコンテキストが@c
353 すで存在していないか検索します。@c
354 コンテキストがまだ存在していなければ、@c
355 指定された名前を持つコンテキストが新たに作成されます。@c
356 これは、コンテキストを後で参照する場合に有用です。@c
357 例えば、以下のように名前を付けられたメロディ:
358
359 @example
360 \context Voice = "@b{tenor}" @var{music}
361 @end example
362
363 @noindent
364 に、以下のように歌詞を設定すると、テキストは適切に音符に揃えられます:
365
366 @example
367 \new Lyrics \lyricsto "@b{tenor}" @var{lyrics}
368 @end example
369
370 @noindent
371
372 名前付きコンテキストの他の使用例として、2 つの音楽表記をつなげて
373 1 つのコンテキストにすることができます。@c
374 以下の例では、アーティキュレーションと音符は別々に入力されています:
375
376 @example
377 music = @{ c4 c4 @}
378 arts = @{ s4-. s4-> @}
379 @end example
380
381 これらを同じ @code{Voice} コンテキストに送ることによって@c
382 組み合わせることができます:
383
384 @example
385 <<
386   \new Staff \context Voice = "A" \music
387   \context Voice = "A" \arts
388 >>
389 @end example
390 @lilypond[quote,ragged-right]
391 music = { c4 c4 }
392 arts = { s4-. s4-> }
393 \relative c'' <<
394   \new Staff \context Voice = "A" \music
395   \context Voice = "A" \arts
396 >>
397 @end lilypond
398
399 このメカニズムを用いることで、原典版 (オリジナル版) を定義し、@c
400 オプションとしてそれに異なるアーティキュレーションを付けることができます。
401
402 @cindex creating contexts (コンテキストを作成する)
403
404 @item
405 コンテキストを作成する 3 つ目のコマンドは以下の通りです:
406
407 @example
408 \context @var{type} @var{music}
409 @end example
410
411 @noindent
412 これは @code{= @var{id}} を持つ @code{\context} に似ていますが、@c
413 タイプ @var{type} のすべてのコンテキストに適用されます
414 -- そのコンテキストに与えられた名前とは関係なく適用されます。@c
415
416 この構文の変形版は、@c
417 異なる階層で解釈される可能性がある音楽表記に対して使用されます。@c
418 例えば、@code{\applyOutput} コマンド
419 (@rextend{Running a function on all layout objects} を参照してください)
420 です。@c
421 明示的に @code{\context} を指定しなければ、通常は @code{Voice} に適用されます。
422
423 @example
424 \applyOutput #'@var{context} #@var{function}   % Voice に適用されます
425 @end example
426
427 @code{Score} レベルや @code{Staff} レベルで解釈させるには、以下のようにします:
428
429 @example
430 \applyOutput #'Score #@var{function}
431 \applyOutput #'Staff #@var{function}
432 @end example
433
434 @end itemize
435
436
437 @node コンテキストを残しておく
438 @subsection コンテキストを残しておく
439 @translationof Keeping contexts alive
440
441 @cindex contexts, keeping alive (コンテキストを残しておく)
442 @cindex contexts, lifetime (コンテキストのライフタイム)
443
444 通常、コンテキストは何もすることが無くなった最初の音楽的タイミングで@c
445 消滅させられます。@c
446 そのため、@code{Voice} コンテキストはすべてのイベントを終えるとすぐに消滅し、@c
447 @code{Staff} コンテキストは保持しているすべての @code{Voice} コンテキストの@c
448 イベントが終了するとすぐに消滅する、などとなっています。@c
449 このことは、早い段階のすでに消滅したコンテキスを参照する必要がある場合に、@c
450 障害となります。@c
451 例えば、@code{\change} コマンドで譜を変更する場合、@c
452 @code{\lyricsto} コマンドで歌詞をボイスに結び付ける場合、@c
453 あるいは、早い段階で登場したコンテキストに音楽イベントを追加する場合に@c
454 障害となります。
455
456 この規則には 1 つ例外があります:
457 @code{Staff} コンテキストや @code{<<...>>} 構造の中にある @code{Voice}
458 コンテキストのうち 1 つだけは、例え途中ですることが無くなったとしても、@c
459 @code{Staff} コンテキストあるいは
460 @code{<<...>>} 構造の終わりまで維持されます。@c
461 このように維持されるコンテキストは、最初の @code{@{...@}} 構造の中にある@c
462 最初のコンテキストであり、@code{<<...>>} 構造の中にあるものは無視されます。
463
464 各音楽タイミングで何かすることを持たせることにより、@c
465 任意のコンテキストを残しておくことができます。@c
466 @code{Staff} コンテキストを残しておくには、それに含まれるボイスの 1 つが@c
467 維持されることを保証する必要があります。@c
468 ボイスを残しておく方法の 1 つに、ボイスに含まれる実際の音楽と並列に、@c
469 空白休符をそのボイスに付け加えるという方法があります。@c
470 残しておく必要があるすべての @code{Voice} コンテキストに対して、@c
471 空白休符を付け加える必要があります。@c
472 ところどころで使用されるボイスがある場合、@c
473 前述の例外によって必要なボイスを残そうとするよりは、@c
474 それらのボイスすべてを残しておく方が安全です。
475
476 以下の例では、空白休符の追加を用いる方法で、@c
477 ボイス A とボイス B の両方が楽曲全体を通して維持されます:
478
479 @c KEEP LY
480 @lilypond[quote,verbatim]
481 musicA = \relative c'' { d4 d d d }
482 musicB = \relative c'' { g4 g g g }
483 keepVoicesAlive = {
484   <<
485     \new Voice = "A" { s1*5 }  % Voice "A" を 5 小節の間、維持する
486     \new Voice = "B" { s1*5 }  % Voice "B" を 5 小節の間、維持する
487   >>
488 }
489
490 music = {
491   \context Voice = "A" {
492     \voiceOneStyle
493     \musicA
494   }
495   \context Voice = "B" {
496     \voiceTwoStyle
497     \musicB
498   }
499   \context Voice = "A" { \musicA }
500   \context Voice = "B" { \musicB }
501   \context Voice = "A" { \musicA }
502 }
503
504 \score {
505   \new Staff <<
506     \keepVoicesAlive
507     \music
508   >>
509 }
510 @end lilypond
511
512 @cindex lyrics, aligning with sporadic melody (途切れ途切れのメロディに歌詞を揃える)
513
514 以下の例は、空白休符を用いる方法で、@c
515 途切れ途切れのメロディに歌詞を持たせる方法を示しています。@c
516 もちろん、実際に楽譜を書く場合は、@c
517 メロディや伴奏は複数のセクションによって構成されることになります。
518
519 @c KEEP LY
520 @lilypond[quote,verbatim]
521 melody = \relative c'' { a4 a a a }
522 accompaniment = \relative c' { d4 d d d }
523 words = \lyricmode { These words fol -- low the mel -- o -- dy }
524 \score {
525   <<
526     \new Staff = "music" {
527       <<
528         \new Voice = "melody" {
529           \voiceOne
530           s1*4  % Voice "melody" を 4 小節の間、残します
531         }
532         {
533           \new Voice = "accompaniment" {
534             \voiceTwo
535             \accompaniment
536           }
537           <<
538             \context Voice = "melody" { \melody }
539             \context Voice = "accompaniment" { \accompaniment }
540           >>
541           \context Voice = "accompaniment" { \accompaniment }
542           <<
543             \context Voice = "melody" { \melody }
544             \context Voice = "accompaniment" { \accompaniment }
545           >>
546         }
547       >>
548     }
549     \new Lyrics \with { alignAboveContext = #"music" }
550     \lyricsto "melody" { \words }
551   >>
552 }
553 @end lilypond
554
555 これに代わる方法として、メロディに直接空白休符を付け加えて、@c
556 メロディが伴奏と揃うようにする方法があります
557 -- 多くの場合、こちらの方法の方が良いかもしれません:
558
559 @c KEEP LY
560 @lilypond[quote,verbatim]
561 melody = \relative c'' {
562   s1  % 1 小節スキップします
563   a4 a a a
564   s1  % 1 小節スキップします
565   a4 a a a
566 }
567 accompaniment = \relative c' {
568   d4 d d d
569   d4 d d d
570   d4 d d d
571   d4 d d d
572 }
573 words = \lyricmode { These words fol -- low the mel -- o -- dy }
574
575 \score {
576   <<
577     \new Staff = "music" {
578       <<
579         \new Voice = "melody" {
580           \voiceOne
581           \melody
582         }
583         \new Voice = "accompaniment" {
584           \voiceTwo
585           \accompaniment
586         }
587       >>
588     }
589     \new Lyrics \with { alignAboveContext = #"music" }
590     \lyricsto "melody" { \words }
591   >>
592 }
593 @end lilypond
594
595
596 @node コンテキストのプラグインを変更する
597 @subsection コンテキストのプラグインを変更する
598 @translationof Modifying context plug-ins
599
600 @c TODO Should this be Modifying engravers or Modifying contexts?
601
602 記譜コンテキスト (@code{Score} や @code{Staff} のような) は@c
603 プロパティを保存するだけなく、@c
604 @q{エングラーバ} と呼ばれる記譜要素を作成するプラグインを保持します。@c
605 例えば、@code{Voice} コンテキストは @code{Note_head_engraver} を保持し、@c
606 @code{Staff} コンテキストは @code{Key_engraver} を保持します。
607
608 各プラグインについての説明は、
609 @ifhtml
610 @rinternals{Engravers and Performers}.
611 @end ifhtml
612 @ifnothtml
613 Internals Reference @expansion{} Translation @expansion{} Engravers.
614 @end ifnothtml
615 を参照してください。@c
616 @ifhtml
617 @rinternals{Contexts}
618 @end ifhtml
619 @ifnothtml
620 Internals Reference @expansion{} Translation @expansion{} Context.
621 @end ifnothtml
622 の中にある各コンテキストについての説明では、@c
623 そのコンテキストで使用されるエングラーバがリストアップされています。
624
625 これらのプラグインを入れ換えると有用な場合があります。@c
626 プラグインを入れ換えるには、新たに作成するコンテキストを
627 @code{\new} あるいは @code{\context} で開始し、@c
628 そのコンテキストを以下のように変更します:
629
630 @funindex \with
631
632 @example
633 \new @var{context} \with @{
634   \consists @dots{}
635   \consists @dots{}
636   \remove @dots{}
637   \remove @dots{}
638   @emph{etc.}
639 @}
640 @{
641   @emph{..music..}
642 @}
643 @end example
644
645 @noindent
646 ここで、@dots{} はエングラーバの名前になります。@c
647 ここで、@code{Staff} コンテキストから @code{Time_signature_engraver} と
648 @code{Clef_engraver} を削除する簡単な例を示します:
649
650 @lilypond[quote,relative=1,verbatim,fragment]
651 <<
652   \new Staff {
653     f2 g
654   }
655   \new Staff \with {
656      \remove "Time_signature_engraver"
657      \remove "Clef_engraver"
658   } {
659     f2 g2
660   }
661 >>
662 @end lilypond
663
664 2 番目の譜には、拍子記号と音部記号がありません。@c
665 この方法は、オブジェクトを不可視にするよりも乱暴な方法です。@c
666 なぜなら、譜全体に影響を与えるからです。@c
667 さらに、望む望まないに係わらず、この方法はスペースにも影響を与えます。@c
668 オブジェクトを消すもっと洗練された方法については、@c
669 @rlearning{オブジェクトの可視性と色} を参照してください。
670
671 次の例は、ある実用的な応用です。@c
672 通常、小節線と拍子記号は楽譜全体で同期されます。@c
673 これは @code{Timing_translator} と @code{Default_bar_line_engraver}
674 によって行われます。@c
675 このプラグインは拍子記号の管理や、小節内の配置の管理などを行います。@c
676 これらのエングラーバを @code{Score} コンテキストから
677 @code{Staff} コンテキストへ異動させることにより、@c
678 楽譜の各譜に独自の拍子記号を持たせることが可能になります。
679
680 @cindex polymetric scores (多拍子の楽譜)
681 @cindex Time signatures, multiple (複数の拍子記号)
682
683 @lilypond[quote,relative=1,ragged-right,verbatim,fragment]
684 \new Score \with {
685   \remove "Timing_translator"
686   \remove "Default_bar_line_engraver"
687 } <<
688   \new Staff \with {
689     \consists "Timing_translator"
690     \consists "Default_bar_line_engraver"
691   } {
692       \time 3/4
693       c4 c c c c c
694   }
695   \new Staff \with {
696     \consists "Timing_translator"
697     \consists "Default_bar_line_engraver"
698   } {
699        \time 2/4
700        c4 c c c c c
701   }
702 >>
703 @end lilypond
704
705 @knownissues
706
707 通常、エングラーバが指定される順序は問題にはなりません。@c
708 しかしながら、いくつかの特殊なケースでは、この順序が重要になります。@c
709 例えば、あるエングラーバがプロパティを記述して、@c
710 それを他のエングラーバが読む場合、あるいは、@c
711 あるエングラーバがグラフィカル オブジェクトを作成し、@c
712 それを他のエングラーバが処理しなければならない場合です。@c
713 エングラーバは指定された順序に従って呼び出され、処理を実行します。
714
715 以下の順序は重要です:
716 通常、@code{Bar_engraver} を最初に指定し、@c
717 @code{New_fingering_engraver} を @code{Script_column_engraver} の前で@c
718 指定する必要があります。@c
719 他にも指定順序が問題になるケースがあるかもしれません。
720
721
722 @node コンテキストのデフォルト設定を変更する
723 @subsection コンテキストのデフォルト設定を変更する
724 @translationof Changing context default settings
725
726 @code{Score}, @code{Staff} それに @code{Voice} コンテキストにおいて@c
727 デフォルトで使用されるコンテキスト設定は、以下の例で示すように、@c
728 @code{\layout} ブロックの中で指定することができます。@c
729 @code{\layout} ブロックは、それを適用する @code{\score} ブロックの中で、@c
730 かつ、音楽表記の外側に配置する必要があります。
731
732 以下のような方法でコンテキストのデフォルト値を指定する場合、@c
733 @code{\set} コマンドとコンテキストを@c
734 省略する必要があるということに注意してください:
735
736 @lilypond[quote,verbatim]
737 \score {
738   \relative c'' {
739     a4^"Really small, thicker stems, no time signature" a a a
740     a a a a
741   }
742   \layout {
743     \context {
744       \Staff
745       fontSize = #-4
746       \override Stem #'thickness = #4.0
747       \remove "Time_signature_engraver"
748     }
749   }
750 }
751 @end lilypond
752
753 上記の例の中で、@code{\Staff} コマンドは、@c
754 後に続く記述をその score ブロックの中にあるすべての譜に適用するということを@c
755 指定しています。
756
757 同様の方法で、@c
758 @code{Score} コンテキストや @code{Voice} コンテキストに@c
759 変更を適用することができます。
760
761 コンテキストの変更を変数に格納することができます。@c
762 コンテキストの変更に @code{\with} を付けて変数に格納して、その変数を@c
763 コンテキスト定義の前に置くことにより、変更をコンテキストに適用することが@c
764 できます:
765 @lilypond[quote,verbatim]
766 blubb = \with {
767   fontSize = #-4
768   \override Stem #'thickness = #4.0
769   \remove "Time_signature_engraver"
770 }
771
772 bla = \with {
773   fontSize = #3
774   \override Stem #'thickness = #-2.0
775 }
776
777 melody = \relative c'' {
778   a4 a a a |
779   a4 a a a |
780 }
781
782 \score {
783   <<
784     \new Staff <<
785       \melody
786       s1*0^"Small, thicker stems, no time signature"
787     >>
788     \new Staff \bla <<
789       \melody
790       s1*0^"Different"
791     >>
792   >>
793   \layout {
794     \context {
795       \Staff
796       \blubb
797     }
798   }
799 }
800 @end lilypond
801
802 @c TODO: add \with in here.
803
804
805 @node 新しいコンテキストを定義する
806 @subsection 新しいコンテキストを定義する
807 @translationof Defining new contexts
808
809 @cindex contexts, defining new (新しいコンテキストを定義する)
810 @cindex engravers, including in contexts (エングラーバをコンテキストに含める)
811
812 @funindex \alias
813 @funindex alias
814 @funindex \name
815 @funindex name
816 @funindex \type
817 @funindex type
818 @funindex \consists
819 @funindex consists
820 @funindex \accepts
821 @funindex accepts
822 @funindex \denies
823 @funindex denies
824
825 @code{Staff} や @code{Voice} のようなコンテキストは、@c
826 簡単なブロックの組み合わせで構成されています。
827 エングラーバ プラグインの組み合わせを変えることで、@c
828 新しいタイプのコンテキスを作成することができます。
829
830 次の例は、ゼロからタイプの異なる @code{Voice} コンテキストを作り上げる方法を@c
831 示しています。@c
832 このコンテキストは @code{Voice} コンテキストに似ていますが、@c
833 音符の代わりにスラッシュを譜の中央に譜刻します。@c
834 これはジャズで即興を表すのに使うことができます。
835
836 @lilypond[quote,ragged-right]
837 \layout { \context {
838   \name ImproVoice
839   \type "Engraver_group"
840   \consists "Note_heads_engraver"
841   \consists "Rhythmic_column_engraver"
842   \consists "Text_engraver"
843   \consists Pitch_squash_engraver
844   squashedPosition = #0
845   \override NoteHead #'style = #'slash
846   \override Stem #'transparent = ##t
847   \override Flag #'transparent = ##t
848   \alias Voice
849 }
850 \context { \Staff
851   \accepts "ImproVoice"
852 }}
853
854 \relative c'' {
855   a4 d8 bes8 \new ImproVoice { c4^"ad lib" c
856    c4 c^"undress" c_"while playing :)" c }
857   a1
858 }
859 @end lilypond
860
861
862 これらの設定は @code{\layout} ブロック内部の @code{\context} ブロック@c
863 の中で定義します:
864
865 @example
866 \layout @{
867   \context @{
868     @dots{}
869   @}
870 @}
871 @end example
872
873 以下では、上記の例の @dots{} に入るべき入力について議論します。
874
875 最初に、新しいコンテキストの名前を定義する必要があります:
876
877 @example
878 \name ImproVoice
879 @end example
880
881 このコンテキストは @code{Voice} に似せる必要があるため、@c
882 (既存の) @code{Voice} と同じ機能を実現するコマンドが必要です。@c
883 これは、新しいコンテキストにエイリアス @code{Voice} を与えることで実現できます。
884
885 @example
886 \alias Voice
887 @end example
888
889 このコンテキストは音符と指示テキストを譜刻しますので、@c
890 それらの機能を提供するエングラーバを付け加える必要があります:
891
892 @example
893 \consists Note_heads_engraver
894 \consists Text_engraver
895 @end example
896
897 しかしながら、音符の代わりにスラッシュを譜の中央線上に配置します:
898
899 @example
900 \consists Pitch_squash_engraver
901 squashedPosition = #0
902 @end example
903
904 @rinternals{Pitch_squash_engraver} は
905 (@rinternals{Note_heads_engraver} によって作成される) 符頭を変更し、@c
906 符頭の垂直位置を @code{squashedPosition} にセットします
907 -- 今回は @code{0}、つまり中央線上です。
908
909 音符はスラッシュで、符幹を持ちません:
910
911 @example
912 \override NoteHead #'style = #'slash
913 \override Stem #'transparent = ##t
914 \override Flag #'transparent = ##t
915 @end example
916
917 これらのプラグインすべてが共同する必要があり、@c
918 それには特殊なプラグインが必要です。@c
919 このプラグインは常に @code{Engraver_group} であり、@c
920 キーワード @code{\type} を付ける必要があります。
921
922 @example
923 \type "Engraver_group"
924 @end example
925
926 まとめると、以下のようになります:
927
928 @example
929 \context @{
930   \name ImproVoice
931   \type "Engraver_group"
932   \consists "Note_heads_engraver"
933   \consists "Text_engraver"
934   \consists Pitch_squash_engraver
935   squashedPosition = #0
936   \override NoteHead #'style = #'slash
937   \override Stem #'transparent = ##t
938   \override Flag #'transparent = ##t
939   \alias Voice
940 @}
941 @end example
942
943 @funindex \accepts
944 コンテキストは階層を構成します。c
945 通常の @code{Voice} と同様に、@c
946 @code{ImproVoice} を @code{Staff} の下に置く必要があります。@c
947 それゆえ、@code{Staff} 定義を @code{\accepts} コマンドで変更します:
948
949 @example
950 \context @{
951   \Staff
952   \accepts ImproVoice
953 @}
954 @end example
955
956 @funindex \denies
957 @code{\accepts} の反対は @code{\denies} です。@c
958 これは既存のコンテキスト定義を再利用する場合に必要となります。
959
960 以下のように、両方を @code{\layout} ブロックの中に置きます:
961
962 @example
963 \layout @{
964   \context @{
965     \name ImproVoice
966     @dots{}
967   @}
968   \context @{
969     \Staff
970     \accepts "ImproVoice"
971   @}
972 @}
973 @end example
974
975 それから、このサブセクションの最初にあった出力を入力します:
976
977 @example
978 \relative c'' @{
979   a4 d8 bes8
980   \new ImproVoice @{
981     c4^"ad lib" c
982     c4 c^"undress"
983     c c_"while playing :)"
984   @}
985   a1
986 @}
987 @end example
988
989
990 @node コンテキストの配置順序
991 @subsection Context layout order
992 @translationof Context layout order
993
994 @cindex contexts, layout order (コンテキストの配置順序)
995 @funindex \accepts
996 @funindex \denies
997
998 通常、コンテキストは入力ファイルの中で記述した順に楽譜の段の上から下に@c
999 配置されます。@c
1000 コンテキストがネストされている場合、外側のコンテキストは入力ファイルの@c
1001 中で指定されたコンテキストを内側に保持して、内側のコンテキストは外側の@c
1002 コンテキストの @qq{accepts} リストに含まれます。@c
1003 ネストされたコンテキストのうち外側のコンテキストの @qq{accepts} リスト@c
1004 に含まれないものは、ネストされずに外側のコンテキストの下に再配置されます。
1005
1006 コンテキストの @qq{accepts} リストを @code{\accepts} コマンドと
1007 @code{\denies} コマンドで変更することができます。@c
1008 @code{\accepts} はコンテキストを @qq{accepts} リストに追加して、@c
1009 @code{\denies} は @qq{accepts} リストからコンテキストを削除します。@c
1010 例えば、通常、コード ネームは @code{Staff} コンテキストの中にネスト@c
1011 されないため、@code{ChordNames} コンテキストはデフォルトでは @code{Staff}
1012 コンテキストの @qq{accepts} リストには含まれませんが、リストに含める必要が@c
1013 あれば含めることができます:
1014
1015 @lilypond[verbatim,quote]
1016 \score {
1017   \new Staff {
1018     c' d' e' f'
1019     \chords { d1:m7 b1:min7.5- }
1020   }
1021 }
1022 @end lilypond
1023
1024 @lilypond[verbatim,quote]
1025 \score {
1026   \new Staff {
1027     c' d' e' f'
1028     \chords { d1:m7 b1:min7.5- }
1029   }
1030   \layout {
1031     \context {
1032       \Staff
1033       \accepts "ChordNames"
1034     }
1035   }
1036 }
1037 @end lilypond
1038
1039 @code{\denies} は主に、他のコンテキストをベースに新しいコンテキストを@c
1040 作成した時に、中にネストするコンテキストを変更するために用いられます。
1041
1042 例えば、@code{VaticanaStaff} コンテキストは @code{Staff} コンテキストを@c
1043 ベースにしていますが、@qq{accepts} リストでは @code{Voice} コンテキスト@c
1044 の代わりに @code{VaticanaVoice} コンテキストを保持しています。
1045
1046 コンテキストに保持されるべきコマンドが出現して、それを保持するための@c
1047 適切なコンテキストが存在しない場合、コンテキストが暗黙的に作成される@c
1048 ということに注意してください。@c
1049 これは予期しない譜や楽譜を生み出す可能性があります。
1050
1051 @seealso
1052 アプリケーション使用方法:
1053 @rprogram{An extra staff appears}
1054
1055 インストールされているファイル:
1056 @file{ly/engraver-init.ly}
1057
1058
1059 @node 内部リファレンスの説明
1060 @section 内部リファレンスの説明
1061 @translationof Explaining the Internals Reference
1062
1063
1064 @menu
1065 * 内部リファレンスを使いこなす::
1066 * レイアウト インターフェイス::
1067 * グラフィカル オブジェクト プロパティを決定する::
1068 * 命名規約::
1069 @end menu
1070
1071 @node 内部リファレンスを使いこなす
1072 @subsection 内部リファレンスを使いこなす
1073 @translationof Navigating the program reference
1074
1075 @c TODO remove this (it's in the LM)
1076 @c Replace with more factual directions
1077
1078 以下の譜面の運指記号を移動させたいとします:
1079
1080 @lilypond[quote,relative=2,verbatim]
1081 c-2
1082 \stemUp
1083 f
1084 @end lilypond
1085
1086 運指指示のドキュメント (@ref{運指の指示}) を見ると、@c
1087 以下のようなセクションがあることに気付くはずです:
1088
1089 @quotation
1090 @strong{参照}
1091
1092 内部リファレンス: @rinternals{Fingering}
1093
1094 @end quotation
1095
1096
1097 @c  outdated info; probably will delete.
1098 @ignore
1099 This fragment points to two parts of the program reference: a page
1100 on @code{FingeringEvent} and one on @code{Fingering}.
1101
1102 The page on @code{FingeringEvent} describes the properties of the music
1103 expression for the input @code{-2}.  The page contains many links
1104 forward.  For example, it says
1105
1106 @quotation
1107 Accepted by: @rinternals{Fingering_engraver},
1108 @end quotation
1109
1110 @noindent
1111 That link brings us to the documentation for the Engraver, the
1112 plug-in, which says
1113
1114 @quotation
1115 This engraver creates the following layout objects: @rinternals{Fingering}.
1116 @end quotation
1117
1118 In other words, once the @code{FingeringEvent}s are interpreted, the
1119 @code{Fingering_engraver} plug-in will process them.
1120 @end ignore
1121
1122 @ignore
1123 @c  I can't figure out what this is supposed to mean.  -gp
1124
1125 The @code{Fingering_engraver} is also listed to create
1126 @rinternals{Fingering} objects,
1127
1128 @c  old info?  it doesn't make any sense to me with our current docs.
1129 This is also the
1130 second bit of information listed under @b{See also} in the Notation
1131 manual.
1132 @end ignore
1133
1134 @ifnothtml
1135 内部リファレンスは HTML ドキュメント形式で入手可能です。@c
1136 内部リファレンスは、オンラインか HTML ドキュメントをダウンロードするかして、@c
1137 HTML 形式で読むことを強く推奨します。@c
1138 PDF マニュアルを使用していると、@c
1139 このセクションを理解するのはずっと困難になります。@c
1140 (訳者: 日本語では PDF 形式での提供はありません。)
1141 @end ifnothtml
1142
1143 @rinternals{Fingering} へのリンクを辿ってください。@c
1144 ページの先頭に、以下のような記述があります:
1145
1146 @quotation
1147 Fingering objects are created by: @rinternals{Fingering_engraver} and
1148 @rinternals{New_fingering_engraver}.
1149 @end quotation
1150
1151 内部リファレンスの中にある関連リンクを辿っていくことで、@c
1152 プログラム内部の情報フローを追っていくことができます:
1153
1154 @itemize
1155
1156 @item @rinternals{Fingering}:
1157 @rinternals{Fingering} objects are created by:
1158 @rinternals{Fingering_engraver}
1159
1160 (@rinternals{Fingering}:
1161 @rinternals{Fingering} オブジェクトを作成するのは:
1162 @rinternals{Fingering_engraver})
1163
1164
1165 @item @rinternals{Fingering_engraver}:
1166 Music types accepted:
1167 @rinternals{fingering-event}
1168
1169 (@rinternals{Fingering_engraver}:
1170 受け取る音楽タイプは: @rinternals{fingering-event})
1171
1172 @item @rinternals{fingering-event}:
1173 Music event type @code{fingering-event} is in
1174 Music expressions named @rinternals{FingeringEvent}
1175
1176 (@rinternals{fingering-event}:
1177 音楽イベント タイプ @code{fingering-event} は
1178 @rinternals{FingeringEvent} という名前の音楽表記の中にあります)
1179 @end itemize
1180
1181 このパスは、プログラム内部での情報フローとは逆向きです:
1182 出力からスタートして、入力イベントで終わっています。@c
1183 入力イベントからスタートして、情報フローを読み進め、@c
1184 最後は出力オブジェクトに辿り着くこともできます。
1185
1186 内部リファレンスを通常のドキュメントのように読むこともできます。@c
1187 内部リファレンスに含まれる章は、
1188 @ifhtml
1189 @rinternals{Music definitions},
1190 @end ifhtml
1191 @ifnothtml
1192 @code{Music definitions},
1193 @end ifnothtml
1194 @rinternals{Translation}, それに @rinternals{Backend} です。
1195 各章は、使用されているすべての定義と調整可能なすべてのプロパティを@c
1196 リストアップしています。
1197
1198
1199 @node レイアウト インターフェイス
1200 @subsection レイアウト インターフェイス
1201 @translationof Layout interfaces
1202
1203 @cindex interface, layout (レイアウト インターフェイス)
1204 @cindex layout interface (レイアウト インターフェイス)
1205 @cindex grob (グラフィカル オブジェクト)
1206
1207 前のセクションで見た HTML ページには、@c
1208 @rinternals{Fingering} と呼ばれるレイアウト オブジェクトについての@c
1209 記述がありました。@c
1210 そのようなオブジェクトは楽譜で記号となります。@c
1211 レイアウト オブジェクトは (太さや向きのような) 数値を保持する@c
1212 プロパティを持っていますが、@c
1213 関連オブジェクトへのポインタも持っています。@c
1214 レイアウト オブジェクトは @emph{Grob}
1215 -- これはグラフィカル オブジェクトを縮めたものです --
1216 とも呼ばれます。@c
1217 Grob についての詳細は、@rinternals{grob-interface} を参照してください。
1218
1219 @code{Fingering} のページは、@c
1220 @code{Fingering} オブジェクトの定義をリストアップしています。@c
1221 例えば、このページには以下のような記述があります:
1222
1223 @quotation
1224 @code{padding} (dimension, in staff space):
1225
1226 @code{0.5}
1227 @end quotation
1228
1229 @noindent
1230 これは、この数値は少なくとも符頭の 0.5 倍の距離を保つということを意味します。
1231
1232
1233 各レイアウト オブジェクトは、記譜要素あるいは写植要素としての機能を@c
1234 いくつか持つ場合があります。@c
1235 例えば、@code{Fingering} オブジェクトは以下の側面を持っています:
1236
1237 @itemize
1238 @item
1239 Its size is independent of the horizontal spacing, unlike slurs or beams.
1240
1241 (このオブジェクトのサイズは、スラーや連桁と異なり、@c
1242 水平方向のスペースとは無関係です)
1243
1244 @item
1245 It is a piece of text.  Granted, it is usually a very short text.
1246
1247 (このオブジェクトはテキストです。通常、これは非常に短いテキストです。)
1248
1249 @item
1250 That piece of text is typeset with a font, unlike slurs or beams.
1251
1252 (このテキストは、スラーや連桁と異なり、フォントで写植されます。)
1253
1254 @item
1255 Horizontally, the center of the symbol should be aligned to the
1256 center of the note head.
1257
1258 (水平方向では、この記号の中心は符頭の中心に揃えられます。)
1259
1260 @item
1261 Vertically, the symbol is placed next to the note and the staff.
1262
1263 (垂直方向では、この記号は音符や譜の近く配置されます。)
1264
1265 @item
1266 The vertical position is also coordinated with other superscript
1267 and subscript symbols.
1268
1269 (また、垂直方向の位置は、他の上付き記号や下付き記号との調整によって決まります。)
1270 @end itemize
1271
1272 これらの側面はそれぞれ、いわゆる @emph{インターフェイス}
1273 として捉ええられます。@c
1274 それらは、@rinternals{Fingering} ページの最下部でリストアップされています。
1275
1276 @quotation
1277 This object supports the following interfaces:
1278
1279 (このオブジェクトは以下のインターフェイスをサポートします:)
1280
1281 @rinternals{item-interface},
1282 @rinternals{self-alignment-interface},
1283 @rinternals{side-position-interface}, @rinternals{text-interface},
1284 @rinternals{text-script-interface}, @rinternals{font-interface},
1285 @rinternals{finger-interface}, and @rinternals{grob-interface}.
1286 @end quotation
1287
1288 リンクのいずれかをクリックすると、@c
1289 それぞれのオブジェクト インターフェイスのページに行くことができます。@c
1290 各インターフェイスはいくつかのプロパティを持ちます。@c
1291 それらプロパティの中には、ユーザにとって役に立たないもの
1292 (@q{内部プロパティ}) もありますが、それ以外は変更可能です。
1293
1294 これまで @code{Fingering} オブジェクトについて話してきましたが、@c
1295 これは実際にはそれほど多くのことをしているわけではありません。@c
1296 初期化ファイル (@rlearning{その他の情報源} を参照してください)
1297 @file{scm/define-grobs.scm} がこの @q{オブジェクト} の本質を示しています:
1298
1299 @example
1300 (Fingering
1301   . ((padding . 0.5)
1302      (avoid-slur . around)
1303      (slur-padding . 0.2)
1304      (staff-padding . 0.5)
1305      (self-alignment-X . 0)
1306      (self-alignment-Y . 0)
1307      (script-priority . 100)
1308      (stencil . ,ly:text-interface::print)
1309      (direction . ,ly:script-interface::calc-direction)
1310      (font-encoding . fetaText)
1311      (font-size . -5)           ; don't overlap when next to heads.
1312      (meta . ((class . Item)
1313      (interfaces . (finger-interface
1314                     font-interface
1315                     text-script-interface
1316                     text-interface
1317                     side-position-interface
1318                     self-alignment-interface
1319                     item-interface))))))
1320 @end example
1321
1322 @noindent
1323 見て取ることができるように、@c
1324 @code{Fingering} オブジェクトは変数設定の塊に過ぎず、@c
1325 内部リファレンスの中にある Web ページは、@c
1326 この定義から直接生成されたに過ぎません。
1327
1328
1329 @node グラフィカル オブジェクト プロパティを決定する
1330 @subsection グラフィカル オブジェクト プロパティを決定する
1331 @translationof Determining the grob property
1332
1333 @c TODO remove this (it's in the LM)
1334 @c Replace with more factual directions
1335
1336 以下の @b{2} の位置を変更しようとしていたことを思い出してください:
1337
1338 @lilypond[quote,fragment,relative=2,verbatim]
1339 c-2
1340 \stemUp
1341 f
1342 @end lilypond
1343
1344 垂直方向で見て、@b{2} は元の音符の隣に配置されるのですから、@c
1345 この配置に関連するインターフェイスに干渉する必要があります。@c
1346 これは @code{side-position-interface} を用いて行います。@c
1347 このインターフェイスについてのページには、以下のように記述されています:
1348
1349 @quotation
1350 @code{side-position-interface}
1351
1352 Position a victim object (this one) next to other objects (the
1353 support).  The property @code{direction} signifies where to put the
1354 victim object relative to the support (left or right, up or down?)
1355
1356 (対象オブジェクトを他のオブジェクト (サポート オブジェクト)
1357 の隣に配置します。@c
1358 このプロパティ @code{direction} は、@c
1359 対象オブジェクトをどこに配置するかを@c
1360 サポート オブジェクトからの相対位置で示します
1361 (左あるいは右、上あるいは下?))
1362 @end quotation
1363
1364 @cindex padding
1365 @noindent
1366 この記述の下に、以下のような変数 @code{padding} についての記述があります:
1367
1368 @quotation
1369 @table @code
1370 @item padding
1371 (dimension, in staff space)
1372 (譜スペースを単位とする距離)
1373
1374 Add this much extra space between objects that are next to each other.
1375 (隣り合うオブジェクトの間にスペースを付け加えます)
1376 @end table
1377 @end quotation
1378
1379 @code{padding} の値を増やすことで、@c
1380 運指記号を符頭から離すことができます。@c
1381 以下のコマンドは、音符と運指記号の間に 3 譜スペースを挿入します:
1382
1383 @example
1384 \once \override Voice.Fingering #'padding = #3
1385 @end example
1386
1387 このコマンドを @code{Fingering} オブジェクトが作成される前に挿入する
1388 -- つまり @code{c2} の前に挿入する -- と、以下のような結果が得られます:
1389
1390 @lilypond[quote,relative=2,fragment,verbatim]
1391 \once \override Voice.Fingering #'padding = #3
1392 c-2
1393 \stemUp
1394 f
1395 @end lilypond
1396
1397
1398 このケースでは、調整されるコンテキストは @code{Voice} です。@c
1399 このことは、内部リファレンスの @rinternals{Fingering_engraver}
1400 プラグインについてのページからわかります。@c
1401 このページには、以下のような記述があります:
1402
1403 @quotation
1404 Fingering_engraver is part of contexts: @dots{} @rinternals{Voice}
1405
1406 (Fingering_engraver は次のコンテキストの一部です: @dots{} @rinternals{Voice})
1407 @end quotation
1408
1409
1410 @node 命名規約
1411 @subsection 命名規約
1412 @translationof Naming conventions
1413
1414 内部リファレンスについて他に説明しておくべき事柄として、@c
1415 さまざまな命名規約についての概要があります:
1416
1417 @itemize
1418 @item Scheme スタイル: 小文字の単語をハイフンでつなぎます
1419 (1 単語の名前を含みます) -- 例: lowercase-with-hyphens
1420 @item Scheme 関数: Scheme スタイルの先頭に @code{ly:} を付けます
1421 -- 例: ly:plus-scheme-style
1422 @item 音楽イベント、音楽クラス、それに音楽プロパティ: Scheme スタイルです
1423 -- 例: as-scheme-functions
1424 @item グラフィカル オブジェクト インターフェイス: Scheme スタイルです
1425 -- 例: scheme-style
1426 @item バックエンド プロパティ: Scheme スタイルです (が、X と Y があります!)
1427 @item コンテキスト (それに、音楽表記とグラフィカル オブジェクト):
1428 大文字で始まる単語、あるいはそれらをつなげます
1429 -- 例: Capitalized, CamelCase
1430 @item コンテキスト プロパティ:
1431 小文字で始まる単語に、大文字で始まる単語をつなげます
1432 -- 例: lowercaseFollowedByCamelCase
1433 @item エングラーバ:
1434 大文字で始まる単語に、小文字で始まる単語をアンダスコアでつなげます
1435 -- 例: Capitalized_followed_by_lowercase_and_with_underscores
1436 @end itemize
1437
1438 疑問:
1439 @itemize
1440 @item 命名規約のうち、慣習なのはどれで、規則なのはどれか?
1441 @item 命名規約のうち、どれが基本言語の規則で、@c
1442 どれが LP (訳者: LilyPond?) 特有の規則なのか?
1443 @end itemize
1444
1445
1446 @node プロパティを変更する
1447 @section プロパティを変更する
1448 @translationof Modifying properties
1449
1450 @c TODO change the menu and subsection node names to use
1451 @c backslash once the new macro to handle the refs
1452 @c is available.  Need to find and change all refs at
1453 @c the same time. -td
1454
1455 @menu
1456 * プロパティ変更の概要::
1457 * set コマンド::
1458 * override コマンド::
1459 * tweak コマンド::
1460 * set 対 override::
1461 * 連想配列を変更する::
1462 @end menu
1463
1464
1465 @node プロパティ変更の概要
1466 @subsection プロパティ変更の概要
1467 @translationof Overview of modifying properties
1468
1469 各コンテキストは、ある特定のタイプのグラフィカル オブジェクトを作成することに@c
1470 ついて責任を持ちます。@c
1471 それらのオブジェクトを表示するために使用される設定も、@c
1472 コンテキストによって保存されます。@c
1473 それらの設定を変更することにより、オブジェクトの見た目を変えることができます。
1474
1475 コンテキストに保存されるプロパティには 2 種類あります:
1476 コンテキスト プロパティとグラフィカル オブジェクト プロパティです。@c
1477 コンテキスト プロパティは、コンテキスト全体に適用され、@c
1478 コンテキスト自体をどのように表示するかを制御します。@c
1479 対照的に、グラフィカル オブジェクト プロパティは、コンテキストの中に表示される@c
1480 ある特定のタイプのグラフィカル オブジェクトに適用されます。
1481
1482 @code{\set} コマンドと @code{\unset} コマンドは、@c
1483 コンテキスト プロパティの値を変更するために使用されます。@c
1484 @code{\override} コマンドと @code{\revert} コマンドは、@c
1485 グラフィカル オブジェクト プロパティの値を変更するために使用されます。
1486
1487 @ignore
1488 The syntax for this is
1489
1490 @example
1491 \override @var{context}.@var{name} #'@var{property} = #@var{value}
1492 @end example
1493
1494 Here @var{name} is the name of a graphical object, like
1495 @code{Stem} or @code{NoteHead}, and @var{property} is an internal
1496 variable of the formatting system (@q{grob property} or @q{layout
1497 property}).  The latter is a symbol, so it must be quoted.  The
1498 subsection @ref{Modifying properties}, explains what to fill in
1499 for @var{name}, @var{property}, and @var{value}.  Here we only
1500 discuss the functionality of this command.
1501
1502 The command
1503
1504 @verbatim
1505 \override Staff.Stem #'thickness = #4.0
1506 @end verbatim
1507
1508 @noindent
1509 makes stems thicker (the default is 1.3, with staff line thickness as a
1510 unit).  Since the command specifies @code{Staff} as context, it only
1511 applies to the current staff.  Other staves will keep their normal
1512 appearance.  Here we see the command in action:
1513
1514 @lilypond[quote,verbatim,relative=2,fragment]
1515 c4
1516 \override Staff.Stem #'thickness = #4.0
1517 c4
1518 c4
1519 c4
1520 @end lilypond
1521
1522 The @code{\override} command changes the definition of the @code{Stem}
1523 within the current @code{Staff}.  After the command is interpreted
1524 all stems are thickened.
1525
1526 Analogous to @code{\set}, the @var{context} argument may be left out,
1527 causing the default context @code{Voice} to be used.  Adding
1528 @code{\once} applies the change during one timestep only.
1529
1530 @lilypond[quote,fragment,verbatim,relative=2]
1531 c4
1532 \once \override Stem #'thickness = #4.0
1533 c4
1534 c4
1535 @end lilypond
1536
1537 The @code{\override} must be done before the object is
1538 started.  Therefore, when altering @emph{Spanner} objects such as slurs
1539 or beams, the @code{\override} command must be executed at the moment
1540 when the object is created.  In this example,
1541
1542 @lilypond[quote,fragment,verbatim,relative=2]
1543 \override Slur #'thickness = #3.0
1544 c8[( c
1545 \override Beam #'thickness = #0.6
1546 c8 c])
1547 @end lilypond
1548
1549 @noindent
1550 the slur is fatter but the beam is not.  This is because the command for
1551 @code{Beam} comes after the Beam is started, so it has no effect.
1552
1553 Analogous to @code{\unset}, the @code{\revert} command for a context
1554 undoes an @code{\override} command; like with @code{\unset}, it only
1555 affects settings that were made in the same context.  In other words, the
1556 @code{\revert} in the next example does not do anything.
1557
1558 @example
1559 \override Voice.Stem #'thickness = #4.0
1560 \revert Staff.Stem #'thickness
1561 @end example
1562
1563 Some tweakable options are called @q{subproperties} and reside inside
1564 properties.  To tweak those, use commands of the form
1565
1566 @c leave this as a long long
1567 @example
1568 \override @var{context}.@var{name} #'@var{property} #'@var{subproperty} = #@var{value}
1569 @end example
1570
1571 @noindent
1572 such as
1573
1574 @example
1575 \override Stem #'(details beamed-lengths) = #'(4 4 3)
1576 @end example
1577
1578 @end ignore
1579
1580 @seealso
1581 内部リファレンス:
1582 @rinternals{Backend},
1583 @rinternals{All layout objects},
1584 @rinternals{OverrideProperty},
1585 @rinternals{RevertProperty},
1586 @rinternals{PropertySet}
1587
1588
1589 @knownissues
1590
1591 バックエンドはオブジェクト プロパティのタイプ チェックを@c
1592 それほど厳密には行いません。@c
1593 Scheme 値の循環参照は、ハング アップまたはクラッシュ、@c
1594 あるいは両方を引き起こす可能性があります。
1595
1596
1597
1598 @node set コマンド
1599 @subsection @code{\set} コマンド
1600 @translationof The set command
1601
1602 @cindex properties (プロパティ)
1603 @funindex \set
1604 @cindex changing properties (プロパティを変更する)
1605
1606 各コンテキストは @emph{プロパティ} の集合を持ちます。@c
1607 プロパティとは、コンテキストの中に保持されている変数です。@c
1608 コンテキスト プロパティは、@code{\set} コマンドによって変更されます。@c
1609 @code{\set} コマンドは以下のような構文を持ちます:
1610
1611 @example
1612 \set @var{context}.@var{property} = #@var{value}
1613 @end example
1614
1615 @var{value} は Scheme オブジェクトですので、@c
1616 @code{#} 文字を前に置く必要があります。
1617
1618 通常、コンテキスト プロパティの名前は、@c
1619 小文字で始まる単語に大文字で始まる単語をつなげたものです。@c
1620 これらはたいてい音楽から記譜への翻訳を制御します
1621 -- 例えば、@code{localKeySignature} (臨時記号を表示するかどうかを決定します)
1622 や、@code{measurePosition} (小節線を表示するタイミングを決定します) です。@c
1623 コンテキスト プロパティは、楽曲の解釈をしている間、@c
1624 ずっと値を変更しておくことができます。@c
1625 @code{measurePosition} がその良い例です。@c
1626 コンテキスト プロパティは @code{\set} で変更されます。
1627
1628 例えば、コンテキスト プロパティ @code{skipBars} が
1629 @code{#t} にセットされていれば、@c
1630 複小節休符は 1 つの小節に統合されます:
1631
1632 @lilypond[quote,verbatim,relative=2,fragment]
1633 R1*2
1634 \set Score.skipBars = ##t
1635 R1*2
1636 @end lilypond
1637
1638 @var{context} 引数が省略されている場合、@c
1639 プロパティはカレントの最下位のコンテキストにセットされます
1640 (一般に、@code{ChordNames}, @code{Voice}, @code{TabVoice},
1641 あるいは @code{Lyrics} です)。
1642
1643 @lilypond[quote,verbatim,relative=2]
1644 \set Score.autoBeaming = ##f
1645 <<
1646   {
1647     e8 e e e
1648     \set autoBeaming = ##t
1649     e8 e e e
1650   } \\ {
1651     c8 c c c c8 c c c
1652   }
1653 >>
1654 @end lilypond
1655
1656 変更は @q{オンザフライ} (その場、その時々) で適用されるため、@c
1657 設定 @code{\set autoBeaming = ##t} は 2 番目の 8 分音符グループだけに@c
1658 効果を持ちます。
1659
1660 最下位コンテキストが常に変更しようとしているプロパティを持っているとは@c
1661 限らないということに注意してください
1662 -- 例えば、@code{skipBars} プロパティをデフォルトの最下位コンテキスト
1663 (この場合は、@code{Voice} です) にセットしようと試みても、効果はありません。@c
1664 なぜなら、@code{skipBars} は @code{Score} コンテキストのプロパティだからです。
1665
1666 @lilypond[quote,verbatim,relative=2]
1667 R1*2
1668 \set skipBars = ##t
1669 R1*2
1670 @end lilypond
1671
1672 コンテキストは階層構造をとるため、音楽表記を囲っているコンテキスト
1673 -- 例えば、@code{Staff} -- が指定された場合、@c
1674 変更はカレントの @code{Staff} の中にあるすべての @code{Voice} に適用されます。
1675
1676 @funindex \unset
1677
1678 @code{\unset} コマンド:
1679
1680 @example
1681 \unset @var{context}.@var{property}
1682 @end example
1683
1684 @noindent
1685 は、@var{context} から @var{property} の定義を削除するために使用されます。@c
1686 このコマンドは、@var{context} の中にセットされた場合にのみ、定義を削除します。@c
1687 音楽表記を囲っているコンテキストにセットされたプロパティは、@c
1688 囲まれているコンテキストの中にある @code{\unset} では変更されません:
1689
1690 @lilypond[quote,verbatim,relative=2]
1691 \set Score.autoBeaming = ##t
1692 <<
1693   {
1694     \unset autoBeaming
1695     e8 e e e
1696     \unset Score.autoBeaming
1697     e8 e e e
1698   } \\ {
1699     c8 c c c c8 c c c
1700   }
1701 >>
1702 @end lilypond
1703
1704 @code{\set} と同様に、
1705 最下位コンテキストに対しては @var{context} 引数を指定する必要はありません。@c
1706 ですから、以下の 2 つの記述:
1707
1708 @example
1709 \set Voice.autoBeaming = ##t
1710 \set autoBeaming = ##t
1711 @end example
1712
1713 @noindent
1714 は、カレントの最下位コンテキストが @code{Voice} であれば、等価です。
1715
1716
1717 @cindex \once
1718 @code{\set} の前に @code{\once} を置くと、@c
1719 その設定は単一の時間ステップにだけ適用されます:
1720
1721 @lilypond[quote,verbatim,relative=2]
1722 c4
1723 \once \set fontSize = #4.7
1724 c4
1725 c4
1726 @end lilypond
1727
1728 利用可能なすべてのコンテキスト プロパティについての完全な記述は、@c
1729 内部リファレンスにあります。@c
1730 以下を参照してください:
1731 @ifhtml
1732 @rinternals{Tunable context properties}.
1733 @end ifhtml
1734 @ifnothtml
1735 Translation @expansion{} Tunable context properties.
1736 @end ifnothtml
1737
1738 @seealso
1739 内部リファレンス:
1740 @rinternals{Tunable context properties}
1741
1742 @cindex grob properties (グラフィカル オブジェクト プロパティ)
1743 @cindex properties, grob (グラフィカル オブジェクト プロパティ)
1744 @funindex \override
1745
1746
1747 @node override コマンド
1748 @subsection @code{\override} コマンド
1749 @translationof The override command
1750
1751 特殊なタイプのコンテキスト プロパティがあります:
1752 グラフィカル オブジェクト記述です。@c
1753 グラフィカル オブジェクト記述には @code{StudlyCaps} という名前
1754 (大文字で始まります) が付けられています。@c
1755 これらは、関連リストとして、ある特定の種類のグラフィカル オブジェクト用の
1756 @q{デフォルト設定} を保持します。@c
1757 各グラフィカル オブジェクト記述の設定を調べるには、@c
1758 @file{scm/define-grobs.scm} を参照してください。@c
1759 各グラフィカル オブジェクト記述は @code{\override} を用いて変更します。
1760
1761 @code{\override} は、実際のところ、簡略化した記述です。
1762
1763 @example
1764 \override @var{context}.@var{GrobName} #'@var{property} = #@var{value}
1765 @end example
1766
1767 @noindent
1768 これは、以下と等価です:
1769
1770 @c  leave this long line -gp
1771 @example
1772 \set @var{context}.@var{GrobName}  =
1773   #(cons (cons '@var{property} @var{value})
1774          <previous value of @var{context}.@var{GrobName}>)
1775 @end example
1776
1777 @code{context}.@code{GrobName} (alist) の値は、@c
1778 個々のグラフィカル オブジェクトのプロパティを初期化するために使用されます。@c
1779 グラフィカル オブジェクトは、Scheme スタイルの名前
1780 (小文字の単語を @code{-} でつないだもの) のプロパティを持ちます。@c
1781 グラフィカル オブジェクト プロパティの値は、@c
1782 フォーマット処理の間ずっと変更されています:
1783 基本的に、フォーマット処理は、@c
1784 コールバック関数を用いてプロパティを計算することに他なりません。@c
1785
1786 例えば、@code{Stem} オブジェクトの @code{thickness} プロパティを@c
1787 オーバライドすることによって、符幹の太さを太くすることができます:
1788
1789 @lilypond[quote,verbatim,relative=2]
1790 c4 c
1791 \override Voice.Stem #'thickness = #3.0
1792 c4 c
1793 @end lilypond
1794
1795 If no context is specified in an @code{\override}, the bottom
1796 context is used:
1797
1798 @lilypond[quote,verbatim,relative=2]
1799 { \override Staff.Stem #'thickness = #3.0
1800   <<
1801     {
1802       e4 e
1803       \override Stem #'thickness = #0.5
1804       e4 e
1805     } \\ {
1806       c4 c c c
1807     }
1808   >>
1809 }
1810 @end lilypond
1811
1812 @funindex \revert
1813 @cindex reverting overrides (オーバライドを元に戻す)
1814 @cindex overrides, reverting (オーバライドを元に戻す)
1815
1816 @code{\override} の効果は、@code{\revert} によって元に戻すことができます:
1817
1818 @lilypond[quote,verbatim,relative=2]
1819 c4
1820 \override Voice.Stem #'thickness = #3.0
1821 c4 c
1822 \revert Voice.Stem #'thickness
1823 c4
1824 @end lilypond
1825
1826 @code{\override} と @code{\revert} の効果は、@c
1827 その時点から影響を受けるコンテキストの中にある@c
1828 すべてのグラフィカル オブジェクトに適用されます:
1829
1830 @lilypond[quote,verbatim,relative=2]
1831 {
1832   <<
1833     {
1834       e4
1835       \override Staff.Stem #'thickness = #3.0
1836       e4 e e
1837     } \\ {
1838       c4 c c
1839       \revert Staff.Stem #'thickness
1840       c4
1841     }
1842   >>
1843 }
1844 @end lilypond
1845
1846 @funindex \once
1847 @cindex overriding for only one moment (一時的にオーバライドする)
1848
1849 @code{\once} を @code{\override} と共に用いることで、@c
1850 カレントの時間ステップだけに効果を与えることができます:
1851
1852 @lilypond[quote,verbatim,relative=2]
1853 {
1854   <<
1855     {
1856       \override Stem #'thickness = #3.0
1857       e4 e e e
1858     } \\ {
1859       c4
1860       \once \override Stem #'thickness = #3.0
1861       c4 c c
1862     }
1863   >>
1864 }
1865 @end lilypond
1866
1867
1868 @ignore
1869 Commands which change output generally look like
1870
1871 @example
1872 \override Voice.Stem #'thickness = #3.0
1873 @end example
1874
1875 @noindent
1876 To construct this tweak we must determine these bits of information:
1877
1878 @itemize
1879 @item the context: here @code{Voice}.
1880 @item the layout object: here @code{Stem}.
1881 @item the layout property: here @code{thickness}.
1882 @item a sensible value: here @code{3.0}.
1883 @end itemize
1884
1885 Some tweakable options are called @q{subproperties} and reside inside
1886 properties.  To tweak those, use commands in the form
1887
1888 @example
1889 \override Stem #'(details beamed-lengths) = #'(4 4 3)
1890 @end example
1891
1892 @cindex internal documentation
1893 @cindex finding graphical objects
1894 @cindex graphical object descriptions
1895 @cindex tweaking
1896 @funindex \override
1897 @cindex internal documentation
1898
1899 For many properties, regardless of the data type of the property, setting the
1900 property to false ( @code{##f} ) will result in turning it off, causing
1901 LilyPond to ignore that property entirely.  This is particularly useful for
1902 turning off grob properties which may otherwise be causing problems.
1903
1904 We demonstrate how to glean this information from the notation manual
1905 and the program reference.
1906 @end ignore
1907
1908 @seealso
1909 内部リファレンス:
1910 @rinternals{Backend}
1911
1912
1913 @node tweak コマンド
1914 @subsection @code{\tweak} コマンド
1915 @translationof The tweak command
1916
1917 @funindex \tweak
1918 @cindex tweaking (調整)
1919
1920 @code{\tweak} を用いたグラフィカル オブジェクト プロパティの変更は、@c
1921 コンテキストの中にあるすべてのグラフィカル オブジェクトに適用されます。@c
1922 しかしながら、@c
1923 影響を受けるコンテキストの中にあるすべてのグラフィカル オブジェクトではなく、@c
1924 1 つのグラフィカル オブジェクトだけに変更を適用したい場合もあります。@c
1925 そうするには、@code{\tweak} コマンドを用います。@c
1926 @code{\tweak} コマンドは以下のような構文を持ちます:
1927
1928 @example
1929 \tweak #'@code{grob-property} #@code{value}
1930 @end example
1931
1932 @code{\tweak} コマンドは、音楽の流れの中で
1933 @code{value} のすぐ後に現れるオブジェクトに変更を適用します。
1934
1935 @ignore
1936 In some cases, it is possible to take a short-cut for tuning
1937 graphical objects.  For objects that are created directly from
1938 an item in the input file, you can use the @code{\tweak} command.
1939 For example:
1940
1941 @lilypond[relative=2,verbatim,quote]
1942 < c
1943   \tweak #'color #red
1944   d
1945   g
1946   \tweak #'duration-log #1
1947   a
1948 > 4
1949 -\tweak #'padding #8
1950 -^
1951 @end lilypond
1952
1953
1954
1955 But the main use of the @code{\tweak} command is to modify just
1956 one of a number of notation elements which start at the same musical
1957 moment, like the notes of a chord, or tuplet brackets which start
1958 at the same time.
1959
1960 The @code{\tweak} command sets a property in the following object
1961 directly, without requiring the grob name or context to be
1962 specified.  For this to work, it is necessary for the @code{\tweak}
1963 command to remain immediately adjacent to the object to which it is
1964 to apply after the input file has been converted to a music stream.
1965 This is often not the case, as many additional elements are inserted
1966 into the music stream implicitly.  For example, when a note which is
1967 not part of a chord is processed, LilyPond implicitly inserts a
1968 @code{ChordEvent} event before the note, so separating the tweak
1969 from the note.  However, if chord symbols are placed round the
1970 tweak and the note, the @code{\tweak} command comes after the
1971 @code{ChordEvent} in the music stream, so remaining adjacent to the
1972 note, and able to modify it.
1973
1974 So, this works:
1975
1976 @lilypond[relative=2,verbatim,quote]
1977 <\tweak #'color #red c>4
1978 @end lilypond
1979
1980 @noindent
1981 but this does not:
1982
1983 @lilypond[relative=2,verbatim,quote]
1984 \tweak #'color #red c4
1985 @end lilypond
1986
1987 @end ignore
1988
1989 調整コマンドの構文と使用方法についての紹介は、@c
1990 @rlearning{調整手段} を参照してください。
1991
1992 同じようなオブジェクトがいくつか、同じ音楽タイミングで配置されている場合、@c
1993 @code{\override} コマンドでそれらの 1 つだけを変更することはできません
1994 -- @code{\tweak} コマンドを用いる必要があります。@c
1995 同じ音楽タイミングで複数出現する可能性があるオブジェクトには、@c
1996 以下のようなものがあります:
1997
1998 @c TODO expand to include any further uses of \tweak
1999 @itemize
2000 @item 和音の中にある音符の符頭
2001 @item 1 つの音符に付けられるアーティキュレーション記号
2002 @item 和音の中にある音符の間に付けられるタイ
2003 @item 同時に始まる連符の囲み
2004 @end itemize
2005
2006 @c TODO add examples of these
2007
2008 @cindex chord, modifying one note in (和音の中にある音符の 1 つを変更する)
2009
2010 以下の例では、和音の中にある符頭の 1 つの色を変更し、@c
2011 さらに他の符頭のタイプを変更しています:
2012
2013 @lilypond[relative=2,verbatim,quote]
2014 < c
2015   \tweak #'color #red
2016   d
2017   g
2018   \tweak #'duration-log #1
2019   a
2020 > 4
2021 @end lilypond
2022
2023 @code{\tweak} を用いて、スラーを変更することができます:
2024
2025 @lilypond[verbatim,quote,relative=1]
2026 c-\tweak #'thickness #5 ( d e f)
2027 @end lilypond
2028
2029
2030 @code{\tweak} コマンドが機能するためには、@c
2031 入力ファイルが音楽の流れに変換されたときに、@c
2032 @code{\tweak} コマンドのすぐ後に@c
2033 変更が適用されるオブジェクトが配置されている必要があります。
2034 LilyPond は、構文解釈処理時に、@c
2035 追加のオブジェクトを音楽の流れの中に挿入する場合があります。@c
2036 例えば、明示的には和音の一部になっていない音符を、@c
2037 LilyPond が音符の中に配置する場合があります。@c
2038 そのため、@code{\tweak} で変更される音符は、@c
2039 和音構造の中に配置されている必要があります:
2040
2041 @lilypond[relative=2,verbatim,quote]
2042 \tweak #'color #red c4
2043 <\tweak #'color #red c>4
2044 @end lilypond
2045
2046 @code{\tweak} コマンドは、@c
2047 入力ファイルの中で明示的に記述されていないオブジェクトを@c
2048 変更するために用いることはできません。@c
2049 特に、符幹、連桁、あるいは臨時記号を直接変更することはできません。@c
2050 なぜなら、それらは入力の中にある音楽要素の後ではなく、@c
2051 符頭の後に生成されるからです。@c
2052 さらに、音部記号や拍子記号を変更することもできません。@c
2053 なぜなら、コンテキストを指定するために必要とされる追加要素の自動挿入により、@c
2054 それらは前に配置された @code{\tweak} コマンドとは分離されるからです。@c
2055
2056 記譜要素の前に複数の @code{\tweak} コマンドを配置することができます
2057 -- それらはすべて効果を持ちます:
2058
2059 @lilypond[verbatim,quote,relative=1]
2060 c
2061 -\tweak #'style #'dashed-line
2062 -\tweak #'dash-fraction #0.2
2063 -\tweak #'thickness #3
2064 -\tweak #'color #red
2065  \glissando
2066 f'
2067 @end lilypond
2068
2069 入力ファイルのあるセクションから生成される音楽の流れ
2070 -- 自動的に挿入される要素も含めて --
2071 が、検証されます。@c
2072 @rextend{Displaying music expressions} を参照してください。@c
2073 これは、@code{\tweak} コマンドによって変更されるオブジェクトを決定するとき、@c
2074 あるいは、@c
2075 @code{\tweak} の適用で入力を調整する方法を決定するときに役に立つかもしれません。
2076
2077 @seealso
2078 学習マニュアル:
2079 @rlearning{調整手段}
2080
2081 拡張:
2082 @rextend{Displaying music expressions}
2083
2084 @knownissues
2085 @cindex tweaks in a variable (変数の中での調整)
2086
2087 @code{\tweak} コマンドを変数の中で用いることはできません。
2088
2089 @cindex tweaks in lyrics (歌詞の中での調整)
2090 @code{\tweak} コマンドを @code{\lyricmode} の中で用いることはできません。
2091
2092 @cindex tweaking control points (制御ポイントを調整する)
2093 @cindex control points, tweaking (制御ポイントを調整する)
2094
2095 @code{\tweak} コマンドは、和音の中で生成される複数のタイのうち、@c
2096 最初のタイだけに適用されます。
2097
2098
2099 @node set 対 override
2100 @subsection @code{\set} 対 @code{\override}
2101 @translationof set versus override
2102
2103 @c TODO -- This section is probably unnecessary now.
2104
2105 @ignore
2106 We have seen two methods of changing properties: @code{\set} and
2107 @code{\override}.  There are actually two different kinds of
2108 properties.
2109
2110 @code{fontSize} is a special property: it is equivalent to
2111 entering @code{\override ... #'font-size} for all pertinent
2112 objects.  Since this is a common change, the special
2113 property (modified with @code{\set}) was created.
2114
2115 @end ignore
2116
2117
2118 @node 連想配列を変更する
2119 @subsection 連想配列を変更する
2120 @translationof Modifying alists
2121
2122 ユーザが変更可能なプロパティの中には、@c
2123 内部的には @emph{連想配列} として存在しているものがあります
2124 -- 連想配列は @emph{キー} と @emph{値} のペアの配列を保持します。@c
2125 連想配列の構造は下記のとおりです:
2126
2127 @example
2128 '((@var{キー1} . @var{値1})
2129   (@var{キー2} . @var{値2})
2130   (@var{キー3} . @var{値3})
2131   @dots{})
2132 @end example
2133
2134 ある連想配列がグラフィカル オブジェクト プロパティまたは
2135 @code{\paper} 変数である場合、@c
2136 その連想配列の個々のキーを、他のキーに影響を与えることなく、@c
2137 変更することができます。
2138
2139 例えば、譜グループの中にある隣り合う譜間のスペースを減らすには、@c
2140 @code{StaffGrouper} グラフィカル オブジェクトの
2141 @code{staff-staff-spacing} プロパティを使用します。@c
2142 このプロパティは 4 つのキー
2143 -- @code{basic-distance}, @code{minimum-distance},
2144 @code{padding}, それに @code{stretchability} --
2145 を持つ連想配列です。@c
2146 このプロパティの標準設定は、@c
2147 内部リファレンスの @qq{Backend} セクションでリストアップされています
2148 (@rinternals{StaffGrouper} を参照してください):
2149
2150 @example
2151 '((basic-distance . 9)
2152   (minimum-distance . 7)
2153   (padding . 1)
2154   (stretchability . 5))
2155 @end example
2156
2157 譜間のスペースを小さくする方法の 1 つは、@c
2158 @code{basic-distance} キーの値 (@code{9}) を
2159 @code{minimum-distance} キーの値 (@code{7}) 近くまで減らすことです。@c
2160 個々のキーを変更するには、@emph{ネストされた宣言} を使います:
2161
2162 @c KEEP LY
2163 @lilypond[quote,verbatim]
2164 % デフォルトの譜間スペース
2165 \new PianoStaff <<
2166   \new Staff { \clef treble c''1 }
2167   \new Staff { \clef bass   c1   }
2168 >>
2169
2170 % 譜間スペースを減らします
2171 \new PianoStaff \with {
2172   % this is the nested declaration
2173   \override StaffGrouper #'staff-staff-spacing #'basic-distance = #7
2174 } <<
2175   \new Staff { \clef treble c''1 }
2176   \new Staff { \clef bass   c1   }
2177 >>
2178 @end lilypond
2179
2180 ネストされた宣言は、プロパティの他のキーに変更を加えることなく、@c
2181 指定されたキー (上の例では @code{basic-distance}) を更新します。
2182
2183 今度は、譜を重ならない範囲でできる限り近づけたいとします。@c
2184 最も簡単な方法は、連想配列の 4 つのキーすべてを 0 にセットすることです。@c
2185 しかしながら、4 つのネストされた宣言を記述する必要はありません。@c
2186 1 つの宣言でプロパティを丸ごと再定義することができます:
2187
2188 @lilypond[quote,verbatim]
2189 \new PianoStaff \with {
2190   \override StaffGrouper #'staff-staff-spacing =
2191     #'((basic-distance . 0)
2192        (minimum-distance . 0)
2193        (padding . 0)
2194        (stretchability . 0))
2195 } <<
2196   \new Staff { \clef treble c''1 }
2197   \new Staff { \clef bass   c1   }
2198 >>
2199 @end lilypond
2200
2201 連想配列の再定義でリストアップされなかったキーは、@c
2202 @emph{セットされなかった場合のデフォルト値} にリセットされます。@c
2203 @code{staff-staff-spacing} の場合、@c
2204 セットされなかったキーは 0 にリセットされます
2205 (@code{stretchability} は例外で、セットされなかった場合、@c
2206 @code{basic-distance} にリセットされます)。@c
2207 このため、以下の 2 つの宣言は等価です:
2208
2209 @example
2210 \override StaffGrouper #'staff-staff-spacing =
2211   #'((basic-distance . 7))
2212
2213 \override StaffGrouper #'staff-staff-spacing =
2214   #'((basic-distance . 7)
2215      (minimum-distance . 0)
2216      (padding . 0)
2217      (stretchability . 7))
2218 @end example
2219
2220 連想配列の再定義でリストアップされなかったキーがあることにより、@c
2221 初期化ファイルでセットされたり、@c
2222 入力ファイルがコンパイルされるときに読み込まれた@c
2223 標準設定が (意図せずに) 削除される可能性があります。@c
2224 上の例では、@code{padding} と @code{minimum-distance} の標準設定
2225 (@file{scm/define-grobs.scm} で定義されます) は、@c
2226 @emph{セットされなかった場合のデフォルト値} (両方とも 0) にリセットされます。@c
2227 プロパティや (任意のサイズ) 連想配列を定義した場合、@c
2228 セットされなかったキー値はすべて @emph{セットされなかった場合のデフォルト値}
2229 にリセットされます。@c
2230 そうすることを意図しているのでない限り、@c
2231 ネストされた宣言を用いてキー値を個々に更新する方が安全です。
2232
2233 @warning{ネストされた宣言は、コンテキスト プロパティ連想配列
2234 (@code{beamExceptions}, @code{keySignature}, @code{timeSignatureSettings} 等)
2235 に対しては機能しません。@c
2236 これらのプロパティを変更するには、@c
2237 連想配列として丸ごと再定義するしかありません。}
2238
2239
2240 @node 役に立つコンセプトとプロパティ
2241 @section 役に立つコンセプトとプロパティ
2242 @translationof Useful concepts and properties
2243
2244 @menu
2245 * 入力モード::
2246 * 向きと配置::
2247 * 距離と距離の単位::
2248 * 譜記号プロパティ::
2249 * スパナ::
2250 * オブジェクトの可視性::
2251 * ライン スタイル::
2252 * オブジェクトを回転させる::
2253 @end menu
2254
2255
2256 @node 入力モード
2257 @subsection 入力モード
2258 @translationof Input modes
2259
2260 入力ファイルの中に保持されている記譜を解釈する方法は、@c
2261 カレントの入力モードによって決定されます。
2262
2263 @strong{和音モード}
2264
2265 このモードは @code{\chordmode} コマンドで有効になり、@c
2266 入力はコード記譜法の構文で解釈されるようになります。@c
2267 @ref{Chord notation} を参照してください。@c
2268 コードは、譜面上に音符として描画されます。
2269
2270 和音モードは @code{\chords} コマンドでも有効になります。@c
2271 このコマンドは新たに @code{ChordNames} コンテキストも作成します。@c
2272 入力はコード記譜法の構文で解釈され、@c
2273 さらに @code{ChordNames} コンテキストの中にコード ネームとして描画されます。@c
2274 @ref{Printing chord names} を参照してください。
2275
2276 @strong{ドラム モード}
2277
2278 このモードは @code{\drummode} コマンドで有効になり、@c
2279 入力はドラム記譜法の構文で解釈されるようになります。@c
2280 @ref{Basic percussion notation} を参照してください。
2281
2282 また、ドラム モードは @code{\drums} コマンドでも有効になります。@c
2283 このモードも新たに @code{DrumStaff} コンテキストを作成し、@c
2284 コマンドの後に続く入力をドラム記譜法の構文で解釈して、@c
2285 ドラム譜上にドラム記号として描画します。@c
2286 @ref{Basic percussion notation} を参照してください。
2287
2288 @strong{音型モード}
2289
2290 このモードは @code{\figuremode} コマンドで有効になり、@c
2291 入力は通奏低音の構文で解釈されるようになります。@c
2292 @ref{Entering figured bass} を参照してください。
2293
2294 また、音型モードは @code{\figures} コマンドでも有効になります。@c
2295 このモードも新たに @code{FiguredBass} コンテキストを作成し、@c
2296 コマンドの後に続く入力を通奏低音の構文で解釈して、@c
2297 @code{FiguredBass} コンテキストの中に通奏低音記号として描画します。@c
2298 @ref{Introduction to figured bass} を参照してください。
2299
2300 @strong{フレットとタブ モード}
2301
2302 フレット記号とタブ記号を入力するための特別な入力モードはありません。
2303
2304 タブ図を作成するには、音符モードで音符や和音を入力して、@c
2305 それらを @code{TabStaff} コンテキストの中に描画します。@c
2306 @ref{Default tablatures} を参照してください。
2307
2308 譜の上にフレット図を作成するには、2 つの方法があります。@c
2309 @code{FretBoards} コンテキスト
2310 (@ref{Automatic fret diagrams} を参照してください) を用いるか、@c
2311 あるいは、音符の上に @code{\fret-diagram} コマンド
2312 (@ref{Fret diagram markups}) を用いてフレット図をマークアップとして@c
2313 入力するかのどちらかになります。
2314
2315 @strong{歌詞モード}
2316
2317 このモードは @code{\lyricmode} コマンドで有効になり、@c
2318 入力はオプションで演奏時間を持つ歌詞音節として解釈され、@c
2319 歌詞識別子に関連付けされます。@c
2320 通奏低音の構文で解釈されるようになります。@c
2321 @ref{Vocal music} を参照してください。
2322
2323 また、歌詞モードは @code{\addlyrics} コマンドでも有効になります。@c
2324 このモードも新たに @code{Lyrics} コンテキストを作成し、@c
2325 暗黙的に @code{lyricsto} コマンドを作成します。@c
2326 @code{lyricsto} は、後に続く歌詞を、前にある音楽に関連付けします。
2327
2328 @strong{マークアップ モード}
2329
2330 このモードは @code{\markup} コマンドで有効になり、@c
2331 入力はマークアップの構文で解釈されるようになります。@c
2332 @ref{Text markup commands} を参照してください。
2333
2334 @c silly work-around for texinfo broken-ness
2335 @c (@strong{Note...} causes a spurious cross-reference in Info)
2336 @strong{音符モード}
2337
2338 このモードはデフォルトのモードであり、@c
2339 @code{\notemode} コマンドで有効にすることもできます。@c
2340 入力はピッチ、演奏時間、マークアップなどとして解釈され、@c
2341 譜面上に音楽記譜として写植されます。
2342
2343 通常、音符モードを明示的に指定する必要はありません。@c
2344 しかしながら、ある特定の状況
2345 -- 例えば、歌詞モード、和音モード、あるいは他のモードを使っていて、@c
2346 音符モードの構文でしか入力できないものを入力しようとしている場合 --
2347 では、音符モードを明示的に指定することが有用な場合があります。
2348
2349 例えば、合唱曲で節ごとに強弱記号を指定するには、@c
2350 音符モードで入力して記号を解釈させる必要があります:
2351
2352 @lilypond[verbatim,relative=2,quote]
2353 { c4 c4 c4 c4 }
2354 \addlyrics {
2355   \notemode{\set stanza = \markup{ \dynamic f 1. } }
2356   To be sung loudly
2357 }
2358 \addlyrics {
2359   \notemode{\set stanza = \markup{ \dynamic p 2. } }
2360   To be sung quietly
2361 }
2362 @end lilypond
2363
2364
2365 @node 向きと配置
2366 @subsection 向きと配置
2367 @translationof Direction and placement
2368
2369 楽譜を写植しているとき、多くの要素の向きと配置には選択の余地があります。@c
2370 例えば、音符の符幹は上向きあるいは下向きにすることができ、@c
2371 歌詞、強弱記号、他の表現記号は譜の上あるいは下に配置することができ、@c
2372 テキストは左揃え、右揃え、あるいは中央揃えにすることができる、などです。@c
2373 これらの選択のほとんどは LilyPond によって自動的に決定されますが、@c
2374 強制的に向きや配置を指定することが望ましい場合もあります。
2375
2376 @strong{アーティキュレーションの方向指示子}
2377
2378 デフォルトでは、アーティキュレーションのいくつかの向きは常に上または下に@c
2379 なっています (例えば、強弱記号やフェルマータ)。@c
2380 一方、他のアーティキュレーションは、符幹の向きによって、@c
2381 向きが上下します (スラーやアクセントなど)。
2382
2383 @c TODO Add table showing these
2384
2385 アーティキュレーションの前に @emph{方向指示子} を置くことで、@c
2386 デフォルトの向きをオーバライドすることができます。@c
2387 3 つの方向指示子があります: @code{^} (@qq{上向き} を意味します)、@c
2388 @code{_} (@qq{下向き} を意味します)、@c
2389 それに @code{-} (@qq{デフォルトの向き} を意味します) です。@c
2390 通常、方向指示子は省略することができ、その場合は @code{-} と見なされます。@c
2391 しかしながら、以下のものの前には @strong{常に} 方向指示子を置く必要があります:
2392
2393 @itemize
2394 @item @code{\tweak} コマンド
2395 @item @code{\markup} コマンド
2396 @item @code{\tag} コマンド
2397 @item 文字列マークアップ。例えば、-"string"
2398 @item 運指指示。例えば、@code{-1}
2399 @item アーティキュレーションの短縮記法。例えば、@code{-.}, @code{->}, @code{--}
2400 @end itemize
2401
2402 方向指示子は、その後にくる音符だけに効果を持ちます:
2403
2404 @lilypond[verbatim,quote,relative=2]
2405 c2( c)
2406 c2_( c)
2407 c2( c)
2408 c2^( c)
2409 @end lilypond
2410
2411 @strong{方向プロパティ}
2412
2413 多くのレイアウト オブジェクトの位置や向きは、@c
2414 @code{direction} プロパティによって制御されます。
2415
2416 @code{direction} プロパティの値は、@c
2417 @code{1} (@qq{上向き} あるいは @qq{上} を意味します)、@c
2418 @code{-1} (@qq{下向き} あるいは @qq{下} を意味します)
2419 にセットすることができます。@c
2420 記号 @code{UP} と @code{DOWN} は、@c
2421 それぞれ @code{1} と @code{-1} の代わりに用いることができます。@c
2422 デフォルトの向きを指定するには、@c
2423 @code{direction} を @code{0} あるいは @code{CENTER} にセットします。@c
2424 このような方法を用いる代わりに、@c
2425 多くの場合で、向きを指定するための前置コマンドが存在しています。@c
2426 それらはすべて以下のような形式をとります:
2427
2428 @noindent
2429 @code{\xxxUp}, @code{xxxDown}, @code{xxxNeutral}
2430
2431 @noindent
2432 ここで、@code{xxxNeutral} は @qq{デフォルトの向きを使用する}
2433 ことを意味します。@c
2434 @rlearning{譜内部オブジェクト} を参照してください。
2435
2436 いくつかのケースでは
2437 -- 一般的な例としてはアルペジオしかありません --
2438 @code{direction} プロパティの値は、@c
2439 オブジェクトが親オブジェクトの左右どちらに配置されるかを指定します。
2440 この場合、@code{-1} あるいは @code{LEFT} は @qq{左側} を意味し、@c
2441 @code{1} あるいは @code{RIGHT} は @qq{右側} を意味します。@c
2442 @code{0} あるいは @code{CENTER} は、前のケースと同様に、@c
2443 @qq{デフォルトの向きを使用する} ことを意味します。
2444
2445 @ignore
2446 These all have side-axis set to #X
2447 AmbitusAccidental - direction has no effect
2448 Arpeggio - works
2449 StanzaNumber - not tried
2450 TrillPitchAccidental - not tried
2451 TrillPitchGroup - not tried
2452 @end ignore
2453
2454 これらの指示子は、キャンセルされるまで効果を持ちます。
2455
2456 @lilypond[verbatim,quote,relative=2]
2457 c2( c)
2458 \slurDown
2459 c2( c)
2460 c2( c)
2461 \slurNeutral
2462 c2( c)
2463 @end lilypond
2464
2465 多声の音楽では、一般的にオブジェクトの向きを変えるよりも明示的に
2466 @code{voice} を指定した方が良いです。@c
2467 更なる情報は、@ref{Multiple voices} を参照してください。
2468
2469 @seealso
2470 学習マニュアル:
2471 @rlearning{Within-staff objects}
2472
2473 記譜法リファレンス:
2474 @ref{Multiple voices}
2475
2476
2477 @node 距離と距離の単位
2478 @subsection 距離と距離の単位
2479 @translationof Distances and measurements
2480
2481 @cindex distances, absolute (絶対距離)
2482 @cindex distances, scaled (相対距離)
2483
2484 @funindex \mm
2485 @funindex \cm
2486 @funindex \in
2487 @funindex \pt
2488
2489 LilyPond における距離には 2 つのタイプがあります: 絶対距離と相対距離です。
2490
2491 絶対距離は、マージン、インデント、それにその他の詳細なページ レイアウトを@c
2492 指定するために使用され、デフォルトではミリメートルで指定されます。
2493 距離は以下の単位で指定することもできます: @code{\mm}, @code{\cm},
2494 @code{\inch} (インチ), それに @code{\pt} (ポイント。1/73.27 インチ) です。@c
2495 また、ページ レイアウトにおける距離は、@c
2496 値の後ろに @code{\staff-space} を付けることにより、
2497 比率で指定することもできます (次の段落を参照してください)。@c
2498 ページ レイアウトについての詳細は、@c
2499 @ref{ページ レイアウト} に記述されています。
2500
2501 相対距離は常に譜スペースを単位として指定されます
2502  -- 稀に、半譜スペースが使用されます。@c
2503 譜スペースは隣り合う 2 本の譜線間の距離です。@c
2504 グローバル譜サイズを設定することにより、@c
2505 デフォルト値をグローバルに変更することができます。@c
2506 また、@code{StaffSymbol} の @code{staff-space} プロパティを@c
2507 変更することにより、譜スペースをローカルにオーバライドすることもできます。@c
2508 相対距離は、グローバル譜サイズや @code{StaffSymbol} の @code{staff-space}
2509 プロパティのいずれかが変更されると、自動的に変更されます。@c
2510 しかしながら、フォントの比率はグローバル譜サイズが変更された場合にのみ、@c
2511 自動的に変更されます。@c
2512 そのため、グローバル譜サイズは@c
2513 容易に描画される楽譜全体のサイズを変更することができます。@c
2514 グローバル譜サイズを設定するための手段については、@c
2515 @ref{譜サイズを設定する} を参照してください。
2516
2517 @funindex magstep
2518
2519 楽譜のある部分だけの比率を変更したいのなら
2520 -- 例えば、オッシア セクションや脚注で --
2521 単純にグローバル譜サイズを変更するわけにはいきません。@c
2522 なぜなら、グローバル譜サイズを変更すると、楽譜全体が影響を受けるからです。@c
2523 そのような場合、@code{StaffSymbol} の @code{staff-space} プロパティと@c
2524 フォントのサイズをオーバライドすることにより、サイズを変更します。@c
2525 フォント サイズの変更を @code{staff-space} 単位の変更に変換するには、@c
2526 Scheme 関数 @code{magstep} を使用することができます。@c
2527 この関数の説明と使用例については、@c
2528 @rlearning{オブジェクトの長さと太さ} を参照してください。
2529
2530 @seealso
2531 学習マニュアル:
2532 @rlearning{オブジェクトの長さと太さ}
2533
2534 記譜法リファレンス:
2535 @ref{ページ レイアウト},
2536 @ref{譜サイズを設定する}
2537
2538
2539 @node 譜記号プロパティ
2540 @subsection 譜記号プロパティ
2541 @translationof Staff symbol properties
2542
2543 @cindex adjusting staff symbol (譜記号を調節する)
2544 @cindex drawing staff symbol (譜記号を描画する)
2545 @cindex staff symbol, setting of (譜記号の設定)
2546
2547 @c TODO Extend or remove this section.  See also NR 1.6.2 Staff symbol
2548 @c      Need to think of uses for these properties.  Eg 'line-positions
2549 @c      is used in a snippet to thicken centre line.
2550 @c      If retained, add @ref to here in 1.6.2  -td
2551
2552 譜線の垂直位置と譜線の本数を同時に定義することができます。@c
2553 以下の例が示すように、音符の位置は譜線の位置には影響されません。
2554
2555 @warning{@code{'line-positions} プロパティは @code{'line-count} を@c
2556 オーバライドします。@c
2557 譜線の本数は、@code{'line-positions} の値リストの中にある要素数によって、@c
2558 暗黙的に定義されます。}
2559
2560 @lilypond[verbatim,quote,relative=1]
2561 \new Staff \with {
2562   \override StaffSymbol #'line-positions = #'(7 3 0 -4 -6 -7)
2563 }
2564 { a4 e' f b | d1 }
2565 @end lilypond
2566
2567 譜の幅を変更することができます。@c
2568 単位は譜スペースです。@c
2569 譜内部のオブジェクトのスペースは、この設定によって影響を受けません。
2570
2571 @lilypond[verbatim,quote,relative=1]
2572 \new Staff \with {
2573   \override StaffSymbol #'width = #23
2574 }
2575 { a4 e' f b | d1 }
2576 @end lilypond
2577
2578
2579 @node スパナ
2580 @subsection スパナ
2581 @translationof Spanners
2582
2583 多くの音楽記譜オブジェクトは、複数の音符あるいは複数の小節にまたがって、@c
2584 広がりを持ちます。@c
2585 例としては、スラー、連桁、連譜の囲み、volta 繰り返しの囲み、クレッシェンド、@c
2586 トリル、それにグリッサンドがあります。@c
2587 そのようなオブジェクトは総称して @qq{スパナ} と呼ばれ、@c
2588 それらの見た目と振る舞いを制御するための特殊なプロパティを持ちます。@c
2589 これらのプロパティのいくつかは、すべてのスパナに共通しています。@c
2590 他のプロパティはスパナの部分集合に限定されています。
2591
2592 すべてのスパナは @code{spanner-interface} をサポートします。@c
2593 いくつかのスパナ -- 2 つのオブジェクトの間に直線を描くもの -- は、さらに、@c
2594 @code{line-spanner-interface} をサポートします。
2595
2596 @unnumberedsubsubsec @code{spanner-interface} を使用する
2597
2598 このインターフェイスは、@c
2599 いくつかのスパナに適用される 2 つのプロパティを提供します。
2600
2601 @strong{@i{@code{minimum-length} プロパティ}}
2602
2603 スパナの最短の長さは、@code{minimum-length} プロパティによって指定されます。@c
2604 通常、このプロパティを増加させると、@c
2605 スパナの両端の間にある音符の間隔は増加します。@c
2606 しかしながら、このオーバライドは多くのスパナで効果を持ちません。@c
2607 なぜなら、それらの長さは他の要素によって決定されるからです。@c
2608 以下に効果を持つ例を 2, 3 示します。
2609
2610 @ignore
2611 Works for:
2612   Tie
2613   MultiMeasureRest
2614   Hairpin
2615   Slur
2616   PhrasingSlur
2617
2618 Works as long as callback is made:
2619   Glissando
2620   Beam
2621
2622 Works not at all for:
2623   LyricSpace
2624   LyricHyphen
2625   LyricExtender
2626   TextSpanner
2627   System
2628
2629 @end ignore
2630
2631 @c KEEP LY
2632 @lilypond[verbatim,quote,relative=2]
2633 a~a
2634 a
2635 % タイの長さを増加させます
2636 -\tweak #'minimum-length #5
2637 ~a
2638 @end lilypond
2639
2640 @c KEEP LY
2641 @lilypond[verbatim,quote,relative=2]
2642 a1
2643 \compressFullBarRests
2644 R1*23
2645 % 休符バーの長さを増加させます
2646 \once \override MultiMeasureRest #'minimum-length = #20
2647 R1*23
2648 a1
2649 @end lilypond
2650
2651 @c KEEP LY
2652 @lilypond[verbatim,quote,relative=2]
2653 a \< a a a \!
2654 % ヘアピンの長さを増加させます
2655 \override Hairpin #'minimum-length = #20
2656 a \< a a a \!
2657 @end lilypond
2658
2659 さらに、このオーバライドはスラーとフレージング スラーの長さを@c
2660 増加させるためにも使用されます:
2661
2662 @lilypond[verbatim,quote,relative=2]
2663 a( a)
2664 a
2665 -\tweak #'minimum-length #5
2666 ( a)
2667
2668 a\( a\)
2669 a
2670 -\tweak #'minimum-length #5
2671 \( a\)
2672 @end lilypond
2673
2674 いくつかのレイアウト オブジェクトでは、@c
2675 @code{minimum-length} プロパティは、@c
2676 @code{set-spacing-rods} プロシージャが明示的に呼び出された場合にのみ@c
2677 効果を持ちます。@c
2678 このプロシージャを呼び出すには、@code{springs-and-rods} プロパティに@c
2679 @code{ly:spanner::set-spacing-rods} をセットしておく必要があります。@c
2680 例えば、グリッサンドの最短長は、@c
2681 @code{springs-and-rods} プロパティが設定されていない限り、@c
2682 効果を持ちません:
2683
2684 @c KEEP LY
2685 @lilypond[verbatim,quote,relative=1]
2686 % デフォルト
2687 e \glissando c'
2688
2689 % 単独では効果を持ちません
2690 \once \override Glissando #'minimum-length = #20
2691 e, \glissando c'
2692
2693 % 以下の両方のオーバライドが存在する場合にのみ、効果を持ちます
2694 \once \override Glissando #'minimum-length = #20
2695 \once \override Glissando #'springs-and-rods = #ly:spanner::set-spacing-rods
2696 e, \glissando c'
2697 @end lilypond
2698
2699 @code{Beam} オブジェクトでも同じことが言えます:
2700
2701 @c KEEP LY
2702 @lilypond[verbatim,quote,relative=1]
2703 % 単独では効果を持ちません
2704 \once \override Beam #'minimum-length = #20
2705 e8 e e e
2706
2707 % 以下の両方のオーバライドが存在する場合にのみ、効果を持ちます
2708 \once \override Beam #'minimum-length = #20
2709 \once \override Beam #'springs-and-rods = #ly:spanner::set-spacing-rods
2710 e8 e e e
2711 @end lilypond
2712
2713 @strong{@i{@code{to-barline} プロパティ}}
2714
2715 @code{spanner-interface} の 2 番目に有用なプロパティは
2716 @code{to-barline} です。@c
2717 デフォルトではこのプロパティは真であり、@c
2718 小節の最初の音符のところで終了するヘアピンや他のスパナは@c
2719 直前の小節線のところで終了させられます。@c
2720 偽に設定すると、スパナは小節線を越えて、音符のところで終了します:
2721
2722 @lilypond[verbatim,quote,relative=2]
2723 a \< a a a a \! a a a \break
2724 \override Hairpin #'to-barline = ##f
2725 a \< a a a a \! a a a
2726 @end lilypond
2727
2728 このプロパティはすべてのスパナに対して効果を持つわけではありません。@c
2729 例えば、スラーやフレージング スラー、@c
2730 あるいは小節線で終了させることに意味が無い他のスパナに対して、@c
2731 このプロパティを @code{#t} に設定しても効果がありません。
2732
2733 @unnumberedsubsubsec @code{line-spanner-interface} を使用する
2734
2735 @code{line-spanner-interface} をサポートするオブジェクトには@c
2736 以下のものがあります:
2737
2738 @itemize
2739 @item @code{DynamicTextSpanner}
2740 @item @code{Glissando}
2741 @item @code{TextSpanner}
2742 @item @code{TrillSpanner}
2743 @item @code{VoiceFollower}
2744 @end itemize
2745
2746 これらのスパナのステンシルを描画する責任を持つルーチンは
2747 @code{ly:line-interface::print} です。@c
2748 このルーチンはスパナの両端の位置を綿密に決定し、@c
2749 求めに応じたスタイルでそれらの間に線を描きます@c
2750 スパナの両端の位置はオンザフライ (その場、その時々) で算出されますが、@c
2751 それらの Y 座標をオーバライドすることができます。@c
2752 指定する必要のあるプロパティは、@c
2753 プロパティ階層内で 2 階層下にネストされていますが、@c
2754 この @code{\override} コマンドは非常にシンプルです:
2755
2756 @lilypond[relative=2,quote,verbatim]
2757 e2 \glissando b
2758 \once \override Glissando #'(bound-details left Y) = #3
2759 \once \override Glissando #'(bound-details right Y) = #-2
2760 e2 \glissando b
2761 @end lilypond
2762
2763 @code{Y} プロパティの単位は @code{staff-space} であり、@c
2764 譜の中央線が 0 位置です。@c
2765 グリッサンドでは、スパナの両端は各符頭の中心であり、@c
2766 @code{Y} はそれらの点を上下させます。
2767
2768 @code{Y} が設定されていない場合、@c
2769 値はスパナの両端の垂直位置から算出されます。
2770
2771 改行の場合、終点の @code{Y} の値は @code{bound-details} の@c
2772 部分リスト @code{left-broken} や @code{right-broken} のによって指定されます。@c
2773 例を示します:
2774
2775 @lilypond[relative=2,ragged-right,verbatim,fragment]
2776 \override Glissando #'breakable = ##t
2777 \override Glissando #'(bound-details right-broken Y) = #-3
2778 c1 \glissando \break
2779 f1
2780 @end lilypond
2781
2782
2783 @code{bound-details} プロパティの部分リスト @code{left} や @code{right} の@c
2784 下位プロパティのいくつかは、@code{Y} と同じ方法で変更することができます:
2785
2786 @table @code
2787 @item Y
2788 終点の Y 座標を、@c
2789 譜の中央線からの @code{staff-space} オフセットで、設定します。@c
2790 デフォルトでは、終点オブジェクトの中心です。@c
2791 ですから、グリッサンドは符頭の中心に向かって進みます。
2792
2793 水平方向に広がるスパナ -- テキスト スパナやトリル スパナなど --
2794 では、この値は 0 に固定されています。
2795
2796 @item attach-dir
2797 スパナのラインがオブジェクトの左右どちらから始まり、終わるのかを決定します。@c
2798 @code{-1} (あるいは @code{LEFT}) であれば、@c
2799 ラインは符頭の左側から開始あるいは終了します。
2800
2801 @item X
2802 終点の絶対 X 座標です。@c
2803 通常、オンザフライ (その場、その時々) で算出され、@c
2804 これをオーバライドしてもあまり意味がありません。
2805
2806 @item stencil
2807 ライン スパナは開始点や終了点で記号を持つ場合があり、@c
2808 その記号はこのサブ プロパティに保持されています。@c
2809 このサブ プロパティは内部で使用するためのものです。@c
2810 このサブ プロパティの代わりに @code{text} を使用することを推奨します。
2811
2812 @item text
2813 ステンシルを作成するために評価されるマークアップです。@c
2814 水平スパナに @i{cresc.}, @i{tr} それに他のテキストを配置するために使用されます。
2815
2816 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2817 \override TextSpanner #'(bound-details left text)
2818    = \markup { \small \bold Slower }
2819 c2\startTextSpan b c a\stopTextSpan
2820 @end lilypond
2821
2822 @item stencil-align-dir-y
2823 @item stencil-offset
2824 これらの 1 つを設定しなければ、@c
2825 ステンシルは、@code{X} と @code{Y} サブ プロパティで定義されたとおりに、@c
2826 ラインに中央揃えで、終点に配置されます。@c
2827 @code{stencil-align-dir-y} あるいは @code{stencil-offset} の@c
2828 どちらかを設定すると、@c
2829 記号が上下します:
2830
2831 @lilypond[relative=1,fragment,verbatim]
2832 \override TextSpanner
2833   #'(bound-details left stencil-align-dir-y) = #-2
2834 \override TextSpanner
2835   #'(bound-details right stencil-align-dir-y) = #UP
2836
2837 \override TextSpanner
2838   #'(bound-details left text) = #"ggg"
2839 \override TextSpanner
2840   #'(bound-details right text) = #"hhh"
2841 c4^\startTextSpan c c c \stopTextSpan
2842 @end lilypond
2843
2844 予期される結果とは逆に、@c
2845 負の値はテキストを @emph{上げる} ということに注意してください。@c
2846 なぜなら、@code{-1} あるいは @code{DOWN} は@c
2847 テキストの @emph{下端} をスパナ ラインに揃え、
2848 @code{1} あるいは @code{UP} は@c
2849 テキストの @emph{上端} をスパナ ラインに揃えるからです。
2850
2851 @item arrow
2852 このサブ プロパティに @code{#t} をセットするとラインの終点に矢印が描かれます。
2853
2854 @item padding
2855 このサブ プロパティはラインの終点と実際の終点の間のスペースを制御します。@c
2856 パディングがなければ、グリッサンドは両端の符頭の中心から描かれます。
2857
2858 @end table
2859
2860 音楽関数 @code{\endSpanners} は@c
2861 直後の音符から始まるスパナをすぐに終了させます。@c
2862 ちょうど 1 音符分でスパナを終了させますが、@c
2863 @code{to-barline} が真で、かつ、次の音符の前に小節線がある場合は@c
2864 その小節線のところでスパナを終了させます。
2865
2866 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
2867 \endSpanners
2868 c2 \startTextSpan c2 c2
2869 \endSpanners
2870 c2 \< c2 c2
2871 @end lilypond
2872
2873 @code{\endSpanners} を使用している場合、@c
2874 @code{\startTextSpan} を @code{\endTextSpan} で閉じる必要はなく、@c
2875 ヘアピンを @code{\!} で閉じる必要もありません。
2876
2877 @seealso
2878 内部リファレンス:
2879 @rinternals{TextSpanner},
2880 @rinternals{Glissando},
2881 @rinternals{VoiceFollower},
2882 @rinternals{TrillSpanner},
2883 @rinternals{line-spanner-interface}
2884
2885
2886 @node オブジェクトの可視性
2887 @subsection オブジェクトの可視性
2888 @translationof Visibility of objects
2889
2890 @cindex objects, visibility of (オブジェクトの可視性)
2891 @cindex grobs, visibility of (グラフィカル オブジェクトの可視性)
2892 @cindex visibility of objects (オブジェクトの可視性)
2893
2894 レイアウト オブジェクトの可視性を制御する主な方法は 4 つあります:
2895 オブジェクトのステンシルを削除する方法、オブジェクトを透明にする方法、@c
2896 オブジェクトの色を白にする方法、あるいは、@c
2897 オブジェクトの @code{break-visibility} プロパティをオーバライドする方法です。
2898 最初の 3 つの方法はすべてのレイアウト オブジェクトに適用されますが、@c
2899 最後の方法はいくつかの -- @emph{改行可能な} オブジェクト --
2900 だけに適用されます。@c
2901 学習マニュアルでは、これら 4 つのテクニックについて紹介しています。@c
2902 @rlearning{オブジェクトの可視性と色} を参照してください。
2903
2904 さらに、特定のレイアウト オブジェクト特有のテクニックがいくつかあります。@c
2905 それらについては、特別な考慮でカバーされています。
2906
2907 @menu
2908 * ステンシルを削除する::
2909 * オブジェクトを透明にする::
2910 * オブジェクトを白で描く::
2911 * break-visibility を用いる::
2912 * 特別な考慮を必要とするもの::
2913 @end menu
2914
2915
2916 @node ステンシルを削除する
2917 @unnumberedsubsubsec ステンシルを削除する
2918 @translationof Removing the stencil
2919
2920 @cindex stencil, removing (ステンシルを削除する)
2921
2922 レウアウト オブジェクトはそれぞれステンシル プロパティを持ちます。@c
2923 デフォルトでは、@c
2924 このプロパティはそのオブジェクトを描画する特殊な関数にセットされています。@c
2925 このプロパティが @code{#f} にオーバライドされた場合、@c
2926 関数は呼び出されず、そのオブジェクトは描画されません。@c
2927 @code{\rever} でデフォルトの動作に戻すことができます。
2928
2929 @lilypond[quote,verbatim,relative=1]
2930 a1 a
2931 \override Score.BarLine #'stencil = ##f
2932 a a
2933 \revert Score.BarLine #'stencil
2934 a a a
2935 @end lilypond
2936
2937 @node オブジェクトを透明にする
2938 @unnumberedsubsubsec オブジェクトを透明にする
2939 @translationof Making objects transparent
2940
2941 @cindex transparent, making objects (オブジェクトを透明にする)
2942
2943 レイアウト オブジェクトはそれぞれ @code{transparent} プロパティを持っていて、@c
2944 デフォルトでは @code{#f} にセットされています。@c
2945 @code{#t} にセットされると、そのオブジェクトはスペースを占めたままですが、@c
2946 不可視になります。
2947
2948 @lilypond[quote,verbatim,relative=2]
2949 a4 a
2950 \once \override NoteHead #'transparent = ##t
2951 a a
2952 @end lilypond
2953
2954 @node オブジェクトを白で描く
2955 @unnumberedsubsubsec オブジェクトを白で描く
2956 @translationof Painting objects white
2957
2958 @cindex objects, coloring (オブジェクトに色を付ける)
2959 @cindex coloring objects (オブジェクトに色を付ける)
2960 @cindex layers (レイヤ)
2961 @cindex printing order (描画の順番)
2962 @cindex overwriting objects (オブジェクトを上書きする)
2963 @cindex objects, overwriting (オブジェクトを上書きする)
2964 @cindex grobs, overwriting (グラフィカル オブジェクトを上書きする)
2965
2966 レイアウト オブジェクトはそれぞれ @code{color} プロパティを持っていて、@c
2967 デフォルトでは @code{black} にセットされています。@c
2968 このプロパティが @code{white} にセットされてると、@c
2969 そのオブジェクトは白い背景と区別が付かなくなります。@c
2970 しかしながら、そのオブジェクトが他のオブジェクトと交差している場合、@c
2971 交差している場所の色はオブジェクトの描画順序によって決定されます。@c
2972 これにより、以下に示すように、@c
2973 白いオブジェクトの画像が幽霊のように浮かび上がることがあります:
2974
2975 @lilypond[quote,verbatim,relative=2]
2976 \override Staff.Clef #'color = #white
2977 a1
2978 @end lilypond
2979
2980 オブジェクトの描画順序を変更することにより、これを回避することができます。@c
2981 すべてのレイアウト オブジェクトは @code{layer} プロパティを持っており、@c
2982 このプロパティには整数がセットされています。@c
2983 より小さな値の @code{layer} を持つオブジェクトが最初に描画され、@c
2984 より大きな値の @code{layer} を持つオブジェクトが後になってから描画されます。@c
2985 このため、@c
2986 より大きな値を持つオブジェクトがより小さな値を持つオブジェクトを上書きします。@c
2987 デフォルトでは、@c
2988 たいていのオブジェクトの @code{layer} には @code{1} が代入されています。@c
2989 しかしながら、いくつかのオブジェクト
2990 -- @code{StaffSymbol} や @code{BarLine} など --
2991 には @code{0} が代入されています。@c
2992 同じ値の @code{layer} を持つオブジェクトを描画する順番は不確定です。
2993
2994 上記の例において、白い音部記号
2995 (この @code{layer} のデフォルト値は @code{1} です)
2996 は譜線 @c
2997 (この @code{layer} のデフォルト値は @code{0} です)
2998 の後に描画されます。@c
2999 そのため、音部記号は譜線を上書きしています。@c
3000 これを変更するには、@code{Clef} オブジェクトの @code{layer} に@c
3001 より小さな値 -- 例えば、@code{-1} -- を与えて、@c
3002 音部記号を先に描画させる必要があります:
3003
3004 @lilypond[quote,verbatim,relative=2]
3005 \override Staff.Clef #'color = #white
3006 \override Staff.Clef #'layer = #-1
3007 a1
3008 @end lilypond
3009
3010 @node break-visibility を用いる
3011 @unnumberedsubsubsec break-visibility を用いる
3012 @translationof Using break-visibility
3013
3014 @c TODO Add making other objects breakable
3015
3016 @cindex break-visibility
3017
3018 たいていのレイアウト オブジェクトは 1 回だけ描画されます。@c
3019 しかしながら、小節線、音部記号、拍子記号、それに調号などのオブジェクトは、@c
3020 改行が起こると 2 回描画する必要があります
3021 -- 行の最後で 1 回、次の行の最初でもう 1 回。@c
3022 そのようなオブジェクトは @emph{改行可能} と呼ばれ、@c
3023 それらのオブジェクトが描画される可能性がある 3 つの場所
3024 -- 行の先頭、行の途中 (それらが変更された場合)、@c
3025 それに、行の最後 (そこで変更が行われた場合) --
3026 における可視性を制御する @code{break-visibility} プロパティを持ちます。
3027
3028 例えば、デフォルトでは拍子記号は最初の行の先頭で描画されますが、@c
3029 変更されない限り他の場所には描画されません。@c
3030 変更された場合、拍子記号は変更が行われた場所に描画されます。@c
3031 この変更が行の最後で行われた場合、新しい拍子記号は次の行の先頭に描画され、@c
3032 その前の行の最後にも忠告の拍子記号が描画されます。
3033
3034 この振る舞いは @code{break-visibility} プロパティによって制御されます。@c
3035 このプロパティについての説明は
3036 @c Leave this ref on a newline - formats incorrectly otherwise -td
3037 @rlearning{オブジェクトの可視性と色}
3038 を参照してください。@c
3039 このプロパティは 3 つのブール値からなるベクトルをとり、@c
3040 順に、そのオブジェクトが行の最後で描画されるかどうか、@c
3041 行の途中で描画されるかどうか、@c
3042 そして、行の先頭で描画されるかどうかを決定します。@c
3043 より正確には、改行の前、改行がない場合、改行の後です。
3044
3045 @code{break-visibility} プロパティによって制御する代わりに、@c
3046 これら 8 通りの組み合わせを @file{scm/output-lib.scm} で定義されている@c
3047 定義済み関数によって指定することもできます。@c
3048 このファイルの中で、最後の 3 列がその列のヘッダで示される場所での@c
3049 可視性を表しています:
3050
3051 @multitable {@code{begin-of-line-invisible}} {@code{'#(#t #t #t)}} {yes} {yes} {yes}
3052 @headitem 関数                       @tab ベクトル                @tab 改行前 @tab 改行なし @tab 改行後
3053
3054 @item @code{all-visible}             @tab @code{'#(#t #t #t)}     @tab yes    @tab yes      @tab yes
3055 @item @code{begin-of-line-visible}   @tab @code{'#(#f #f #t)}     @tab no     @tab no       @tab yes
3056 @item @code{center-visible}          @tab @code{'#(#f #t #f)}     @tab no     @tab yes      @tab no
3057 @item @code{end-of-line-visible}     @tab @code{'#(#t #f #f)}     @tab yes    @tab no       @tab no
3058 @item @code{begin-of-line-invisible} @tab @code{'#(#t #t #f)}     @tab yes    @tab yes      @tab no
3059 @item @code{center-invisible}        @tab @code{'#(#t #f #t)}     @tab yes    @tab no       @tab yes
3060 @item @code{end-of-line-invisible}   @tab @code{'#(#f #t #t)}     @tab no     @tab yes      @tab yes
3061 @item @code{all-invisible}           @tab @code{'#(#f #f #f)}     @tab no     @tab no       @tab no
3062 @end multitable
3063
3064 @code{break-visibility} のデフォルト設定は@c
3065 レイアウト オブジェクトによって異なります。@c
3066 以下の表は、@code{break-visibility} によって影響をうける@c
3067 すべてのレイアウト オブジェクトと、そのプロパティのデフォルト設定を示しています:
3068
3069 @multitable @columnfractions .3 .3 .4
3070
3071 @headitem レイアウト オブジェクト   @tab 通常のコンテキスト  @tab デフォルト設定
3072
3073 @c omit Ambitus as it appears not to be affected by break-visibility -td
3074 @c @item @code{Ambitus}          @tab as specified   @tab @code{begin-of-line-visible}
3075 @item @code{BarLine}             @tab @code{Score}          @tab calculated
3076 @item @code{BarNumber}           @tab @code{Score}          @tab @code{begin-of-line-visible}
3077 @c omit the following item until it can be explained -td
3078 @c @item @code{BreakAlignGroup}  @tab @code{Score}          @tab calculated
3079 @item @code{BreathingSign}       @tab @code{Voice}          @tab @code{begin-of-line-invisible}
3080 @item @code{Clef}                @tab @code{Staff}          @tab @code{begin-of-line-visible}
3081 @item @code{Custos}              @tab @code{Staff}          @tab @code{end-of-line-visible}
3082 @item @code{DoublePercentRepeat} @tab @code{Voice}          @tab @code{begin-of-line-invisible}
3083 @c omit KeyCancellation until it can be explained -td
3084 @c @item @code{KeyCancellation}  @tab ??             @tab @code{begin-of-line-invisible}
3085 @item @code{KeySignature}        @tab @code{Staff}          @tab @code{begin-of-line-visible}
3086 @c omit LeftEdge until it can be explained -td
3087 @c @item @code{LeftEdge}         @tab @code{Score}          @tab @code{center-invisible}
3088 @item @code{OctavateEight}       @tab @code{Staff}          @tab @code{begin-of-line-visible}
3089 @item @code{RehearsalMark}       @tab @code{Score}          @tab @code{end-of-line-invisible}
3090 @item @code{TimeSignature}       @tab @code{Staff}          @tab @code{all-visible}
3091
3092 @end multitable
3093
3094 以下の例は、小節線の可視性を制御するベクトルの使用方法を示しています:
3095
3096 @c KEEP LY
3097 @lilypond[quote,verbatim,relative=1,ragged-right]
3098 f4 g a b
3099 f4 g a b
3100 % カレント行の最後で小節線を削除します
3101 \once \override Score.BarLine #'break-visibility = #'#(#f #t #t)
3102 \break
3103 f4 g a b
3104 f4 g a b
3105 @end lilypond
3106
3107 @code{break-visibility} をオーバライドするために使用される@c
3108 ベクトルの要素 3 つをすべて記述する必要がありますが、@c
3109 それらすべてが各レイアウト オブジェクトに対して効果を持つわけではなく、@c
3110 組み合わせによってはエラーになる場合もあります。@c
3111 以下の制限があります:
3112
3113 @itemize @bullet
3114 @item 小節線を行の先頭に描画することはできません。
3115 @item 小節番号は 1 から始まるのでなければ、@c
3116 最初の行の先頭に描画することはできません。
3117 @item 音部記号 -- 以下を参照してください
3118 @item 2 重線のパーセント繰り返しはすべて描画するか、@c
3119 すべて描画しないかのどちらかです。@c
3120 描画するには @code{begin-of-line-invisible} を用い、@c
3121 描画しないのなら @code{all-invisible} を用います。
3122 @item Key signature -- 以下を参照してください
3123 @item OctavateEight -- 以下を参照してください
3124 @end itemize
3125
3126 @node 特別な考慮を必要とするもの
3127 @unnumberedsubsubsec 特別な考慮を必要とするもの
3128 @translationof Special considerations
3129
3130 @strong{@emph{明示的な変更の後の可視性}}
3131
3132 @cindex key signature, visibility following explicit change (明示的な変更の後の調号の可視性)
3133 @cindex explicitKeySignatureVisibility
3134 @cindex clef, visibility following explicit change (明示的な変更の後の音部記号の可視性)
3135 @cindex explicitClefVisibility
3136
3137 @code{break-visibility} プロパティが調号の可視性と音部記号の変更を@c
3138 制御するのは、行の先頭 -- つまり、改行の後 -- においてだけです。@c
3139 行の途中や終わりでの明示的な調の変更や音部記号の変更の後に出現する@c
3140 調合や音部記号の可視性には効果を持ちません。@c
3141 以下の例では、@code{all-invisible} がセットされていますが、@c
3142 B フラット メジャーへの明示的な変更の後に出現する調号は可視のままです。
3143
3144 @c KEEP LY
3145 @lilypond[quote,verbatim,relative=1,ragged-right]
3146 \key g \major
3147 f4 g a b
3148 % すべての調号を削除しようと試みます
3149 \override Staff.KeySignature #'break-visibility = #all-invisible
3150 \key bes \major
3151 f4 g a b
3152 \break
3153 f4 g a b
3154 f4 g a b
3155 @end lilypond
3156
3157 そのような明示的な調号や音部記号の変更の可視性は
3158 @code{explicitKeySignatureVisibility} プロパティや
3159 @code{explicitClefVisibility} プロパティによって制御されます。@c
3160 これらは @code{break-visibility} プロパティと等価であり、@c
3161 どちらも @code{break-visibility} と同様に 3 つのブール値からなるベクトルか@c
3162 上でリストアップした定義済み関数をとります。@c
3163 どちらも @code{Staff} コンテキストのプロパティであり、@c
3164 レイアウト オブジェクト自体のプロパティではありません。@c
3165 ですから、これらは @code{\set} コマンドでセットします。@c
3166 どちらもデフォルトでは @code{all-visible} がセットされています。@c
3167 これらのプロパティは明示的な変更の結果として生じる@c
3168 調号と音部記号の可視性だけを制御し、@c
3169 行の先頭での調号や音部記号には効果を持ちませんので、@c
3170 オブジェクトを削除するには適切な @code{break-visibility}
3171 をオーバライドする必要があります。
3172
3173 @lilypond[quote,verbatim,relative=1,ragged-right]
3174 \key g \major
3175 f4 g a b
3176 \set Staff.explicitKeySignatureVisibility = #all-invisible
3177 \override Staff.KeySignature #'break-visibility = #all-invisible
3178 \key bes \major
3179 f4 g a b \break
3180 f4 g a b
3181 f4 g a b
3182 @end lilypond
3183
3184 @strong{@emph{忠告の臨時記号の可視性}}
3185
3186 明示的な調の変更で描画される忠告の臨時記号を削除するには、@c
3187 @code{Staff} コンテキスト プロパティ @code{printKeyCancellation} に
3188 @code{#f} をセットします:
3189
3190 @lilypond[quote,verbatim,relative=1,ragged-right]
3191 \key g \major
3192 f4 g a b
3193 \set Staff.explicitKeySignatureVisibility = #all-invisible
3194 \set Staff.printKeyCancellation = ##f
3195 \override Staff.KeySignature #'break-visibility = #all-invisible
3196 \key bes \major
3197 f4 g a b \break
3198 f4 g a b
3199 f4 g a b
3200 @end lilypond
3201
3202 このオーバライドによって、調の変更を示す臨時記号だけが残ります。
3203
3204 @c TODO Add visibility of cautionary accidentals before notes
3205
3206 @strong{@emph{自動小節線}}
3207
3208 @cindex automaticBars
3209 @cindex bar lines, suppressing (小節線を消す)
3210
3211 特殊なケースとして、@c
3212 @code{Score} コンテキストの @code{automaticBars} プロパティを@c
3213 設定することにより、小節線の描画を Off にすることもできます。@c
3214 @code{#f} をセットされた場合、小節線は自動的には描画されなくなり、@c
3215 @code{\bar} コマンドで明示的に作成しなければならなくなります。@c
3216 定義済みコマンド @code{\cadenzaOn} とは異なり、小節数はカウントされ続けます。@c
3217 後になってこのプロパティに @code{#t} がセットされると、@c
3218 このカウントに従って小節線の生成が再開されます。@c
3219 @code{#f} がセットされている場合、@c
3220 改行が起こりえるのは明示的な @code{\bar} コマンドがある場所でだけになります。
3221
3222 @c TODO Add example
3223
3224 @strong{@emph{オクターブ移調付きの音部記号}}
3225
3226 @cindex octavated clefs, visibility of (オクターブ移調付きの音部記号の可視性)
3227 @cindex visibility of octavated clefs (オクターブ移調付きの音部記号の可視性)
3228 @cindex clefs, visibility of octavation (オクターブ移調付きの音部記号の可視性)
3229
3230 オクターブ移調付きの音部記号上の小さなオクターブ記号は
3231 @code{OctavateEight} レイアウト オブジェクトによって作り出されます。@c
3232 このオブジェクトの可視性は
3233 @code{Clef} オブジェクトの可視性とは独立して制御されます。@c
3234 そのため、各行の先頭においてそのような音部記号を完全に消そうとするなら、@c
3235 @code{Clef} オブジェクトと @code{OctavateEight} オブジェクトの両方に対して@c
3236 必要な @code{break-visibility} のオーバライドを行う必要があります。
3237
3238 明示的な音部記号の変更では、@c
3239 @code{explicitClefVisibility} プロパティが@c
3240 音部記号とそれに関連するオクターブ記号の両方を制御します。
3241
3242 @seealso
3243 学習マニュアル:
3244 @rlearning{オブジェクトの可視性と色}
3245
3246
3247 @node ライン スタイル
3248 @subsection ライン スタイル
3249 @translationof Line styles
3250
3251 いくつかの演奏指示子
3252 -- 例えば、@i{rallentando}, @i{accelerando} それに @i{trills} など --
3253 はテキストとして記述され、@c
3254 線で (点線や波線の場合もあります) でいくつもの小節にわたって広がります。
3255
3256 これらはすべてグリッサンドと同じルーチンを用いてテキストと線を描きます。@c
3257 そのため、それらの振る舞いの調整も同じように行います。@c
3258 これらはスパナによって実現され、スパナを描くルーチンは
3259 @code{ly:line-interface::print} です。@c
3260 このルーチンは 2 つの @i{スパン ポイント} の位置を決定し、@c
3261 要求されたスタイルに応じてそれら 2 点の間に線を描きます。
3262
3263 利用可能なライン スタイルと、それらをどのように調整するかを示す例を挙げます。
3264
3265 @lilypond[relative=2,ragged-right,verbatim,fragment]
3266 d2 \glissando d'2
3267 \once \override Glissando #'style = #'dashed-line
3268 d,2 \glissando d'2
3269 \override Glissando #'style = #'dotted-line
3270 d,2 \glissando d'2
3271 \override Glissando #'style = #'zigzag
3272 d,2 \glissando d'2
3273 \override Glissando #'style = #'trill
3274 d,2 \glissando d'2
3275 @end lilypond
3276
3277 スパナの終点の位置は各グラフィック オブジェクトごとに@c
3278 オンザフライ (その場、その時々) で計算されますが、@c
3279 それらをオーバライドすることもできます:
3280
3281 @c TODO Complete
3282 @lilypond[relative=2,ragged-right,verbatim,quote]
3283 e2 \glissando f
3284 \once \override Glissando #'(bound-details right Y) = #-2
3285 e2 \glissando f
3286 @end lilypond
3287
3288 グリッサンドの終点の @code{Y} には @code{-2} がセットされています。@c
3289 @code{right} の代わりに @code{left} を指定することにより、@c
3290 始点も同じように調整することができます。
3291
3292 @code{Y} がセットされていない場合、@c
3293 その値はスパナが取り付けられるポイントの垂直位置から算出されます。
3294
3295 スパナに他の調整を行うことも可能です。@c
3296 詳細は @ref{スパナ} を参照してください。
3297
3298
3299 @node オブジェクトを回転させる
3300 @subsection オブジェクトを回転させる
3301 @translationof Rotating objects
3302
3303 レイアウト オブジェクトとマークアップ テキストの要素はどちらも@c
3304 任意のポイントを中心にして任意の角度で回転させることができます。@c
3305 しかしながら、回転させる方法はまったく異なります。
3306
3307 @menu
3308 * レイアウト オブジェクトを回転させる::
3309 * マークアップを回転させる::
3310 @end menu
3311
3312 @node レイアウト オブジェクトを回転させる
3313 @unnumberedsubsubsec レイアウト オブジェクトを回転させる
3314 @translationof Rotating layout objects
3315
3316 @cindex rotating objects (オブジェクトを回転させる)
3317 @cindex objects, rotating (オブジェクトを回転させる)
3318
3319 @code{grob-interface} をサポートするすべてのレイアウト オブジェクトは、@c
3320 それらのオブジェクトの @code{rotation} プロパティを設定することにより、@c
3321 回転させることができます。@c
3322 これは 3 要素のリストをとります: 反時計回りの回転の角度、@c
3323 オブジェクトの参照ポイントからの相対座標 x と y
3324 (この座標が回転の中心になります) です。@c
3325 回転の角度は @q{°}で指定し、座標は譜スペースで指定します。
3326
3327 回転の角度と回転の中心座標は、トライ&エラーで決定する必要があります。
3328
3329 @cindex hairpins, angled (回転させられたヘアピン)
3330 @cindex angled hairpins (回転させられたヘアピン)
3331
3332 レイアウト オブジェクトを回転させることが有用な状況はあまりありません。@c
3333 以下の例は、有用であるかもしれないシチュエーションの 1 つを示しています:
3334
3335 @lilypond[quote,verbatim,relative=1]
3336 g4\< e' d' f\!
3337 \override Hairpin #'rotation = #'(20 -1 0)
3338 g,,4\< e' d' f\!
3339 @end lilypond
3340
3341 @node マークアップを回転させる
3342 @unnumberedsubsubsec マークアップを回転させる
3343 @translationof Rotating markup
3344
3345 すべてのマークアップ テキストは、@code{\rotate} コマンドを前に置くことにより、@c
3346 任意の角度に回転させることができます。@c
3347 このコマンドは 2 つの引数をとります: 反時計回りの回転の角度 @q{°} と、@c
3348 回転させられるテキストです。@c
3349 テキストの領域は回転しません:
3350 テキストの領域は回転させられるテキストの四隅になります。@c
3351 以下の例では、自動衝突回避を不可にするために@c
3352 テキストの @code{outside-staff-priority} プロパティに @code{#f} を@c
3353 セットしています。@c
3354 そうしなければテキストのいくつかは高く押し上げられてしまいます。
3355
3356 @lilypond[quote,verbatim,relative=1]
3357 \override TextScript #'outside-staff-priority = ##f
3358 g4^\markup { \rotate #30 "a G" }
3359 b^\markup { \rotate #30 "a B" }
3360 des^\markup { \rotate #30 "a D-Flat" }
3361 fis^\markup { \rotate #30 "an F-Sharp" }
3362 @end lilypond
3363
3364
3365 @node 高度な調整
3366 @section 高度な調整
3367 @translationof Advanced tweaks
3368
3369 このセクションでは、@c
3370 楽譜の見た目を細かく調節するためのさまざまなアプローチについて議論します。
3371
3372 @menu
3373 * オブジェクトを揃える::
3374 * グラフィカル オブジェクトを垂直方向にグループ化する::
3375 * ステンシルを変更する::
3376 * 形状を変更する::
3377 * unpure-pure コンテナ::
3378 @end menu
3379
3380 @seealso
3381 学習マニュアル:
3382 @rlearning{出力を調整する},
3383 @rlearning{その他の情報源}
3384
3385 記譜法リファレンス:
3386 @ref{内部リファレンスの説明},
3387 @ref{プロパティを変更する}
3388
3389 拡張:
3390 @rextend{Interfaces for programmers}
3391
3392 インストールされているファイル:
3393 @file{scm/define-grobs.scm}
3394
3395 コード断片集:
3396 @rlsr{Tweaks and overrides}
3397
3398 内部リファレンス:
3399 @rinternals{All layout objects}
3400
3401
3402 @node オブジェクトを揃える
3403 @subsection オブジェクトを揃える
3404 @translationof Aligning objects
3405
3406 @code{self-alignment-interface} と/あるいは @code{side-position-interface} を@c
3407 サポートするグラフィカル オブジェクトは、@c
3408 さまざまな形式で配置済みのオブジェクトに揃えることができます。@c
3409 そのようなオブジェクトのリストは、@rinternals{self-alignment-interface} と
3410 @rinternals{side-position-interface} を参照してください。@c
3411
3412 すべてのグラフィカル オブジェクトは参照ポイント、水平方向の広がり、@c
3413 それに垂直方向の広がりを持ちます。@c
3414 水平方向の広がりは、@c
3415 参照ポイントから左端と右端までの距離を意味する数値のペアであり、@c
3416 左端は負値です。@c
3417 垂直方向の広がりは、@c
3418 参照ポイントから下端と上端までの距離を意味する数値のペアであり、@c
3419 下端は負値です。@c
3420
3421 あるオブジェクトの譜面上の位置は、@code{X-offset} プロパティと
3422 @code{Y-offset} プロパティの値によって与えられます。@c
3423 @code{X-offset} の値は、親オブジェクトの参照ポイントの X 座標からの@c
3424 距離を意味します。@c
3425 @code{Y-offset} の値は、譜の中央線からの距離を意味します。@c
3426 @code{X-offset} と @code{Y-offset} の値は直接設定されることもありますし、@c
3427 いくつかの形式で親オブジェクトと揃えるために@c
3428 プロシージャによって算出されることもあります。
3429
3430 @c positioning considerations: 配置のための考慮 -> 配置規則
3431 @warning{多くのオブジェクトは特殊な配置規則を持っています。@c
3432 そのため、そのオブジェクトが @code{self-alignment-interface} を@c
3433 サポートしていたとしても、@c
3434 @code{X-offset} あるいは @code{Y-offset} の設定は無視されたり、@c
3435 変更されることがあります。}
3436
3437 例えば、臨時記号は @code{Y-offset} を設定することにより@c
3438 垂直方向の位置を変更することができますが、@code{X-offset} は効果を持ちません。
3439
3440 リハーサル記号は、小節線、音部記号、拍子記号それに調号などの@c
3441 改行可能なオブジェクトに揃えることができます。@c
3442 リハーサル記号をそのようなオブジェクトに合わせて配置するために、@c
3443 @code{break-aligned-interface} の中に特別なプロパティがあります。
3444
3445 @seealso
3446 記譜法リファレンス:
3447 @ref{break-alignable-interface を使用する},
3448
3449 拡張:
3450 @rextend{Callback functions}
3451
3452 @menu
3453 * X-offset と Y-offset を直接設定する::
3454 * side-position-interface を使用する::
3455 * self-alignment-interface を使用する::
3456 * break-alignable-interface を使用する::
3457 @end menu
3458
3459 @node X-offset と Y-offset を直接設定する
3460 @unnumberedsubsubsec @code{X-offset} と @code{Y-offset} を直接設定する
3461 @translationof Setting X-offset and Y-offset directly
3462
3463 多くのオブジェクトの @code{X-offset} プロパティと @code{Y-offset} プロパティに@c
3464 数値を与えることができます。@c
3465 以下の例は、3 つの音符を示していて、1 つはデフォルト配置の運指記号を持ち、@c
3466 他の 2 つの運指記号は @code{X-offset} と @code{Y-offset} が変更されています。
3467
3468 @lilypond[verbatim,quote,relative=2]
3469 a-3
3470 a
3471 -\tweak #'X-offset #0
3472 -\tweak #'Y-offset #0
3473 -3
3474 a
3475 -\tweak #'X-offset #-1
3476 -\tweak #'Y-offset #1
3477 -3
3478 @end lilypond
3479
3480 @c TODO write more
3481
3482 @node side-position-interface を使用する
3483 @unnumberedsubsubsec @code{side-position-interface} を使用する
3484 @translationof Using the @code{side-position-interface}
3485
3486 @code{side-position-interface} をサポートするオブジェクトは、@c
3487 その親オブジェクトの隣に配置することができ、@c
3488 それにより、@c
3489 それら 2 つのオブジェクトの指定された端をくっつけることができます。@c
3490 オブジェクトを親オブジェクトの上、下、右、あるいは左に配置することができます。@c
3491 親オブジェクトを指定することはできません:
3492 親オブジェクトは入力ストリームの中での要素の順序によって決定されます。@c
3493 たいていのオブジェクトの親オブジェクトは、@c
3494 そのオブジェクトに関連する符頭となります。
3495
3496 @code{side-axis} プロパティと @code{direction} プロパティの値は、@c
3497 以下のように、オブジェクトが配置される場所を決定します:
3498
3499 @c TODO add an example of each to the table
3500
3501 @multitable @columnfractions .3 .3 .3
3502 @headitem @code{side-axis}  @tab @code{direction}  @tab
3503 @headitem property          @tab property          @tab Placement
3504
3505 @item     @code{0}          @tab @code{-1}         @tab 左
3506 @item     @code{0}          @tab @code{1}          @tab 右
3507 @item     @code{1}          @tab @code{-1}         @tab 下
3508 @item     @code{1}          @tab @code{1}          @tab 上
3509
3510 @end multitable
3511
3512 @code{side-axis} が @code{0} である場合、@code{X-offset} には@c
3513 プロシージャ @code{ly:side-position-interface::x-aligned-side} を@c
3514 セットする必要があります。@c
3515 このプロシージャは、@code{direction} の値に基づいて@c
3516 親オブジェクトの左あるいは右にオブジェクトを配置するための適切な値を
3517 @code{X-offset} に返します。
3518
3519 @code{side-axis} が @code{1} である場合、@code{Y-offset} には@c
3520 プロシージャ @code{ly:side-position-interface::y-aligned-side} を@c
3521 セットする必要があります。@c
3522 このプロシージャは、@code{direction} の値に基づいて@c
3523 親オブジェクトの上あるいは下にオブジェクトを配置するための適切な値を
3524 @code{Y-offset} に返します。
3525
3526 @c TODO Add examples
3527
3528 @node self-alignment-interface を使用する
3529 @unnumberedsubsubsec @code{self-alignment-interface} を使用する
3530 @translationof Using the @code{self-alignment-interface}
3531
3532 @emph{オブジェクトを自動的に水平方向に揃える}
3533
3534 @code{self-alignment-interface} をサポートするオブジェクトの水平方向の揃えは、@c
3535 @code{self-alignment-X} プロパティの値によって制御され、@c
3536 そのオブジェクトの @code{X-offset} プロパティには@c
3537 任意の実数値を与えることができる
3538 @code{ly:self-alignment-interface::x-aligned-on-self}.
3539 @code{self-alignment-X} がセットされます。@c
3540 与える実数値は、そのオブジェクトの X 方向の広がりの半分を単位とします。@c
3541 負値はオブジェクトを右に移動させ、正値はオブジェクトを左に移動させます。@c
3542 値が @code{0} であればそのオブジェクトは親オブジェクトの参照ポイントに@c
3543 中央揃えされ、@c
3544 値が @code{-1} であればそのオブジェクトの左端が親オブジェクトの参照ポイントに@c
3545 揃えられ、@c
3546 値が @code{1} であればそのオブジェクトの右端が親オブジェクトの参照ポイントに@c
3547 揃えられます。@c
3548 記号 @code{LEFT}, @code{CENTER}, それに @code{RIGHT} は@c
3549 それぞれ @w{@code{-1}, @code{0}, それに @code{1}} に対応します。
3550
3551 通常、@code{\override} コマンドを用いて @code{self-alignment-X} の値を@c
3552 変更しますが、@c
3553 @code{\tweak} コマンドを用いることで@c
3554 単一の音符に付けられている複数の注釈を個別に揃えることができます:
3555
3556 @lilypond[quote,verbatim,relative=1]
3557 a'
3558 -\tweak #'self-alignment-X #-1
3559 ^"left-aligned"
3560 -\tweak #'self-alignment-X #0
3561 ^"center-aligned"
3562 -\tweak #'self-alignment-X #RIGHT
3563 ^"right-aligned"
3564 -\tweak #'self-alignment-X #-2.5
3565 ^"aligned further to the right"
3566 @end lilypond
3567
3568 @emph{オブジェクトを自動的に垂直方向に揃える}
3569
3570 オブジェクトの @code{Y-offset} プロパティに
3571 @code{ly:self-alignment-interface::y-aligned-on-self} がセットされていれば、@c
3572 水平方向の揃えと同じように、垂直方向に揃えることができます。@c
3573 しかしながら、垂直方向の揃えには他のメカニズムも関与します:
3574 @code{Y-offset} の値は、垂直方向の揃えに関与する変数の 1 つに過ぎません。@c
3575 このことにより、いくつかのオブジェクトの @code{Y-offset} 値の調整は@c
3576 ややこしくなります。@c
3577 単位はそのオブジェクトの垂直方向の広がりの半分です。@c
3578 通常これは非常に小さいため、非常に大きな数値が必要になる可能性があります。@c
3579 値が @code{-1} であればそのオブジェクトの下端が親オブジェクトの参照ポイントに@c
3580 揃えられ、@c
3581 値が @code{0} であればそのオブジェクトの中央が親オブジェクトの参照ポイントに@c
3582 揃えられ、@c
3583 値が @code{1} であればそのオブジェクトの上端が親オブジェクトの参照ポイントに@c
3584 揃えられます。@c
3585 記号 @code{DOWN}, @code{CENTER}, それに @code{UP} は@c
3586 それぞれ @w{@code{-1}, @code{0}, それに @code{1}} に対応します。
3587
3588 @emph{オブジェクトを自動的に両方向に揃える}
3589
3590 @code{X-offset} と @code{Y-offset} の両方の設定を行うことで、@c
3591 オブジェクトの水平方向と垂直方向の揃えを同時に行うことができます。
3592
3593 以下の例は、運指記号を符頭に近づけるための調整方法を示しています。
3594
3595 @c KEEP LY
3596 @lilypond[quote,verbatim,relative=2]
3597 a
3598 -\tweak #'self-alignment-X #0.5  % 左方向に移動させます
3599 -\tweak #'Y-offset #ly:self-alignment-interface::y-aligned-on-self
3600 -\tweak #'self-alignment-Y #-1  % 上方向に移動させます
3601 -3  % 3 の指
3602 @end lilypond
3603
3604 @ignore
3605 @unnumberedsubsubsec Using the @code{aligned-on-parent} procedures
3606
3607 @c Cannot document as they do not seem to operate consistently on all objects -td
3608 @c TODO investigate further
3609
3610 The @code{aligned-on-parent} procedures are used in the same way
3611 as the @code{aligned-on-self} procedures, they difference being
3612 that they permit an object to be aligned with the @emph{edges} of
3613 the parent rather than the parent's reference point.  The following
3614 example shows the difference:
3615
3616 @c TODO Add example
3617
3618 @lilypond[verbatim,quote]
3619 @end lilypond
3620
3621 @end ignore
3622
3623 @ignore
3624 @unnumberedsubsubsec Using the @code{centered-on-parent} procedures
3625
3626 @c Cannot document as they do not seem to operate consistently on all objects -td
3627 @c TODO investigate further
3628
3629 @end ignore
3630
3631 @c TODO The align-interface, BassFigureAlignment and VerticalAlignment
3632
3633 @node break-alignable-interface を使用する
3634 @unnumberedsubsubsec @code{break-alignable-interface} を使用する
3635 @translationof Using the @code{break-alignable-interface}
3636
3637 @cindex align to objects (オブジェクトに揃える)
3638 @cindex break-align-symbols
3639
3640 リハーサル記号と小節番号を小節線ではなく、@c
3641 記譜オブジェクトに揃えることができます。@c
3642 対象となる記譜オブジェクトには、@code{ambitus},
3643 @code{breathing-sign}, @code{clef}, @code{custos}, @code{staff-bar},
3644 @code{left-edge}, @code{key-cancellation}, @code{key-signature}, それに
3645 @code{time-signature} があります。
3646
3647 デフォルトでは、@c
3648 リハーサル記号と小節番号はオブジェクトの上で水平方向に中央揃えされます:
3649
3650 @c KEEP LY
3651 @lilypond[verbatim,quote,relative=1]
3652 % リハーサル記号は音部記号の上に中央揃えされます
3653 \override Score.RehearsalMark #'break-align-symbols = #'(clef)
3654 \key a \major
3655 \clef treble
3656 \mark "↓"
3657 e1
3658 % リハーサル記号は拍子記号の上に中央揃えされます
3659 \override Score.RehearsalMark #'break-align-symbols = #'(time-signature)
3660 \key a \major
3661 \clef treble
3662 \time 3/4
3663 \mark "↓"
3664 e2.
3665 % リハーサル記号はブレス記号の上に中央揃えされます
3666 \override Score.RehearsalMark #'break-align-symbols = #'(breathing-sign)
3667 \key a \major
3668 \clef treble
3669 \time 4/4
3670 e1
3671 \breathe
3672 \mark "↓"
3673 @end lilypond
3674
3675 揃えの対象となり得るオブジェクトのリストを指定することができます。@c
3676 揃えを行う時点で対象リストの中にあるオブジェクトのいくつかが不可視である
3677 -- @code{break-visibility} の設定や、@c
3678 調号と音部に対する明示的な可視性の設定により --
3679 場合、リハーサル記号あるいは小節番号はリストの中にある@c
3680 最初の可視のオブジェクトに揃えられます。@c
3681 リストの中にあるオブジェクトがすべて不可視である場合、小節線に揃えられます。@c
3682 小節線が不可視である場合、小節線があるはずの場所に揃えられます。
3683
3684 @c KEEP LY
3685 @lilypond[verbatim,quote,relative=1]
3686 % リハーサル記号は調号の上に中央揃えされます
3687 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature clef)
3688 \key a \major
3689 \clef treble
3690 \mark "↓"
3691 e1
3692 % リハーサル記号は音部記号の上に中央揃えされます
3693 \set Staff.explicitKeySignatureVisibility = #all-invisible
3694 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature clef)
3695 \key a \minor
3696 \clef bass
3697 \mark "↓"
3698 gis,,1
3699 % リハーサル記号は小節線の上に中央揃えされます
3700 \set Staff.explicitKeySignatureVisibility = #all-invisible
3701 \set Staff.explicitClefVisibility = #all-invisible
3702 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature clef)
3703 \key a \major
3704 \clef treble
3705 \mark "↓"
3706 e''1
3707 @end lilypond
3708
3709 以下の例で示すように、@c
3710 記譜オブジェクトに対するリハーサル記号の揃えを変更することができます。@c
3711 複数の譜を持つ楽譜では、この設定はすべての譜に適用されます。
3712
3713 @c KEEP LY
3714 @lilypond[verbatim,quote,relative=1]
3715 % RehearsalMark は KeySignature の上に中央揃えされます
3716 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
3717 \key a \major
3718 \clef treble
3719 \time 4/4
3720 \mark "↓"
3721 e1
3722 % RehearsalMark は KeySignature の左端に揃えられます
3723 \once \override Score.KeySignature #'break-align-anchor-alignment = #LEFT
3724 \mark "↓"
3725 \key a \major
3726 e
3727 % RehearsalMark は KeySignature の右端に揃えられます
3728 \once \override Score.KeySignature #'break-align-anchor-alignment = #RIGHT
3729 \key a \major
3730 \mark "↓"
3731 e
3732 @end lilypond
3733
3734 また、リハーサル記号を左端に揃えて、@c
3735 さらに任意の量だけ右あるいは左にずらすことができます。@c
3736 単位は譜スペースです:
3737
3738 @c KEEP LY
3739 @lilypond[verbatim,quote,relative=1]
3740 % リハーサル記号は調号の左端に揃えられて
3741 % さらに 3.5 譜スペース右にずらされます
3742 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
3743 \once \override Score.KeySignature #'break-align-anchor = #3.5
3744 \key a \major
3745 \mark "↓"
3746 e1
3747 % リハーサル記号は調号の左端に揃えられて
3748 % さらに 2 譜スペース左にずらされます
3749 \once \override Score.KeySignature #'break-align-anchor = #-2
3750 \key a \major
3751 \mark "↓"
3752 e1
3753 @end lilypond
3754
3755
3756 @node グラフィカル オブジェクトを垂直方向にグループ化する
3757 @subsection グラフィカル オブジェクトを垂直方向にグループ化する
3758 @translationof Vertical grouping of grobs
3759
3760 @c FIXME Expand this section
3761
3762 VerticalAlignment グラフィカル オブジェクトと
3763 VerticalAxisGroup グラフィカル オブジェクトは対で機能します。@c
3764 VerticalAxisGroup は Staff, Lyrics, 等のような@c
3765 異なるグラフィカル オブジェクトをグループにまとめます。@c
3766 それから、VerticalAlignment が
3767 VerticalAxisGroup によってグループ化されたグラフィカル オブジェクトを@c
3768 垂直方向に揃えます。@c
3769 通常、楽譜には VerticalAlignment は 1 つしかありませんが、@c
3770 Staff, Lyrics 等はそれ自体でそれぞれに VerticalAxisGroup を持ちます。
3771
3772
3773 @node ステンシルを変更する
3774 @subsection ステンシルを変更する
3775 @translationof Modifying stencils
3776
3777 すべてのレイアウト オブジェクトは、@c
3778 @code{grob-interface} の一部である @code{stencil} プロパティを持ちます。@c
3779 通常、デフォルトでこのプロパティには、@c
3780 出力でそのオブジェクトを具現化する記号を描画するための@c
3781 特有の関数がセットされています。@c
3782 例えば、@code{MultiMeasureRest} オブジェクトの @code{stencil} プロパティに@c
3783 対する標準設定は、@code{ly:multi-measure-rest::print} です。
3784
3785 @code{stencil} プロパティを変更して異なる描画関数を参照させることにより、@c
3786 オブジェクトの標準記号を置き換えることができます。@c
3787 これには LilyPond 内部機能についての高い知識が求められます。@c
3788 しかしながら、多くの場合にまずまずの結果を生み出すもっと簡単な方法があります。
3789
3790 簡単な方法では、@code{stencil} プロパティにテキストを描画する関数
3791 -- @code{ly:text-interface::print} -- をセットし、@c
3792 必要な記号を生み出すマークアップ テキストを保持するよう設定された
3793  @code{text} プロパティ与えます。@c
3794 マークアップの自由度の高さにより、多くのことを達成できます。@c
3795 詳細は、@ref{マークアップ内部でのグラフィック記譜法} を参照してください。
3796
3797 以下の例では、この方法を用いて符頭記号を内部に×を持つ円に変更しています。
3798
3799 @lilypond[verbatim,quote]
3800 XinO = {
3801   \once \override NoteHead  #'stencil = #ly:text-interface::print
3802   \once \override NoteHead #'text = \markup {
3803     \combine
3804       \halign #-0.7 \draw-circle #0.85 #0.2 ##f
3805       \musicglyph #"noteheads.s2cross"
3806   }
3807 }
3808 \relative c'' {
3809   a a \XinO a a
3810 }
3811 @end lilypond
3812
3813 @code{\musicglyph} マークアップ コマンドには、@c
3814 Feta フォントに含まれる任意の図柄を提供することができます。@c
3815 @ref{The Feta font} を参照してください。
3816
3817 @c TODO Add inserting eps files or ref to later
3818
3819 @c TODO Add inserting Postscript or ref to later
3820
3821 @seealso
3822 記譜法リファレンス:
3823 @ref{マークアップ内部でのグラフィック記譜法},
3824 @ref{テキストをフォーマットする},
3825 @ref{Text markup commands},
3826 @ref{The Feta font}
3827
3828
3829 @node 形状を変更する
3830 @subsection 形状を変更する
3831 @translationof Modifying shapes
3832
3833 @menu
3834 * タイとスラーの形状を変更する::
3835 @end menu
3836
3837 @node タイとスラーの形状を変更する
3838 @unnumberedsubsubsec タイとスラーの形状を変更する
3839 @translationof Modifying ties and slurs
3840
3841 @cindex slurs, modifying (スラーの形状を変更する)
3842 @cindex ties, modifying (タイの形状を変更する)
3843 @cindex Bézier curves (ベジエ曲線)
3844 @cindex Bézier control points (ベジエ曲線の制御ポイント)
3845
3846 タイ、スラー、それにフレージング スラーは 3 次のベジエ曲線として描かれます。@c
3847 自動的に算出されるタイあるいはスラーの形状が最適ではない場合、@c
3848 3 次ベジエ曲線を定義するのに必要な 4 つの制御ポイントを@c
3849 明示的に指定することによって、形状を変更することができます。
3850
3851 3 次あるいは 3 乗のベジエ曲線は、4 つの制御ポイントによって定義されます。@c
3852 1 番目と 4 番目の制御ポイントは曲線の始点と終点になります。@c
3853 間にある 2 つの制御ポイントは曲線の形状を定義します。@c
3854 Web でベジエ曲線が描かれる様子を示すアニメーションを@c
3855 見つけることができるでしょう。@c
3856 しかしながら、以下の記述も役に立つかもしれません。@c
3857 ベジエ曲線は最初の制御ポイントから 2 番目の制御ポイントに進み、@c
3858 徐々に 3 番目の制御ポイントの方へ向きを変えながら
3859 4 番目の制御ポイントの方へ向かい続け、@c
3860 3 番目の制御ポイントから 4 番目の制御ポイントに到達します。@c
3861 ベジエ曲線は 4 つの制御ポイントからなる四角形の中に納まります。
3862
3863 ここで、@c
3864 タイが最適化されず、@code{\tieDown} が役に立たないケースを例として挙げます。
3865
3866 @lilypond[verbatim,quote,relative=1]
3867 <<
3868   { e1 ~ e }
3869 \\
3870   { r4 <g c,> <g c,> <g c,> }
3871 >>
3872 @end lilypond
3873
3874 以下のようにタイの制御ポイントを手動で変更することにより、@c
3875 このタイの形状を改善することができます。
3876
3877 ベジエ制御ポイントの座標は譜スペースを単位として指定されます。@c
3878 X@tie{}座標はそのタイあるいはスラーを取り付けられる音符の参照ポイントからの@c
3879 相対座標であり、Y@tie{}座標は譜の中央線からの相対座標です。@c
3880 制御ポイント座標は 10 進数 (実数) のペアを 4 つ持つリストとして設定されます。@c
3881 最適な制御ポイントを決定するための手順は、
3882 2 つの終点の座標を見積もり、それから 2 つの中間ポイントを推測することで、@c
3883 制御ポイントの座標を決定します。@c
3884 最適値はトライ&エラーで見つけ出します。
3885
3886 左右対称の曲線にするには制御ポイントを左右対称に配置する必要があるということを@c
3887 覚えておくと役に立ちます。@c
3888 また、ベジエ曲線の制御ポイントに平行移動、回転、それに拡大縮小などの変換を@c
3889 適用することにより、@c
3890 その曲線を変換できるという特性があるとも覚えておいてください。
3891
3892 上記の実例として、以下の例のオーバライドで満足のいくタイが得られています。@c
3893 オーバライドを配置する場所
3894 -- タイ (あるいはスラー) が開始する音符の直前に配置する必要があります --
3895 に注意してください。
3896
3897 @lilypond[verbatim,quote,relative=1]
3898 <<
3899   {
3900     \once \override Tie
3901       #'control-points = #'((1 . -1) (3 . 0.6) (12.5 . 0.6) (14.5 . -1))
3902      e1 ~ e
3903   }
3904 \\
3905   { r4 <g c,> <g c,> <g c,> }
3906 >>
3907 @end lilypond
3908
3909 @knownissues
3910 同じ音楽タイミングに複数のタイあるいはスラーが存在する場合、@c
3911 @code{control-points} プロパティを変更しても@c
3912 それらの形状を変更することはできません。@c
3913 @code{\tweak} コマンドを用いたとしても変更できません。@c
3914 しかしながら、@code{TieColumn} の @code{tie-configuration} プロパティを@c
3915 オーバライドすることで、タイの垂直方向の位置と領域を変更することができます。
3916
3917 @seealso
3918 内部リファレンス:
3919 @rinternals{TieColumn}
3920
3921 @cindex Scheme, pure containers (Scheme pure コンテナ)
3922 @cindex Scheme, unpure containers (Scheme unpure コンテナ)
3923 @cindex pure containers, Scheme (Scheme pure コンテナ)
3924 @cindex unpure containers, Scheme (Scheme unpure コンテナ)
3925 @cindex horizontal spacing, overriding (水平方向のスペースを上書きする)
3926
3927
3928 @node unpure-pure コンテナ
3929 @subsection unpure-pure コンテナ
3930 @translationof Unpure-pure containers
3931
3932 unpure-pure コンテナは @emph{Y-axis} スペース - 特に @code{Y-offset} と
3933 @code{Y-extent} - の算出を文字 (つまり、数字やペア) ではなく、Scheme 関数で@c
3934 上書きする際に有用です。
3935
3936 ある特定のグラフィカル オブジェクトでは、@code{Y-extent} は @code{stencil}
3937 プロパティをベースにしていて、それらの @code{stencil} プロパティを上書きする場合は
3938 unpure-pure コンテナで @code{Y-extent} も上書きする必要があります。@c
3939 関数が @code{Y-offset} と/または @code{Y-extent} を上書きした場合、@c
3940 その関数はコンパイルの最中に改行の算出を早すぎるタイミングで引き起こすと見なされます。@c
3941 そのため、その関数はまったく評価されず (通常、@samp{0} または @samp{'(0 . 0)} の@c
3942 値を返します)、結果として衝突を引き起こすことがあります。@c
3943 @q{pure} 関数はプロパティ、オブジェクト、あるいはグラフィカル オブジェクトの消失に@c
3944 影響を与えないため、その関数の Y-axis に関する評価は常に正しく行われます。
3945
3946 現在のところ @q{pure} と見なされる関数が約 30 あり、Unpure-pure コンテナを用いて
3947 @q{pure} ではない関数を @q{pure} な関数としてセットすることができます。@c
3948 @q{pure} 関数は改行の @emph{前に} 評価されるため、水平方向のスペースを
3949 @q{正しいタイミングで} 調節することができます。@c
3950 @q{unpure} 関数は改行の @emph{後に} 評価されます。
3951
3952 @warning{@q{pure} な関数を常に把握していることは困難なので、作成する @q{pure}
3953 関数ではグラフィカル オブジェクト @code{Beam} や @code{VerticalAlignment} を@c
3954 使わないことをおすすめします。}
3955
3956 unpure-pure コンテナは以下のように構築します:
3957
3958 @code{(ly:make-unpure-pure-container f0 f1)}
3959
3960 ここで @code{f0} は @var{n} (@var{n >= 1}) 個の引数を取る関数であり、最初の引数@c
3961 は常にグラフィカル オブジェクトである必要があります。@c
3962 これが実際に結果を返す関数です。@c
3963 @code{f1} は @q{pure} であると見なされる関数であり、@var{n + 2} 個の引数を@c
3964 取ります。@c
3965 @code{f1} も最初の引数は常にグラフィカル オブジェクトである必要があり、2 番目と
3966 3 番目の引数は @q{start} と @q{end} です。
3967
3968 @q{start} と @q{end} は事実上、@code{Spanners} (つまり、@code{Hairpin} や
3969 @code{Beam}) だけで問題となるダミー値であり、
3970 @var{start} and @var{end} are, for all intents and purposes, dummy
3971 values that only matter for @code{Spanners} (i.e @code{Hairpin} or
3972 @code{Beam}), that can return different height estimations based on a
3973 starting and ending column.
3974
3975 @code{f1} の残りの引数は @code{f0} の引数と同じです (@var{n = 1} である場合は@c
3976 残りの引数はありません)。
3977
3978 関数 @code{f1} の結果は概算であり、@code{f0} が実際の値を得るのに用いられます。@c
3979 @code{f0} の結果はもっと後のスペースの処理で微調整に用いられます。
3980
3981 @lilypond[verbatim,quote,ragged-right]
3982 #(define (square-line-circle-space grob)
3983 (let* ((pitch (ly:event-property (ly:grob-property grob 'cause) 'pitch))
3984       (notename (ly:pitch-notename pitch)))
3985  (if (= 0 (modulo notename 2))
3986      (make-circle-stencil 0.5 0.0 #t)
3987      (make-filled-box-stencil '(0 . 1.0)
3988                               '(-0.5 . 0.5)))))
3989
3990 squareLineCircleSpace = {
3991   \override NoteHead #'stencil = #square-line-circle-space
3992 }
3993
3994 smartSquareLineCircleSpace = {
3995   \squareLineCircleSpace
3996   \override NoteHead #'Y-extent =
3997    #(ly:make-unpure-pure-container
3998       ly:grob::stencil-height
3999       (lambda (grob start end) (ly:grob::stencil-height grob)))
4000 }
4001
4002 \new Voice \with { \remove "Stem_engraver" }
4003 \relative c'' {
4004   \squareLineCircleSpace
4005   cis4 ces cisis c
4006   \smartSquareLineCircleSpace
4007   cis4 ces cisis c
4008 }
4009 @end lilypond
4010
4011 最初の小節では unpure-pure コンテナを用いていないため、スペース算出エンジンは符頭の@c
4012 幅を知ることができず、符頭と臨時記号が衝突しています。@c
4013 次の小節では unpure-pure コンテナを用いているため、スペース算出エンジンは符頭の幅を@c
4014 知ることができ、それに応じて小節の幅を増やすことで衝突を回避しています。
4015
4016 通常、簡単な計算では、unpure-pure コンテナの @q{unpure} パートと @q{pure} パート@c
4017 の両方に、引数の数とスコープを変えただけのほとんど同じ関数を用いることができます。
4018
4019 @warning{@q{pure} と見なした関数が @q{pure} でなかった場合、予期しない結果となる@c
4020 ことがあります。}
4021
4022
4023 @node 音楽関数を使用する
4024 @section 音楽関数を使用する
4025 @translationof Using music functions
4026
4027 @c TODO -- add @seealso, etc. to these subsections
4028
4029 調整を異なる音楽表記に再利用する必要がある場合、@c
4030 その調整を音楽関数にしておくと便利です。@c
4031 このセクションでは、@emph{置換} 関数についてだけ議論します。@c
4032 置換関数は変数を LilyPond 入力コードに置き換えます。@c
4033 他のもっと複雑な関数については、@rextend{Music functions} で記述されています。
4034
4035 @menu
4036 * 置換関数の構文::
4037 * 置換関数の例::
4038 @end menu
4039
4040 @node 置換関数の構文
4041 @subsection 置換関数の構文
4042 @translationof Substitution function syntax
4043
4044 変数を LilyPond コードに置換する関数を作成することは簡単にできます。@c
4045 置換関数の一般的な形式は以下のようなものです:
4046
4047 @example
4048 function =
4049 #(define-music-function
4050      (parser location @var{arg1} @var{arg2} @dots{})
4051      (@var{type1?} @var{type2?} @dots{})
4052    #@{
4053      @var{@dots{}music@dots{}}
4054    #@})
4055 @end example
4056
4057 @noindent
4058 ここで
4059
4060 @multitable @columnfractions .33 .66
4061 @item @code{@var{argN}}
4062 @tab @var{n} 番目の引数
4063
4064 @item @code{@var{typeN?}}
4065 @tab @code{@var{argN}} が @code{#t} を返す Scheme の @emph{型述語} (type predicate)。
4066
4067 @item @code{@var{@dots{}music@dots{}}}
4068 @tab 通常の LilyPond 入力。@code{$} を用いて引数を参照します
4069 (例: @samp{$arg1})。
4070 @end multitable
4071
4072 です。
4073
4074 引数 @code{parser} と @code{location} を省略することはできず、@c
4075 @rextend{Music functions} で記述されている高度な状況で@c
4076 使用されることがあります。
4077 置換関数において、必ずこれらの引数を記述してください。
4078
4079 引数として、型述語のリストも必須です。@c
4080 音楽関数で用いられる一般的な型述語には下記のものがあります:
4081
4082 @example
4083 boolean?
4084 cheap-list?  @emph{(}@q{list?}@emph{ の代わりに用いることで、処理を高速にします)}
4085 ly:music?
4086 markup?
4087 number?
4088 pair?
4089 string?
4090 symbol?
4091 @end example
4092
4093 @noindent
4094 利用可能な型述語のリストは、@c
4095 @ref{Predefined type predicates} を参照してください。@c
4096 ユーザが型述語を定義することもできます。
4097
4098 @seealso
4099 記譜法リファレンス:
4100 @ref{Predefined type predicates}
4101
4102 拡張:
4103 @rextend{Music functions}
4104
4105 インストールされているファイル:
4106 @file{lily/music-scheme.cc},
4107 @file{scm/c++.scm},
4108 @file{scm/lily.scm}
4109
4110
4111 @node 置換関数の例
4112 @subsection 置換関数の例
4113 @translationof Substitution function examples
4114
4115 このセクションでは、置換関数の例をいくつか紹介します。@c
4116 高度なことはしていませんが、シンプルな置換関数を実現する方法を示しています。
4117
4118 最初の例では、@c
4119 @code{TextScript} のパディング設定を容易にするための関数が定義されています:
4120
4121 @lilypond[quote,verbatim,ragged-right]
4122 padText =
4123 #(define-music-function
4124      (parser location padding)
4125      (number?)
4126    #{
4127      \once \override TextScript #'padding = $padding
4128    #})
4129
4130 \relative c''' {
4131   c4^"piu mosso" b a b
4132   \padText #1.8
4133   c4^"piu mosso" d e f
4134   \padText #2.6
4135   c4^"piu mosso" fis a g
4136 }
4137 @end lilypond
4138
4139 数値のほかに、音符などの音楽表記を音楽関数への引数にすることができます:
4140
4141 @c TODO: use a better example (the music argument is redundant).
4142
4143 @lilypond[quote,verbatim,ragged-right]
4144 custosNote =
4145 #(define-music-function
4146      (parser location note)
4147      (ly:music?)
4148    #{
4149      \once \override Voice.NoteHead #'stencil =
4150        #ly:text-interface::print
4151      \once \override Voice.NoteHead #'text =
4152        \markup \musicglyph #"custodes.mensural.u0"
4153      \once \override Voice.Stem #'stencil = ##f
4154      $note
4155    #})
4156
4157 \relative c' { c4 d e f \custosNote g }
4158 @end lilypond
4159
4160 複数の引数をとる置換関数を定義することもできます:
4161
4162 @lilypond[quote,verbatim,ragged-right]
4163 tempoPadded =
4164 #(define-music-function
4165      (parser location padding tempotext)
4166      (number? string?)
4167    #{
4168      \once \override Score.MetronomeMark #'padding = $padding
4169      \tempo \markup { \bold #tempotext }
4170    #})
4171
4172 \relative c'' {
4173   \tempo \markup { "Low tempo" }
4174   c4 d e f g1
4175   \tempoPadded #4.0 #"High tempo"
4176   g4 f e d c1
4177 }
4178 @end lilypond
4179
4180 @c TODO: add appropriate @@ref's here.