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