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