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