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